chore: make more const methods

This commit is contained in:
sithlord48
2025-05-23 16:00:57 -04:00
committed by Nick Bolton
parent e6a374369b
commit d2ac36f3ed
12 changed files with 20 additions and 18 deletions

View File

@ -410,7 +410,7 @@ void ArchNetworkBSD::throwErrorOnSocket(ArchSocket s)
}
}
void ArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking)
void ArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking) const
{
assert(fd != -1);

View File

@ -123,7 +123,7 @@ public:
private:
const int *getUnblockPipe();
const int *getUnblockPipeForThread(ArchThread);
void setBlockingOnSocket(int fd, bool blocking);
void setBlockingOnSocket(int fd, bool blocking) const;
void throwError(int) const;
void throwNameError(int) const;

View File

@ -24,7 +24,7 @@ ArgParser::ArgParser(App *app) : m_app(app)
{
}
bool ArgParser::parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv)
bool ArgParser::parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv) const
{
setArgsBase(args);
updateCommonArgs(argv);
@ -61,7 +61,7 @@ bool ArgParser::parseServerArgs(deskflow::ServerArgs &args, int argc, const char
return true;
}
bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv)
bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv) const
{
setArgsBase(args);
updateCommonArgs(argv);
@ -118,7 +118,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
bool ArgParser::parsePlatformArgs(
deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer
)
) const
{
#if !WINAPI_XWINDOWS
// no options for carbon or windows

View File

@ -23,9 +23,11 @@ class ArgParser
public:
explicit ArgParser(App *app);
bool parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv);
bool parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv);
bool parsePlatformArgs(deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer);
bool parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv) const;
bool parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv) const;
bool parsePlatformArgs(
deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer
) const;
bool parseGenericArgs(int argc, const char *const *argv, int &i) const;
bool parseDeprecatedArgs(int argc, const char *const *argv, int &i) const;
void setArgsBase(deskflow::ArgsBase &argsBase) const

View File

@ -196,7 +196,7 @@ deskflow::Screen *ClientApp::createScreen()
#endif
}
void ClientApp::updateStatus()
void ClientApp::updateStatus() const
{
updateStatus("");
}

View File

@ -62,7 +62,7 @@ public:
// Regular functions
//
void updateStatus();
void updateStatus() const;
void updateStatus(const std::string &msg) const;
void handleScreenError(const Event &, void *);
deskflow::Screen *openClientScreen();

View File

@ -257,7 +257,7 @@ void ServerApp::stopRetryTimer()
}
}
void ServerApp::updateStatus()
void ServerApp::updateStatus() const
{
updateStatus("");
}

View File

@ -85,7 +85,7 @@ public:
void handleClientsDisconnected(const Event &, void *);
void closeServer(Server *server);
void stopRetryTimer();
void updateStatus();
void updateStatus() const;
void updateStatus(const std::string_view &msg) const;
void closeClientListener(ClientListener *listen);
void stopServer();

View File

@ -129,12 +129,12 @@ void ActionDialog::actionTypeChanged(int index)
QTimer::singleShot(1, this, &ActionDialog::updateSize);
}
bool ActionDialog::isKeyAction(int index)
bool ActionDialog::isKeyAction(int index) const
{
return ((index == ActionTypes::PressKey) || (index == ActionTypes::ReleaseKey) || (index == ActionTypes::ToggleKey));
}
bool ActionDialog::canSave()
bool ActionDialog::canSave() const
{
if (isKeyAction(ui->comboActionType->currentIndex())) {
const QList<QListWidgetItem *> items = ui->listScreens->findItems("*", Qt::MatchWildcard);

View File

@ -45,8 +45,8 @@ private:
void updateSize();
void keySequenceChanged();
void actionTypeChanged(int index);
bool isKeyAction(int index);
bool canSave();
bool isKeyAction(int index) const;
bool canSave() const;
std::unique_ptr<Ui::ActionDialog> ui;
Hotkey &m_hotkey;

View File

@ -28,7 +28,7 @@ TlsCertificate::TlsCertificate(QObject *parent) : QObject(parent)
// do nothing
}
bool TlsCertificate::generateCertificate(const QString &path, int keyLength)
bool TlsCertificate::generateCertificate(const QString &path, int keyLength) const
{
qDebug("generating tls certificate: %s", qUtf8Printable(path));

View File

@ -17,7 +17,7 @@ public:
explicit TlsCertificate(QObject *parent = nullptr);
bool isCertificateValid(const QString &path) const;
bool generateCertificate(const QString &path, int keyLength);
bool generateCertificate(const QString &path, int keyLength) const;
bool generateFingerprint(const QString &certificateFilename) const;
int getCertKeyLength(const QString &path) const;
};