mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Replace runtime menu with shortcuts for a cleaner UI (and
because 99% of users don't need those options anyway).
This commit is contained in:
@@ -45,9 +45,8 @@ BrowserWindow::BrowserWindow(QString url)
|
|||||||
|
|
||||||
m_appServerUrl = url;
|
m_appServerUrl = url;
|
||||||
|
|
||||||
// Setup the UI
|
// Setup the shortcuts
|
||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
|
||||||
|
|
||||||
m_tabWidget = new TabWindow(this);
|
m_tabWidget = new TabWindow(this);
|
||||||
m_mainGridLayout = new QGridLayout(m_tabWidget);
|
m_mainGridLayout = new QGridLayout(m_tabWidget);
|
||||||
@@ -111,45 +110,24 @@ void BrowserWindow::closeEvent(QCloseEvent *event)
|
|||||||
void BrowserWindow::createActions()
|
void BrowserWindow::createActions()
|
||||||
{
|
{
|
||||||
// Open an arbitrary URL
|
// Open an arbitrary URL
|
||||||
openUrlAction = new QAction(tr("&Open URL..."), this);
|
openUrlShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_U), this);
|
||||||
openUrlAction->setShortcut(tr("Ctrl+U"));
|
openUrlShortcut->setContext(Qt::ApplicationShortcut);
|
||||||
openUrlAction->setStatusTip(tr("Open a URL"));
|
connect(openUrlShortcut, SIGNAL(activated()), this, SLOT(openUrl()));
|
||||||
connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl()));
|
|
||||||
|
|
||||||
// Set the Python Path
|
// Set the Python Path
|
||||||
configurationAction = new QAction(tr("&Configuration..."), this);
|
preferencesShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P), this);
|
||||||
configurationAction->setStatusTip(tr("Configure the application paths"));
|
preferencesShortcut->setContext(Qt::ApplicationShortcut);
|
||||||
connect(configurationAction, SIGNAL(triggered()), this, SLOT(configuration()));
|
connect(preferencesShortcut, SIGNAL(activated()), this, SLOT(preferences()));
|
||||||
|
|
||||||
// Exit the app
|
// Exit the app
|
||||||
exitAction = new QAction(tr("E&xit"), this);
|
exitShortcut = new QShortcut(QKeySequence::Quit, this);
|
||||||
exitAction->setStatusTip(tr("Exit the application"));
|
exitShortcut->setContext(Qt::ApplicationShortcut);
|
||||||
exitAction->setShortcuts(QKeySequence::Quit);
|
connect(exitShortcut, SIGNAL(activated()), this, SLOT(close()));
|
||||||
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
|
||||||
|
|
||||||
// About box
|
// About box
|
||||||
aboutAction = new QAction(tr("&About"), this);
|
aboutShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A), this);
|
||||||
aboutAction->setStatusTip(tr("Show the application's About box"));
|
aboutShortcut->setContext(Qt::ApplicationShortcut);
|
||||||
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
connect(aboutShortcut, SIGNAL(activated()), this, SLOT(about()));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Create the application menus
|
|
||||||
void BrowserWindow::createMenus()
|
|
||||||
{
|
|
||||||
// File
|
|
||||||
fileMenu = menuBar()->addMenu(tr("&File"));
|
|
||||||
fileMenu->addAction(openUrlAction);
|
|
||||||
fileMenu->addSeparator();
|
|
||||||
fileMenu->addAction(configurationAction);
|
|
||||||
fileMenu->addSeparator();
|
|
||||||
fileMenu->addAction(exitAction);
|
|
||||||
|
|
||||||
menuBar()->addSeparator();
|
|
||||||
|
|
||||||
// Help
|
|
||||||
helpMenu = menuBar()->addMenu(tr("&Help"));
|
|
||||||
helpMenu->addAction(aboutAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -465,7 +443,7 @@ void BrowserWindow::openUrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit the app configuration
|
// Edit the app configuration
|
||||||
void BrowserWindow::configuration()
|
void BrowserWindow::preferences()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -487,4 +465,3 @@ void BrowserWindow::configuration()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ protected slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openUrl();
|
void openUrl();
|
||||||
void configuration();
|
void preferences();
|
||||||
void about();
|
void about();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -58,12 +58,11 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
QString m_appServerUrl;
|
QString m_appServerUrl;
|
||||||
WebViewWindow *m_mainWebView;
|
WebViewWindow *m_mainWebView;
|
||||||
QMenu *fileMenu;
|
|
||||||
QMenu *helpMenu;
|
QShortcut *openUrlShortcut;
|
||||||
QAction *openUrlAction;
|
QShortcut *preferencesShortcut;
|
||||||
QAction *configurationAction;
|
QShortcut *exitShortcut;
|
||||||
QAction *exitAction;
|
QShortcut *aboutShortcut;
|
||||||
QAction *aboutAction;
|
|
||||||
|
|
||||||
QGridLayout *m_tabGridLayout;
|
QGridLayout *m_tabGridLayout;
|
||||||
QGridLayout *m_mainGridLayout;
|
QGridLayout *m_mainGridLayout;
|
||||||
@@ -82,7 +81,6 @@ private:
|
|||||||
int m_loadAttempt;
|
int m_loadAttempt;
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
|
||||||
void pause(int seconds = 1);
|
void pause(int seconds = 1);
|
||||||
int findURLTab(const QUrl &name);
|
int findURLTab(const QUrl &name);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user