mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Improve the size policy (toolbars and improved icons) (#1684)
* Improve the size policy (and more and better icons) These changes improve the size policy for translations having long texts in some buttons by: * Converting the text buttons in the Edit Database Cell to icons * Making the "Type of data" label wrappable and expandable * Converting the text buttons in the Browse Data tab to icons * Allowing the Plot combo-boxes to shrunk All this allows both the Browse Data and the docks to grow and shrink with more freedom. New icons for buttons are reused when appropriate in context menus. Added icon for filter and improve icon for docks (has been mirrored so it matches the actual dock position). Added Print icon in Edit Database Cell using the extra free space, so the print action there is more visible. This continues the effort started in #1324. * Convert the embedded buttons to actual toolbars This provides more flexibility, like the way how toolbars are compacted when they have not enough space. The QToolButtons in Browse Data tab and in Edit Cell dialog are converted to QActions and inserted in new toolbars embedded in the same place as the old buttons. Everything else should stay the same (shortcuts, tool-tips and what's-this information). * Set style for all toolbars in Preferences and minor adjustments The combo-box used for the main toolbar is replicated for all the toolbars in application. In this way, users with high resolutions can use the styles with both icons and text, while users with lower resolutions can leave the default styles, which should be better for them. Some icon texts has been abbreviated from their default values, so they fit better in the toolbars when they are visible. The print icon in Edit Cell has been moved to the right, where it would be the first to be collapsed. The original what's-this info for Set as NULL in Edit Cell toolbar has been restored. * Remove no longer used overloaded function The addShortcutsTooltip function applying to QWidget was no longer used after having converted all the buttons to actions, so it is removed.
This commit is contained in:
@@ -147,12 +147,6 @@ static QString shortcutsTip(const QList<QKeySequence>& keys)
|
||||
return tip;
|
||||
}
|
||||
|
||||
static void addShortcutsTooltip(QWidget* widget, const QList<QKeySequence>& keys)
|
||||
{
|
||||
if (!keys.isEmpty())
|
||||
widget->setToolTip(widget->toolTip() + shortcutsTip(keys));
|
||||
}
|
||||
|
||||
static void addShortcutsTooltip(QAction* action, const QList<QKeySequence>& extraKeys = QList<QKeySequence>())
|
||||
{
|
||||
if (!action->shortcuts().isEmpty() || !extraKeys.isEmpty())
|
||||
@@ -278,7 +272,7 @@ void MainWindow::init()
|
||||
popupNewRecordMenu = new QMenu(this);
|
||||
popupNewRecordMenu->addAction(ui->newRecordAction);
|
||||
popupNewRecordMenu->addAction(ui->insertValuesAction);
|
||||
ui->buttonNewRecord->setMenu(popupNewRecordMenu);
|
||||
ui->actionNewRecord->setMenu(popupNewRecordMenu);
|
||||
|
||||
popupSaveSqlFileMenu = new QMenu(this);
|
||||
popupSaveSqlFileMenu->addAction(ui->actionSqlSaveFile);
|
||||
@@ -294,8 +288,8 @@ void MainWindow::init()
|
||||
popupSaveFilterAsMenu = new QMenu(this);
|
||||
popupSaveFilterAsMenu->addAction(ui->actionFilteredTableExportCsv);
|
||||
popupSaveFilterAsMenu->addAction(ui->actionFilterSaveAsView);
|
||||
ui->buttonSaveFilterAsPopup->setMenu(popupSaveFilterAsMenu);
|
||||
ui->buttonSaveFilterAsPopup->setPopupMode(QToolButton::InstantPopup);
|
||||
ui->actionSaveFilterAsPopup->setMenu(popupSaveFilterAsMenu);
|
||||
qobject_cast<QToolButton*>(ui->browseToolbar->widgetForAction(ui->actionSaveFilterAsPopup))->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
popupBrowseDataHeaderMenu = new QMenu(this);
|
||||
popupBrowseDataHeaderMenu->addAction(ui->actionShowRowidColumn);
|
||||
@@ -510,8 +504,8 @@ void MainWindow::init()
|
||||
|
||||
addShortcutsTooltip(ui->actionDbPrint);
|
||||
|
||||
addShortcutsTooltip(ui->buttonRefresh, {shortcutBrowseRefreshF5->key(), shortcutBrowseRefreshCtrlR->key()});
|
||||
addShortcutsTooltip(ui->buttonPrintTable, {shortcutPrint->key()});
|
||||
addShortcutsTooltip(ui->actionRefresh, {shortcutBrowseRefreshCtrlR->key()});
|
||||
addShortcutsTooltip(ui->actionPrintTable);
|
||||
|
||||
addShortcutsTooltip(ui->actionSqlOpenTab);
|
||||
addShortcutsTooltip(ui->actionSqlPrint);
|
||||
@@ -1974,8 +1968,8 @@ void MainWindow::activateFields(bool enable)
|
||||
ui->buttonBoxPragmas->setEnabled(enable && write);
|
||||
ui->buttonGoto->setEnabled(enable);
|
||||
ui->editGoto->setEnabled(enable);
|
||||
ui->buttonRefresh->setEnabled(enable);
|
||||
ui->buttonPrintTable->setEnabled(enable);
|
||||
ui->actionRefresh->setEnabled(enable);
|
||||
ui->actionPrintTable->setEnabled(enable);
|
||||
ui->actionExecuteSql->setEnabled(enable);
|
||||
ui->actionLoadExtension->setEnabled(enable);
|
||||
ui->actionSqlExecuteLine->setEnabled(enable);
|
||||
@@ -1987,8 +1981,8 @@ void MainWindow::activateFields(bool enable)
|
||||
ui->actionQuickCheck->setEnabled(enable);
|
||||
ui->actionForeignKeyCheck->setEnabled(enable);
|
||||
ui->actionOptimize->setEnabled(enable);
|
||||
ui->buttonClearFilters->setEnabled(enable);
|
||||
ui->buttonSaveFilterAsPopup->setEnabled(enable);
|
||||
ui->actionClearFilters->setEnabled(enable);
|
||||
ui->actionSaveFilterAsPopup->setEnabled(enable);
|
||||
ui->dockEdit->setEnabled(enable);
|
||||
ui->dockPlot->setEnabled(enable);
|
||||
|
||||
@@ -2369,6 +2363,9 @@ void MainWindow::reloadSettings()
|
||||
ui->dataTable->reloadSettings();
|
||||
|
||||
setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyle").toInt()));
|
||||
ui->dbToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleStructure").toInt()));
|
||||
ui->browseToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleBrowse").toInt()));
|
||||
ui->toolbarSql->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleSql").toInt()));
|
||||
|
||||
// Set prefetch sizes for lazy population of table models
|
||||
m_browseTableModel->setChunkSize(Settings::getValue("db", "prefetchsize").toInt());
|
||||
@@ -3235,7 +3232,7 @@ void MainWindow::switchToBrowseDataTab(QString tableToBrowse)
|
||||
ui->mainTab->setCurrentWidget(ui->browser);
|
||||
}
|
||||
|
||||
void MainWindow::on_buttonClearFilters_clicked()
|
||||
void MainWindow::on_actionClearFilters_triggered()
|
||||
{
|
||||
ui->dataTable->filterHeader()->clearFilters();
|
||||
}
|
||||
@@ -3327,7 +3324,7 @@ void MainWindow::showRecordPopupMenu(const QPoint& pos)
|
||||
}
|
||||
});
|
||||
|
||||
QAction* deleteRecordAction = new QAction(ui->buttonDeleteRecord->text(), &popupRecordMenu);
|
||||
QAction* deleteRecordAction = new QAction(QIcon(":icons/delete_record"), ui->actionDeleteRecord->text(), &popupRecordMenu);
|
||||
popupRecordMenu.addAction(deleteRecordAction);
|
||||
|
||||
connect(deleteRecordAction, &QAction::triggered, [&]() {
|
||||
@@ -3722,13 +3719,13 @@ void MainWindow::updateInsertDeleteRecordButton()
|
||||
// at least one row to be selected. For the insert button there is an extra rule to disable it when we are browsing a view because inserting
|
||||
// into a view isn't supported yet.
|
||||
bool isEditable = m_browseTableModel->isEditable() && !db.readOnly();
|
||||
ui->buttonNewRecord->setEnabled(isEditable && !m_browseTableModel->hasPseudoPk());
|
||||
ui->buttonDeleteRecord->setEnabled(isEditable && rows != 0);
|
||||
ui->actionNewRecord->setEnabled(isEditable && !m_browseTableModel->hasPseudoPk());
|
||||
ui->actionDeleteRecord->setEnabled(isEditable && rows != 0);
|
||||
|
||||
if(rows > 1)
|
||||
ui->buttonDeleteRecord->setText(tr("Delete Records"));
|
||||
ui->actionDeleteRecord->setText(tr("Delete Records"));
|
||||
else
|
||||
ui->buttonDeleteRecord->setText(tr("Delete Record"));
|
||||
ui->actionDeleteRecord->setText(tr("Delete Record"));
|
||||
}
|
||||
|
||||
void MainWindow::runSqlNewTab(const QString& query, const QString& title)
|
||||
|
||||
Reference in New Issue
Block a user