Fixed runtime issues reported by SonarQube.

This commit is contained in:
Akshay Joshi 2020-06-16 14:53:40 +05:30
parent 3e00fe2b0f
commit cf64e2c97c
13 changed files with 37 additions and 46 deletions

View File

@ -14,12 +14,16 @@
ConfigWindow::ConfigWindow(QWidget *parent) :
QDialog(parent)
{
initConfigWindow();
}
void ConfigWindow::initConfigWindow()
{
ui = new Ui::ConfigWindow;
ui->setupUi(this);
}
void ConfigWindow::on_buttonBox_accepted()
{
this->close();

View File

@ -46,6 +46,7 @@ private slots:
private:
Ui::ConfigWindow *ui;
void initConfigWindow();
};
#endif // CONFIGWINDOW_H

View File

@ -15,21 +15,15 @@
FloatingWindow::FloatingWindow(QWidget *parent) :
QMainWindow(parent),
m_newAction(Q_NULLPTR),
m_configAction(Q_NULLPTR),
m_logAction(Q_NULLPTR),
m_quitAction(Q_NULLPTR),
m_floatingWindowMenu(Q_NULLPTR),
m_menuActions(Q_NULLPTR)
QMainWindow(parent)
{
ui = new Ui::FloatingWindow;
ui->setupUi(this);
}
bool FloatingWindow::Init()
{
ui = new Ui::FloatingWindow;
ui->setupUi(this);
// Creating Menu
createMenu();

View File

@ -40,11 +40,11 @@ private:
void createActions();
void closeEvent(QCloseEvent * event);
QAction *m_newAction;
QAction *m_copyUrlAction;
QAction *m_configAction;
QAction *m_logAction;
QAction *m_quitAction;
QAction *m_newAction = Q_NULLPTR;
QAction *m_copyUrlAction = Q_NULLPTR;
QAction *m_configAction = Q_NULLPTR;
QAction *m_logAction = Q_NULLPTR;
QAction *m_quitAction = Q_NULLPTR;
QMenu *m_floatingWindowMenu;
MenuActions *m_menuActions;

View File

@ -20,12 +20,16 @@
LogWindow::LogWindow(QWidget *parent, QString serverLogFile) :
QDialog(parent),
m_serverLogFile(serverLogFile)
{
initLogWindow();
}
void LogWindow::initLogWindow()
{
ui = new Ui::LogWindow;
ui->setupUi(this);
}
void LogWindow::LoadLog()
{
int startupLines;

View File

@ -36,6 +36,7 @@ private:
QString m_startupLogFile;
QString m_serverLogFile;
void initLogWindow();
int readLog(QString logFile, QPlainTextEdit *logWidget);
};

View File

@ -15,14 +15,10 @@
#include <QClipboard>
#include <QMessageBox>
MenuActions::MenuActions():
m_appServerUrl(""),
m_logFile(""),
m_logWindow(Q_NULLPTR)
MenuActions::MenuActions()
{
}
void MenuActions::setAppServerUrl(QString appServerUrl)
{
m_appServerUrl = appServerUrl;

View File

@ -29,9 +29,9 @@ public:
QString getAppServerUrl() { return m_appServerUrl; }
private:
QString m_appServerUrl;
QString m_logFile;
LogWindow *m_logWindow;
QString m_appServerUrl = "";
QString m_logFile = "";
LogWindow *m_logWindow = Q_NULLPTR;
protected slots:
void onNew();

View File

@ -58,9 +58,7 @@ static void add_to_path(QString &python_path, QString path, bool prepend=false)
Server::Server(quint16 port, QString key, QString logFileName):
m_port(port),
m_key(key),
m_logFileName(logFileName),
m_wcAppName(Q_NULLPTR),
m_wcPythonHome(Q_NULLPTR)
m_logFileName(logFileName)
{
// Initialise Python
Py_NoSiteFlag=1;
@ -81,7 +79,7 @@ Server::Server(quint16 port, QString key, QString logFileName):
QString python_path = settings.value("PythonPath").toString();
// Get the application directory
QString app_dir = qApp->applicationDirPath();
QString app_dir = QCoreApplication::applicationDirPath();
QString path_env = qgetenv("PATH");
QString pythonHome;
QStringList path_list;

View File

@ -46,11 +46,11 @@ private:
QString m_logFileName;
// Application name in UTF-8 for Python
wchar_t *m_wcAppName;
wchar_t *m_wcAppName = Q_NULLPTR;
QByteArray PGA_APP_NAME_UTF8;
// PythonHome for Python
wchar_t *m_wcPythonHome;
wchar_t *m_wcPythonHome = Q_NULLPTR;
QByteArray pythonHome_utf8;
};

View File

@ -12,14 +12,7 @@
// App headers
#include "TrayIcon.h"
TrayIcon::TrayIcon():
m_newAction(Q_NULLPTR),
m_configAction(Q_NULLPTR),
m_logAction(Q_NULLPTR),
m_quitAction(Q_NULLPTR),
m_trayIcon(Q_NULLPTR),
m_trayIconMenu(Q_NULLPTR),
m_menuActions(Q_NULLPTR)
TrayIcon::TrayIcon()
{
}

View File

@ -33,11 +33,11 @@ private:
void createTrayIcon();
void createActions();
QAction *m_newAction;
QAction *m_copyUrlAction;
QAction *m_configAction;
QAction *m_logAction;
QAction *m_quitAction;
QAction *m_newAction = Q_NULLPTR;
QAction *m_copyUrlAction = Q_NULLPTR;
QAction *m_configAction = Q_NULLPTR;
QAction *m_logAction = Q_NULLPTR;
QAction *m_quitAction = Q_NULLPTR;
QSystemTrayIcon *m_trayIcon;
QMenu *m_trayIconMenu;

View File

@ -233,9 +233,9 @@ int main(int argc, char * argv[])
#if QT_VERSION >= 0x050000
QTcpSocket socket;
#if QT_VERSION >= 0x050900
#if QT_VERSION >= 0x050900
socket.setProxy(QNetworkProxy::NoProxy);
#endif
#endif
socket.bind(0, QTcpSocket::ShareAddress);
#else