mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smells in runtime code reported by SonarQube.
This commit is contained in:
parent
74fd5dfe96
commit
099fea15ae
@ -41,7 +41,7 @@ Logger* Logger::GetLogger()
|
|||||||
return m_pThis;
|
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";
|
QString text = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss: ") + sMessage + "\n";
|
||||||
if (m_Logfile != Q_NULLPTR)
|
if (m_Logfile != Q_NULLPTR)
|
||||||
|
@ -20,7 +20,7 @@ class Logger : public QObject
|
|||||||
public:
|
public:
|
||||||
static Logger* GetLogger();
|
static Logger* GetLogger();
|
||||||
static void ReleaseLogger();
|
static void ReleaseLogger();
|
||||||
void Log(const QString& sMessage);
|
void Log(const QString& sMessage) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger();
|
Logger();
|
||||||
|
@ -31,7 +31,7 @@ void MenuActions::setAppServerUrl(QString appServerUrl)
|
|||||||
|
|
||||||
|
|
||||||
// Create a new application browser window on user request
|
// Create a new application browser window on user request
|
||||||
void MenuActions::onNew()
|
void MenuActions::onNew() const
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
QString cmd = settings.value("BrowserCommand").toString();
|
QString cmd = settings.value("BrowserCommand").toString();
|
||||||
@ -55,7 +55,7 @@ void MenuActions::onNew()
|
|||||||
|
|
||||||
|
|
||||||
// Copy the application server URL to the clipboard
|
// Copy the application server URL to the clipboard
|
||||||
void MenuActions::onCopyUrl()
|
void MenuActions::onCopyUrl() const
|
||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(m_appServerUrl);
|
clipboard->setText(m_appServerUrl);
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
MenuActions();
|
MenuActions();
|
||||||
|
|
||||||
void setAppServerUrl(QString appServerUrl);
|
void setAppServerUrl(QString appServerUrl);
|
||||||
QString getAppServerUrl() { return m_appServerUrl; }
|
QString getAppServerUrl() const { return m_appServerUrl; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_appServerUrl = "";
|
QString m_appServerUrl = "";
|
||||||
@ -33,8 +33,8 @@ public slots:
|
|||||||
void onConfigDone(bool needRestart) const;
|
void onConfigDone(bool needRestart) const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onNew();
|
void onNew() const;
|
||||||
void onCopyUrl();
|
void onCopyUrl() const;
|
||||||
void onConfig();
|
void onConfig();
|
||||||
void onLog();
|
void onLog();
|
||||||
void onQuit();
|
void onQuit();
|
||||||
|
@ -91,7 +91,7 @@ bool Runtime::go(int argc, char *argv[])
|
|||||||
floatingWindow = createFloatingWindow(splash, menuActions);
|
floatingWindow = createFloatingWindow(splash, menuActions);
|
||||||
|
|
||||||
// Fire up the app server
|
// 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
|
// Ensure we'll cleanup
|
||||||
QObject::connect(server, SIGNAL(finished()), server, SLOT(deleteLater()));
|
QObject::connect(server, SIGNAL(finished()), server, SLOT(deleteLater()));
|
||||||
@ -136,7 +136,7 @@ bool Runtime::go(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Setup the styling
|
// Setup the styling
|
||||||
void Runtime::setupStyling(QApplication *app)
|
void Runtime::setupStyling(QApplication *app) const
|
||||||
{
|
{
|
||||||
// Setup the styling
|
// Setup the styling
|
||||||
#ifndef Q_OS_LINUX
|
#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
|
// In windows and linux, it is required to set application level proxy
|
||||||
// because socket bind logic to find free port gives socket creation error
|
// because socket bind logic to find free port gives socket creation error
|
||||||
|
@ -44,8 +44,8 @@ private:
|
|||||||
QSharedMemory *m_shmem;
|
QSharedMemory *m_shmem;
|
||||||
bool m_configDone;
|
bool m_configDone;
|
||||||
|
|
||||||
void setupStyling(QApplication *app);
|
void setupStyling(QApplication *app) const;
|
||||||
void configureProxy();
|
void configureProxy() const;
|
||||||
QSplashScreen *displaySplash(QApplication *app);
|
QSplashScreen *displaySplash(QApplication *app);
|
||||||
quint16 getPort() const;
|
quint16 getPort() const;
|
||||||
TrayIcon *createTrayIcon(QSplashScreen *splash, MenuActions *menuActions);
|
TrayIcon *createTrayIcon(QSplashScreen *splash, MenuActions *menuActions);
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
~Server();
|
~Server();
|
||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
QString getError() { return m_error; }
|
QString getError() const { return m_error; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void shutdown(QUrl url);
|
void shutdown(QUrl url);
|
||||||
|
Loading…
Reference in New Issue
Block a user