From ebbc900755b09862be95d29d2a02b8abd1792a3a Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 12 Jun 2019 15:10:41 -0400 Subject: added a few helper classes for user accounts and stats moved the api label to the status bar refactored a bunch of copy/pasted code in NexusInterface to use shouldThrottle() and throttledWarning() --- src/mainwindow.ui | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'src/mainwindow.ui') diff --git a/src/mainwindow.ui b/src/mainwindow.ui index d3f9ef39..bbcb734c 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -412,7 +412,7 @@ p, li { white-space: pre-wrap; } - + @@ -471,37 +471,6 @@ p, li { white-space: pre-wrap; } - - - - Nexus API Queued and Remaining Requests - - - <html><head/><body><p>This tracks the number of queued Nexus API requests on the left (<span style=" font-weight:600;">Q</span>) and the remaining daily (<span style=" font-weight:600;">D</span>) and hourly (<span style=" font-weight:600;">H</span>) requests on the right. The Nexus API limits you to a pool of requests per day and requests per hour. It is dynamically updated every time a request is completed. If you run out of requests, you will be unable to queue downloads, check updates, parse mod info, or even log in. Both pools must be consumed before this happens.</p></body></html> - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 2 - - - 1 - - - API: Q: 0 | D: 0 | H: 0 - - - Qt::AlignCenter - - - 2 - - - @@ -546,19 +515,6 @@ p, li { white-space: pre-wrap; } - - - - Qt::Horizontal - - - - 40 - 20 - - - - -- cgit v1.3.1 From a7757e8ba6f5d10feea9e58611bde4dcb911079b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 13 Jun 2019 23:43:51 -0400 Subject: added option to hide the status bar centralized menu visibility into a showMenuBar() function --- src/mainwindow.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++------ src/mainwindow.h | 8 ++++++-- src/mainwindow.ui | 9 +++++++++ 3 files changed, 60 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.ui') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2497b05d..c255759b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -203,6 +203,7 @@ MainWindow::MainWindow(QSettings &initSettings , ui(new Ui::MainWindow) , m_WasVisible(false) , m_menuBarVisible(true) + , m_statusBarVisible(true) , m_linksSeparator(nullptr) , m_Tutorial(this, "MainWindow") , m_OldProfileIndex(-1) @@ -752,6 +753,7 @@ void MainWindow::toolbarMenu_aboutToShow() ui->actionMainMenuToggle->setChecked(ui->menuBar->isVisible()); ui->actionToolBarMainToggle->setChecked(ui->toolBar->isVisible()); + ui->actionStatusBarToggle->setChecked(ui->statusBar->isVisible()); ui->actionToolBarSmallIcons->setChecked(ui->toolBar->iconSize() == SmallToolbarSize); ui->actionToolBarMediumIcons->setChecked(ui->toolBar->iconSize() == MediumToolbarSize); @@ -769,8 +771,7 @@ QMenu* MainWindow::createPopupMenu() void MainWindow::on_actionMainMenuToggle_triggered() { - ui->menuBar->setVisible(!ui->menuBar->isVisible()); - m_menuBarVisible = ui->menuBar->isVisible(); + showMenuBar(!ui->menuBar->isVisible()); } void MainWindow::on_actionToolBarMainToggle_triggered() @@ -778,6 +779,11 @@ void MainWindow::on_actionToolBarMainToggle_triggered() ui->toolBar->setVisible(!ui->toolBar->isVisible()); } +void MainWindow::on_actionStatusBarToggle_triggered() +{ + showStatusBar(!ui->statusBar->isVisible()); +} + void MainWindow::on_actionToolBarSmallIcons_triggered() { setToolbarSize(SmallToolbarSize); @@ -822,6 +828,36 @@ void MainWindow::setToolbarButtonStyle(Qt::ToolButtonStyle s) } } +void MainWindow::showMenuBar(bool b) +{ + ui->menuBar->setVisible(b); + m_menuBarVisible = b; +} + +void MainWindow::showStatusBar(bool b) +{ + ui->statusBar->setVisible(b); + m_statusBarVisible = b; + + // the central widget typically has no bottom padding because the status bar + // is more than enough, but when it's hidden, the bottom widget (currently + // the log) touches the bottom border of the window, which looks ugly + // + // when hiding the statusbar, the central widget is given the same border + // margin as it has on the top (which is typically 6, as it's the default from + // the qt designer) + + auto m = ui->centralWidget->layout()->contentsMargins(); + + if (b) { + m.setBottom(0); + } else { + m.setBottom(m.top()); + } + + ui->centralWidget->layout()->setContentsMargins(m); +} + void MainWindow::on_centralWidget_customContextMenuRequested(const QPoint &pos) { // this allows for getting the context menu even if both the menubar and all @@ -2096,8 +2132,11 @@ void MainWindow::readSettings() } if (settings.contains("menubar_visible")) { - m_menuBarVisible = settings.value("menubar_visible").toBool(); - ui->menuBar->setVisible(m_menuBarVisible); + showMenuBar(settings.value("menubar_visible").toBool()); + } + + if (settings.contains("statusbar_visible")) { + showStatusBar(settings.value("statusbar_visible").toBool()); } if (settings.contains("window_split")) { @@ -2193,6 +2232,7 @@ void MainWindow::storeSettings(QSettings &settings) { settings.setValue("toolbar_size", ui->toolBar->iconSize()); settings.setValue("toolbar_button_style", static_cast(ui->toolBar->toolButtonStyle())); settings.setValue("menubar_visible", m_menuBarVisible); + settings.setValue("statusbar_visible", m_statusBarVisible); settings.setValue("window_split", ui->splitter->saveState()); settings.setValue("window_monitor", QApplication::desktop()->screenNumber(this)); settings.setValue("log_split", ui->topLevelSplitter->saveState()); @@ -6989,8 +7029,7 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) // if the menubar is hidden, pressing Alt will make it visible if (event->key() == Qt::Key_Alt) { if (!ui->menuBar->isVisible()) { - ui->menuBar->setVisible(true); - m_menuBarVisible = true; + showMenuBar(true); } } diff --git a/src/mainwindow.h b/src/mainwindow.h index e2c6ce8b..88389738 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -326,8 +326,8 @@ private: bool m_WasVisible; // this has to be remembered because by the time storeSettings() is called, - // the window is closed and the menubar is hidden - bool m_menuBarVisible; + // the window is closed and the all bars are hidden + bool m_menuBarVisible, m_statusBarVisible; std::unique_ptr m_statusBar; @@ -651,6 +651,7 @@ private slots: // ui slots void on_actionExit_triggered(); void on_actionMainMenuToggle_triggered(); void on_actionToolBarMainToggle_triggered(); + void on_actionStatusBarToggle_triggered(); void on_actionToolBarSmallIcons_triggered(); void on_actionToolBarMediumIcons_triggered(); void on_actionToolBarLargeIcons_triggered(); @@ -694,6 +695,9 @@ private slots: // ui slots void on_categoriesAndBtn_toggled(bool checked); void on_categoriesOrBtn_toggled(bool checked); void on_managedArchiveLabel_linkHovered(const QString &link); + + void showMenuBar(bool b); + void showStatusBar(bool b); }; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index bbcb734c..98743b7e 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1397,6 +1397,7 @@ p, li { white-space: pre-wrap; } + @@ -1732,6 +1733,14 @@ p, li { white-space: pre-wrap; } &Menu + + + true + + + St&atus bar + + -- cgit v1.3.1