New toolbars, new action icons and toolbar style preference

Two new application toolbars: Extra DB (attach, close database) and Project
(Open, Save). Can be disabled and moved as usual.

Icons for Close Database and Attach Database actions, which lacked ones.

Different icon for the dock configuration, so they are visually
distinguishable from the toolbar configurations.

New preference for the toolbar style, with default value: text besides icon
as before. But in order for the style to change, the value in UI must be
ToolButtonIconOnly.

Needed new icons from famfamfam.com's Silk collection.

See related issue #331
This commit is contained in:
mgrojo
2017-12-04 22:49:06 +01:00
parent 5707b3139f
commit 8fbf44bffe
8 changed files with 248 additions and 9 deletions

View File

@@ -199,7 +199,6 @@ void MainWindow::init()
ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockLog->toggleViewAction());
ui->viewMenu->actions().at(0)->setShortcut(QKeySequence(tr("Ctrl+L")));
ui->viewMenu->actions().at(0)->setIcon(QIcon(":/icons/log_dock"));
ui->viewDBToolbarAction->setChecked(!ui->toolbarDB->isHidden());
// Add menu item for plot dock
ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockPlot->toggleViewAction());
@@ -222,6 +221,14 @@ void MainWindow::init()
ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockRemote->toggleViewAction());
ui->viewMenu->actions().at(4)->setIcon(QIcon(":/icons/log_dock"));
// Set checked state if toolbar is visible
ui->viewDBToolbarAction->setChecked(!ui->toolbarDB->isHidden());
ui->viewExtraDBToolbarAction->setChecked(!ui->toolbarExtraDB->isHidden());
ui->viewProjectToolbarAction->setChecked(!ui->toolbarProject->isHidden());
// Add separator between docks and toolbars
ui->viewMenu->insertSeparator(ui->viewDBToolbarAction);
// If we're not compiling in SQLCipher, hide its FAQ link in the help menu
#ifndef ENABLE_SQLCIPHER
ui->actionSqlCipherFaq->setVisible(false);
@@ -1903,6 +1910,8 @@ void MainWindow::reloadSettings()
// Set data browser font
ui->dataTable->reloadSettings();
setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyle").toInt()));
// Set prefetch sizes for lazy population of table models
m_browseTableModel->setChunkSize(Settings::getValue("db", "prefetchsize").toInt());
for(int i=0;i<ui->tabSqlAreas->count();++i)

View File

@@ -914,8 +914,6 @@
<addaction name="menuImport"/>
<addaction name="menuExport"/>
<addaction name="separator"/>
<addaction name="actionOpenProject"/>
<addaction name="actionSaveProject"/>
<addaction name="separator"/>
<addaction name="fileExitAction"/>
</widget>
@@ -934,6 +932,8 @@
<string>&amp;View</string>
</property>
<addaction name="viewDBToolbarAction"/>
<addaction name="viewExtraDBToolbarAction"/>
<addaction name="viewProjectToolbarAction"/>
<addaction name="separator"/>
<addaction name="viewPreferencesAction"/>
</widget>
@@ -959,7 +959,7 @@
<string>DB Toolbar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
@@ -1140,6 +1140,44 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents_5"/>
</widget>
<widget class="QToolBar" name="toolbarProject">
<property name="windowTitle">
<string>Project Toolbar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionOpenProject"/>
<addaction name="actionSaveProject"/>
</widget>
<widget class="QToolBar" name="toolbarExtraDB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>Extra DB toolbar</string>
</property>
<property name="toolTip">
<string>Close the current database file</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="fileAttachAction"/>
<addaction name="fileCloseAction"/>
</widget>
<action name="fileNewAction">
<property name="icon">
<iconset resource="icons/icons.qrc">
@@ -1192,6 +1230,10 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
</property>
<property name="text">
<string>&amp;Close Database</string>
</property>
@@ -1433,7 +1475,7 @@
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/log_dock</normaloff>:/icons/log_dock</iconset>
<normaloff>:/icons/toolbar</normaloff>:/icons/toolbar</iconset>
</property>
<property name="text">
<string>&amp;DB Toolbar</string>
@@ -1635,9 +1677,16 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_attach</normaloff>:/icons/db_attach</iconset>
</property>
<property name="text">
<string>&amp;Attach Database</string>
</property>
<property name="toolTip">
<string>Add another database file to the current database connection</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
@@ -1871,6 +1920,39 @@
<string>Show all columns that were hidden</string>
</property>
</action>
<action name="viewProjectToolbarAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/toolbar</normaloff>:/icons/toolbar</iconset>
</property>
<property name="text">
<string>Project Toolbar</string>
</property>
<property name="whatsThis">
<string>Shows or hides the Project toolbar.</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="viewExtraDBToolbarAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/toolbar</normaloff>:/icons/toolbar</iconset>
</property>
<property name="text">
<string>Extra DB Toolbar</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
@@ -3051,6 +3133,86 @@
</hint>
</hints>
</connection>
<connection>
<sender>viewProjectToolbarAction</sender>
<signal>toggled(bool)</signal>
<receiver>toolbarProject</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>887</x>
<y>44</y>
</hint>
</hints>
</connection>
<connection>
<sender>viewExtraDBToolbarAction</sender>
<signal>toggled(bool)</signal>
<receiver>toolbarExtraDB</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>737</x>
<y>44</y>
</hint>
</hints>
</connection>
<connection>
<sender>MainWindow</sender>
<signal>toolButtonStyleChanged(Qt::ToolButtonStyle)</signal>
<receiver>toolbarDB</receiver>
<slot>setToolButtonStyle(Qt::ToolButtonStyle)</slot>
<hints>
<hint type="sourcelabel">
<x>518</x>
<y>314</y>
</hint>
<hint type="destinationlabel">
<x>296</x>
<y>44</y>
</hint>
</hints>
</connection>
<connection>
<sender>MainWindow</sender>
<signal>toolButtonStyleChanged(Qt::ToolButtonStyle)</signal>
<receiver>toolbarExtraDB</receiver>
<slot>setToolButtonStyle(Qt::ToolButtonStyle)</slot>
<hints>
<hint type="sourcelabel">
<x>518</x>
<y>314</y>
</hint>
<hint type="destinationlabel">
<x>737</x>
<y>44</y>
</hint>
</hints>
</connection>
<connection>
<sender>MainWindow</sender>
<signal>toolButtonStyleChanged(Qt::ToolButtonStyle)</signal>
<receiver>toolbarProject</receiver>
<slot>setToolButtonStyle(Qt::ToolButtonStyle)</slot>
<hints>
<hint type="sourcelabel">
<x>518</x>
<y>314</y>
</hint>
<hint type="destinationlabel">
<x>959</x>
<y>44</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>fileOpen()</slot>

View File

@@ -169,6 +169,7 @@ void PreferencesDialog::loadSettings()
ui->listExtensions->addItems(Settings::getValue("extensions", "list").toStringList());
ui->checkRegexDisabled->setChecked(Settings::getValue("extensions", "disableregex").toBool());
fillLanguageBox();
ui->toolbarStyleComboBox->setCurrentIndex(Settings::getValue("General", "toolbarStyle").toInt());
}
void PreferencesDialog::saveSettings()
@@ -271,6 +272,7 @@ void PreferencesDialog::saveSettings()
tr("The language will change after you restart the application."));
Settings::setValue("General", "language", newLanguage);
Settings::setValue("General", "toolbarStyle", ui->toolbarStyleComboBox->currentIndex());
accept();
}

View File

@@ -123,13 +123,73 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelToolbarStyle">
<property name="text">
<string>Toolbar style</string>
</property>
<property name="buddy">
<cstring>languageComboBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="toolbarStyleComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="minimumContentsLength">
<number>35</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
<item>
<property name="text">
<string>Only display the icon</string>
</property>
</item>
<item>
<property name="text">
<string>Only display the text</string>
</property>
</item>
<item>
<property name="text">
<string>The text appears beside the icon</string>
</property>
</item>
<item>
<property name="text">
<string>The text appears under the icon</string>
</property>
</item>
<item>
<property name="text">
<string>Follow the style</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelUseRemotes">
<property name="text">
<string>Show remote options</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="checkUseRemotes">
<property name="text">
<string>enabled</string>
@@ -139,7 +199,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="labelUpdates">
<property name="text">
<string>Automatic &amp;updates</string>
@@ -149,7 +209,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QCheckBox" name="checkUpdates">
<property name="text">
<string>enabled</string>

View File

@@ -148,6 +148,10 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name)
if(group == "General" && name == "language")
return QLocale::system().name();
// General/toolbarStyle
if(group == "General" && name == "toolbarStyle")
return static_cast<int>(Qt::ToolButtonTextBesideIcon);
// checkversion group?
if(group == "checkversion")
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

BIN
src/icons/database_link.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

View File

@@ -32,7 +32,7 @@
<file alias="remove_extension">plugin_delete.png</file>
<file alias="save_table">table_save.png</file>
<file alias="run_line">resultset_last.png</file>
<file alias="log_dock">layout_sidebar.png</file>
<file alias="toolbar">layout_sidebar.png</file>
<file alias="down">bullet_arrow_down.png</file>
<file alias="up">bullet_arrow_up.png</file>
<file alias="appicon">sqlitebrowser.png</file>
@@ -62,5 +62,7 @@
<file alias="special_copy">page_white_copy.png</file>
<file alias="text_replace">text_replace.png</file>
<file alias="image_save">picture_save.png</file>
<file alias="log_dock">application_side_list.png</file>
<file alias="db_attach">database_link.png</file>
</qresource>
</RCC>