Fixed code smells in runtime code reported by SonarQube.

This commit is contained in:
Akshay Joshi 2020-07-29 18:26:41 +05:30
parent 74fd5dfe96
commit 099fea15ae
7 changed files with 13 additions and 13 deletions

View File

@ -41,7 +41,7 @@ Logger* Logger::GetLogger()
return m_pThis;
}
void Logger::Log(const QString& sMessage)
void Logger::Log(const QString& sMessage) const
{
QString text = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss: ") + sMessage + "\n";
if (m_Logfile != Q_NULLPTR)

View File

@ -20,7 +20,7 @@ class Logger : public QObject
public:
static Logger* GetLogger();
static void ReleaseLogger();
void Log(const QString& sMessage);
void Log(const QString& sMessage) const;
private:
Logger();

View File

@ -31,7 +31,7 @@ void MenuActions::setAppServerUrl(QString appServerUrl)
// Create a new application browser window on user request
void MenuActions::onNew()
void MenuActions::onNew() const
{
QSettings settings;
QString cmd = settings.value("BrowserCommand").toString();
@ -55,7 +55,7 @@ void MenuActions::onNew()
// Copy the application server URL to the clipboard
void MenuActions::onCopyUrl()
void MenuActions::onCopyUrl() const
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(m_appServerUrl);

View File

@ -22,7 +22,7 @@ public:
MenuActions();
void setAppServerUrl(QString appServerUrl);
QString getAppServerUrl() { return m_appServerUrl; }
QString getAppServerUrl() const { return m_appServerUrl; }
private:
QString m_appServerUrl = "";
@ -33,8 +33,8 @@ public slots:
void onConfigDone(bool needRestart) const;
protected slots:
void onNew();
void onCopyUrl();
void onNew() const;
void onCopyUrl() const;
void onConfig();
void onLog();
void onQuit();

View File

@ -91,7 +91,7 @@ bool Runtime::go(int argc, char *argv[])
floatingWindow = createFloatingWindow(splash, menuActions);
// Fire up the app server
Server *server = startServerLoop(splash, floatingWindow, trayIcon, port, key);
const Server *server = startServerLoop(splash, floatingWindow, trayIcon, port, key);
// Ensure we'll cleanup
QObject::connect(server, SIGNAL(finished()), server, SLOT(deleteLater()));
@ -136,7 +136,7 @@ bool Runtime::go(int argc, char *argv[])
// Setup the styling
void Runtime::setupStyling(QApplication *app)
void Runtime::setupStyling(QApplication *app) const
{
// Setup the styling
#ifndef Q_OS_LINUX
@ -222,7 +222,7 @@ bool Runtime::alreadyRunning()
}
void Runtime::configureProxy()
void Runtime::configureProxy() const
{
// In windows and linux, it is required to set application level proxy
// because socket bind logic to find free port gives socket creation error

View File

@ -44,8 +44,8 @@ private:
QSharedMemory *m_shmem;
bool m_configDone;
void setupStyling(QApplication *app);
void configureProxy();
void setupStyling(QApplication *app) const;
void configureProxy() const;
QSplashScreen *displaySplash(QApplication *app);
quint16 getPort() const;
TrayIcon *createTrayIcon(QSplashScreen *splash, MenuActions *menuActions);

View File

@ -26,7 +26,7 @@ public:
~Server();
bool Init();
QString getError() { return m_error; }
QString getError() const { return m_error; }
public slots:
void shutdown(QUrl url);