Make the runtime configuration dialog non-modal. Fixes #5490

Major refactoring of the runtime code, Specifically:
  - Move the bulk of the core code from main() into a new Runtime class.
  - Break up the mass of code that was main() into a number of relatively simple functions.
  - Make the Configuration dialog synchronous so the Log dialog can be properly viewed.
  - Enable/disable menu options at the right time.
  - Remove support for Qt < 5.0.
  - Remove the application name constant and hardcode the name to simplify the code.
  - Improve log messages.
  - Replace the sdbm hashing with Qt's MD5 hashing.
This commit is contained in:
Dave Page
2020-07-28 16:13:05 +05:30
committed by Akshay Joshi
parent ed0dc62b69
commit 46ba0310fa
23 changed files with 881 additions and 651 deletions

View File

@@ -9,13 +9,17 @@
//
//////////////////////////////////////////////////////////////////////////
// App headers
#include "pgAdmin4.h"
#include "TrayIcon.h"
#include <QMenu>
TrayIcon::TrayIcon()
{
}
void TrayIcon::Init()
{
createTrayIcon();
@@ -24,6 +28,7 @@ void TrayIcon::Init()
m_trayIcon->show();
}
// Create the tray icon
void TrayIcon::createTrayIcon()
{
@@ -60,19 +65,24 @@ void TrayIcon::createTrayIcon()
setWindowIcon(icon);
}
// Create the menu actions
void TrayIcon::createActions()
{
m_newAction = new QAction(QString(tr("&New %1 window...")).arg(PGA_APP_NAME), this);
m_newAction = new QAction(tr("&New pgAdmin 4 window..."), this);
m_newAction->setEnabled(false);
connect(m_newAction, SIGNAL(triggered()), m_menuActions, SLOT(onNew()));
m_copyUrlAction = new QAction(tr("&Copy server URL"), this);
m_copyUrlAction->setEnabled(false);
connect(m_copyUrlAction, SIGNAL(triggered()), m_menuActions, SLOT(onCopyUrl()));
m_configAction = new QAction(tr("&Configure..."), this);
m_configAction->setEnabled(true);
connect(m_configAction, SIGNAL(triggered()), m_menuActions, SLOT(onConfig()));
m_logAction = new QAction(tr("&View log..."), this);
m_logAction->setEnabled(true);
connect(m_logAction, SIGNAL(triggered()), m_menuActions, SLOT(onLog()));
m_quitAction = new QAction(tr("&Shut down server"), this);
@@ -80,12 +90,23 @@ void TrayIcon::createActions()
connect(m_quitAction, SIGNAL(triggered()), m_menuActions, SLOT(onQuit()));
}
void TrayIcon::enableShutdownMenu()
void TrayIcon::enablePostStartOptions()
{
if (m_newAction != Q_NULLPTR)
m_newAction->setEnabled(true);
if (m_copyUrlAction != Q_NULLPTR)
m_copyUrlAction->setEnabled(true);
if (m_configAction != Q_NULLPTR)
m_configAction->setEnabled(true);
if (m_logAction != Q_NULLPTR)
m_logAction->setEnabled(true);
if (m_quitAction != Q_NULLPTR)
{
m_quitAction->setEnabled(true);
}
}
void TrayIcon::setMenuActions(MenuActions * menuActions)