dbhub: Open Preferences dialog on the correct tab

When opening the Preferences dialog from the Remote dock, we now show
the Remote tab by default.
This commit is contained in:
Martin Kleusberg
2018-12-12 14:10:28 +01:00
parent 88ce4acf97
commit d86b45e7e6
4 changed files with 25 additions and 6 deletions

View File

@@ -203,7 +203,8 @@ public slots:
void jumpToRow(const sqlb::ObjectIdentifier& table, QString column, const QByteArray& value);
void switchToBrowseDataTab(QString tableToBrowse = QString());
void populateStructure(const QString& old_table = QString());
void openPreferences();
void reloadSettings();
private slots:
void createTreeContextMenu(const QPoint & qPoint);
@@ -257,7 +258,6 @@ private slots:
void saveSqlResultsAsCsv();
void saveSqlResultsAsView();
void loadExtension();
void reloadSettings();
void checkNewVersion(const QString& versionstring, const QString& url);
void on_actionWiki_triggered();
void on_actionBug_report_triggered();
@@ -297,6 +297,7 @@ private slots:
void runSqlNewTab(const QString& query, const QString& title);
void printDbStructure();
void updateDatabaseBusyStatus(bool busy, const QString& user);
void openPreferences();
};
#endif

View File

@@ -13,7 +13,7 @@
#include <QKeyEvent>
#include <QStandardPaths>
PreferencesDialog::PreferencesDialog(QWidget* parent)
PreferencesDialog::PreferencesDialog(QWidget* parent, Tabs tab)
: QDialog(parent),
ui(new Ui::PreferencesDialog),
m_dbFileExtensions(Settings::getValue("General", "DBFileExtensions").toString().split(";;"))
@@ -43,6 +43,9 @@ PreferencesDialog::PreferencesDialog(QWidget* parent)
// Avoid different heights due to having check boxes or not
ui->treeSyntaxHighlighting->setUniformRowHeights(true);
// Set current tab
ui->tabWidget->setCurrentIndex(tab);
}
/*

View File

@@ -19,7 +19,17 @@ class PreferencesDialog : public QDialog
Q_OBJECT
public:
explicit PreferencesDialog(QWidget* parent = nullptr);
enum Tabs
{
TabGeneral,
TabDatabase,
TabDataBrowser,
TabSql,
TabExtensions,
TabRemote
};
explicit PreferencesDialog(QWidget* parent = nullptr, Tabs tab = TabGeneral);
~PreferencesDialog() override;
private slots:

View File

@@ -9,6 +9,7 @@
#include "RemoteModel.h"
#include "MainWindow.h"
#include "RemotePushDialog.h"
#include "PreferencesDialog.h"
RemoteDock::RemoteDock(MainWindow* parent)
: QDialog(parent),
@@ -32,9 +33,13 @@ RemoteDock::RemoteDock(MainWindow* parent)
// just open them in a web browser
connect(ui->labelNoCert, &QLabel::linkActivated, [this](const QString& link) {
if(link == "#preferences")
mainWindow->openPreferences();
else
{
PreferencesDialog dialog(mainWindow, PreferencesDialog::TabRemote);
if(dialog.exec())
mainWindow->reloadSettings();
} else {
QDesktopServices::openUrl(QUrl(link));
}
});
// Initial setup