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.files = languages/fr_FR/*
INSTALLS += lang
RESOURCES +=

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<data>
<variable>EnvironmentId</variable>

View File

@ -10,9 +10,12 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>127</height>
<height>163</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="windowTitle">
<string>Configuration</string>
</property>
@ -22,14 +25,31 @@
<x>9</x>
<y>9</y>
<width>381</width>
<height>61</height>
<height>101</height>
</rect>
</property>
<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">
<widget class="QSpinBox" name="spinBox">
<property name="toolTip">
<string>Enter the bandwidth limit</string>
<string>Enter the bandwidth limit (0 to 1024)</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
@ -42,13 +62,6 @@
</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="2">
<widget class="QComboBox" name="UnitCombobox">
<property name="sizePolicy">
@ -74,17 +87,55 @@
</property>
</widget>
</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>
</widget>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>70</x>
<y>80</y>
<x>60</x>
<y>110</y>
<width>321</width>
<height>34</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -94,38 +145,5 @@
</widget>
</widget>
<resources/>
<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>
<connections/>
</ui>

View File

@ -1,9 +1,11 @@
#include "mainwindow.h"
#include <QComboBox>
#include <QToolBar>
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<int>::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);
}

View File

@ -32,6 +32,7 @@
#include <QCloseEvent>
#include <unistd.h>
#include <magic.h>
#include <QComboBox>
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:

View File

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