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); assert(fd != -1);

View file

@ -123,7 +123,7 @@ public:
private: private:
const int *getUnblockPipe(); const int *getUnblockPipe();
const int *getUnblockPipeForThread(ArchThread); const int *getUnblockPipeForThread(ArchThread);
void setBlockingOnSocket(int fd, bool blocking); void setBlockingOnSocket(int fd, bool blocking) const;
void throwError(int) const; void throwError(int) const;
void throwNameError(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); setArgsBase(args);
updateCommonArgs(argv); updateCommonArgs(argv);
@ -61,7 +61,7 @@ bool ArgParser::parseServerArgs(deskflow::ServerArgs &args, int argc, const char
return true; 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); setArgsBase(args);
updateCommonArgs(argv); updateCommonArgs(argv);
@ -118,7 +118,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
bool ArgParser::parsePlatformArgs( bool ArgParser::parsePlatformArgs(
deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer
) ) const
{ {
#if !WINAPI_XWINDOWS #if !WINAPI_XWINDOWS
// no options for carbon or windows // no options for carbon or windows

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,7 +28,7 @@ TlsCertificate::TlsCertificate(QObject *parent) : QObject(parent)
// do nothing // 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)); qDebug("generating tls certificate: %s", qUtf8Printable(path));

View file

@ -17,7 +17,7 @@ public:
explicit TlsCertificate(QObject *parent = nullptr); explicit TlsCertificate(QObject *parent = nullptr);
bool isCertificateValid(const QString &path) const; 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; bool generateFingerprint(const QString &certificateFilename) const;
int getCertKeyLength(const QString &path) const; int getCertKeyLength(const QString &path) const;
}; };