From 434b430869a81a9bf0cb534d126af3bffdf8a433 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 27 Jan 2023 18:14:50 +0100 Subject: [PATCH] replaced menu by toolbar --- RsyncUI.pro | 2 + RsyncUI.pro.user | 2 +- configuration.ui | 110 +++++++++++++++++++++++++++-------------------- mainwindow.cpp | 12 +++++- mainwindow.h | 4 +- mainwindow.ui | 79 +++++++++++++++++++++------------- 6 files changed, 130 insertions(+), 79 deletions(-) diff --git a/RsyncUI.pro b/RsyncUI.pro index 4d0a7db..1e27dc1 100644 --- a/RsyncUI.pro +++ b/RsyncUI.pro @@ -44,3 +44,5 @@ else: unix:!android: target.path = /usr/bin/ lang.path = /languages/fr_FR/ lang.files = languages/fr_FR/* INSTALLS += lang + +RESOURCES += diff --git a/RsyncUI.pro.user b/RsyncUI.pro.user index 16f02fe..e585878 100644 --- a/RsyncUI.pro.user +++ b/RsyncUI.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/configuration.ui b/configuration.ui index fd5de72..4443cf1 100644 --- a/configuration.ui +++ b/configuration.ui @@ -10,9 +10,12 @@ 0 0 400 - 127 + 163 + + Qt::DefaultContextMenu + Configuration @@ -22,14 +25,31 @@ 9 9 381 - 61 + 101 + + QLayout::SetDefaultConstraint + + + + + Toolbar view + + + + + + + Bandwidth limit + + + - Enter the bandwidth limit + Enter the bandwidth limit (0 to 1024) 5000 @@ -42,13 +62,6 @@ - - - - Bandwidth limit - - - @@ -74,17 +87,55 @@ + + + + 6 + + + 6 + + + + Icon only + + + + + Text only + + + + + Text beside icon + + + + + Text under icon + + + + + Text follow icon + + + + - 70 - 80 + 60 + 110 321 34 + + Qt::NoContextMenu + Qt::Horizontal @@ -94,38 +145,5 @@ - - - buttonBox - accepted() - Configuration - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Configuration - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/mainwindow.cpp b/mainwindow.cpp index bab0c88..755554c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,9 +1,11 @@ #include "mainwindow.h" +#include +#include using namespace std; bool display = false; -extern QDialog Configuration; +//extern QDialog Configuration; extern Ui::Configuration config; MainWindow::MainWindow(QWidget *parent) @@ -28,11 +30,13 @@ MainWindow::MainWindow(QWidget *parent) connect(&downloadO, &downloadFile::finishedSignal, this, &MainWindow::downloadFinished); connect(this, &MainWindow::stopDownloading, &downloadO, &downloadFile::cancelled); connect(config.buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted())); + connect(config.comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::on_comboBox_currentIndexChanged); // init of widgets ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget); ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive); ui->treeWidget->setHeaderLabels({tr("Type"), tr("Path"), tr("Size")} ); + config.comboBox->setCurrentIndex(ui->toolBar->toolButtonStyle()); if (this->settings.contains("connexion/lastServer")) { ui->portEdit->setText(this->settings.value("connexion/port").toString()); @@ -593,4 +597,10 @@ void MainWindow::on_buttonBox_accepted() this->settings.setValue("bandwidthlimit", this->connexion.bandwidthLimit); this->settings.setValue("bandwidthlimitunit", this->connexion.bandwidthLimitUnit.c_str()); this->settings.sync(); + Configuration.hide(); +} + +void MainWindow::on_comboBox_currentIndexChanged(int index) +{ + ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)index); } diff --git a/mainwindow.h b/mainwindow.h index 68bc8f6..fc0c3df 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -32,6 +32,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -131,8 +132,9 @@ class MainWindow : public QMainWindow void on_action_Settings_triggered(); + void on_comboBox_currentIndexChanged(int index); - public slots: +public slots: void on_buttonBox_accepted(); signals: diff --git a/mainwindow.ui b/mainwindow.ui index 95d80d3..c3b4e16 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -20,6 +20,9 @@ MainWindow + + Qt::ToolButtonTextUnderIcon + false @@ -357,39 +360,51 @@ - - - - 0 - 0 - 500 - 30 - + + + Qt::NoContextMenu - - - Menu - - - - - - - help - - - - - - + + toolBar + + + Qt::LeftToRight + + + true + + + true + + + Qt::AllToolBarAreas + + + Qt::ToolButtonTextUnderIcon + + + true + + + TopToolBarArea + + + false + + + + + - Menu + + + Change save folder @@ -397,22 +412,26 @@ Change save folder - - - Bandwidth limit - - + + + About + + + About Qt + + + Settings