replaced menu by toolbar

This commit is contained in:
Daniel Tartavel 2023-01-27 18:14:50 +01:00
parent 0648a06dbc
commit 434b430869
6 changed files with 130 additions and 79 deletions

View File

@ -44,3 +44,5 @@ else: unix:!android: target.path = /usr/bin/
lang.path = /languages/fr_FR/ lang.path = /languages/fr_FR/
lang.files = languages/fr_FR/* lang.files = languages/fr_FR/*
INSTALLS += lang INSTALLS += lang
RESOURCES +=

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-01-26T11:46:40. --> <!-- Written by QtCreator 4.14.2, 2023-01-26T22:45:50. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -10,9 +10,12 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>127</height> <height>163</height>
</rect> </rect>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Configuration</string> <string>Configuration</string>
</property> </property>
@ -22,14 +25,31 @@
<x>9</x> <x>9</x>
<y>9</y> <y>9</y>
<width>381</width> <width>381</width>
<height>61</height> <height>101</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Toolbar view</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string extracomment="Bandwidth limit">Bandwidth limit</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox"> <widget class="QSpinBox" name="spinBox">
<property name="toolTip"> <property name="toolTip">
<string>Enter the bandwidth limit</string> <string>Enter the bandwidth limit (0 to 1024)</string>
</property> </property>
<property name="toolTipDuration"> <property name="toolTipDuration">
<number>5000</number> <number>5000</number>
@ -42,13 +62,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string extracomment="Bandwidth limit">Bandwidth limit</string>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QComboBox" name="UnitCombobox"> <widget class="QComboBox" name="UnitCombobox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -74,17 +87,55 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox">
<property name="maxVisibleItems">
<number>6</number>
</property>
<property name="maxCount">
<number>6</number>
</property>
<item>
<property name="text">
<string>Icon only</string>
</property>
</item>
<item>
<property name="text">
<string>Text only</string>
</property>
</item>
<item>
<property name="text">
<string>Text beside icon</string>
</property>
</item>
<item>
<property name="text">
<string>Text under icon</string>
</property>
</item>
<item>
<property name="text">
<string>Text follow icon</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>60</x>
<y>80</y> <y>110</y>
<width>321</width> <width>321</width>
<height>34</height> <height>34</height>
</rect> </rect>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -94,38 +145,5 @@
</widget> </widget>
</widget> </widget>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Configuration</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Configuration</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View File

@ -1,9 +1,11 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QComboBox>
#include <QToolBar>
using namespace std; using namespace std;
bool display = false; bool display = false;
extern QDialog Configuration; //extern QDialog Configuration;
extern Ui::Configuration config; extern Ui::Configuration config;
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@ -28,11 +30,13 @@ MainWindow::MainWindow(QWidget *parent)
connect(&downloadO, &downloadFile::finishedSignal, this, &MainWindow::downloadFinished); connect(&downloadO, &downloadFile::finishedSignal, this, &MainWindow::downloadFinished);
connect(this, &MainWindow::stopDownloading, &downloadO, &downloadFile::cancelled); connect(this, &MainWindow::stopDownloading, &downloadO, &downloadFile::cancelled);
connect(config.buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted())); connect(config.buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
connect(config.comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &MainWindow::on_comboBox_currentIndexChanged);
// init of widgets // init of widgets
ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget); ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget);
ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive); ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive);
ui->treeWidget->setHeaderLabels({tr("Type"), tr("Path"), tr("Size")} ); ui->treeWidget->setHeaderLabels({tr("Type"), tr("Path"), tr("Size")} );
config.comboBox->setCurrentIndex(ui->toolBar->toolButtonStyle());
if (this->settings.contains("connexion/lastServer")) if (this->settings.contains("connexion/lastServer"))
{ {
ui->portEdit->setText(this->settings.value("connexion/port").toString()); 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("bandwidthlimit", this->connexion.bandwidthLimit);
this->settings.setValue("bandwidthlimitunit", this->connexion.bandwidthLimitUnit.c_str()); this->settings.setValue("bandwidthlimitunit", this->connexion.bandwidthLimitUnit.c_str());
this->settings.sync(); this->settings.sync();
Configuration.hide();
}
void MainWindow::on_comboBox_currentIndexChanged(int index)
{
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)index);
} }

View File

@ -32,6 +32,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <unistd.h> #include <unistd.h>
#include <magic.h> #include <magic.h>
#include <QComboBox>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
@ -131,8 +132,9 @@ class MainWindow : public QMainWindow
void on_action_Settings_triggered(); void on_action_Settings_triggered();
void on_comboBox_currentIndexChanged(int index);
public slots: public slots:
void on_buttonBox_accepted(); void on_buttonBox_accepted();
signals: signals:

View File

@ -20,6 +20,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="documentMode"> <property name="documentMode">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -357,39 +360,51 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QToolBar" name="toolBar">
<property name="geometry"> <property name="contextMenuPolicy">
<rect> <enum>Qt::NoContextMenu</enum>
<x>0</x>
<y>0</y>
<width>500</width>
<height>30</height>
</rect>
</property> </property>
<widget class="QMenu" name="menu"> <property name="windowTitle">
<property name="title"> <string>toolBar</string>
<string>Menu</string> </property>
</property> <property name="layoutDirection">
<addaction name="DefaultSaveFolder"/> <enum>Qt::LeftToRight</enum>
<addaction name="action_Settings"/> </property>
</widget> <property name="autoFillBackground">
<widget class="QMenu" name="menuhelp"> <bool>true</bool>
<property name="title"> </property>
<string>help</string> <property name="movable">
</property> <bool>true</bool>
<addaction name="actionAbout"/> </property>
<addaction name="actionAbout_Qt"/> <property name="allowedAreas">
</widget> <set>Qt::AllToolBarAreas</set>
<addaction name="menu"/> </property>
<addaction name="menuhelp"/> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="floatable">
<bool>true</bool>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="DefaultSaveFolder"/>
<addaction name="action_Settings"/>
<addaction name="actionAbout"/>
<addaction name="actionAbout_Qt"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionMenu"> <action name="actionMenu">
<property name="text"> <property name="text">
<string>Menu</string> <string>Menu</string>
</property> </property>
</action> </action>
<action name="DefaultSaveFolder"> <action name="DefaultSaveFolder">
<property name="icon">
<iconset theme="system-file-manager"/>
</property>
<property name="text"> <property name="text">
<string>Change save folder</string> <string>Change save folder</string>
</property> </property>
@ -397,22 +412,26 @@
<string>Change save folder</string> <string>Change save folder</string>
</property> </property>
</action> </action>
<action name="actionBandwidth_limit">
<property name="text">
<string>Bandwidth limit</string>
</property>
</action>
<action name="actionAbout"> <action name="actionAbout">
<property name="icon">
<iconset theme="help-about"/>
</property>
<property name="text"> <property name="text">
<string>About</string> <string>About</string>
</property> </property>
</action> </action>
<action name="actionAbout_Qt"> <action name="actionAbout_Qt">
<property name="icon">
<iconset theme="help-browser"/>
</property>
<property name="text"> <property name="text">
<string>About Qt</string> <string>About Qt</string>
</property> </property>
</action> </action>
<action name="action_Settings"> <action name="action_Settings">
<property name="icon">
<iconset theme="preferences-other"/>
</property>
<property name="text"> <property name="text">
<string>Settings</string> <string>Settings</string>
</property> </property>