Settings changes.
This commit is contained in:
parent
8274369575
commit
96438d8b5f
7 changed files with 46 additions and 13 deletions
|
@ -77,12 +77,18 @@ void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
|
||||||
row_id++;
|
row_id++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
QMargins catcher_margins = catcher->contentsMargins();
|
||||||
|
catcher_margins.setRight(10);
|
||||||
|
|
||||||
|
catcher->setContentsMargins(catcher_margins);
|
||||||
|
|
||||||
m_layout->addWidget(label, row_id, 0);
|
m_layout->addWidget(label, row_id, 0);
|
||||||
m_layout->addWidget(catcher, row_id, 1);
|
m_layout->addWidget(catcher, row_id, 1);
|
||||||
|
|
||||||
second_column = true;
|
second_column = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that "spacer" is added.
|
// Make sure that "spacer" is added.
|
||||||
m_layout->setRowStretch(row_id, 1);
|
m_layout->setRowStretch(second_column ? ++row_id : row_id, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,10 @@ QList<QAction*> FormMain::getActions() {
|
||||||
QList<QAction*> actions;
|
QList<QAction*> actions;
|
||||||
actions << m_ui->m_actionImport << m_ui->m_actionExport <<
|
actions << m_ui->m_actionImport << m_ui->m_actionExport <<
|
||||||
m_ui->m_actionSettings << m_ui->m_actionQuit <<
|
m_ui->m_actionSettings << m_ui->m_actionQuit <<
|
||||||
m_ui->m_actionFullscreen << m_ui->m_actionAboutGuard;
|
m_ui->m_actionFullscreen << m_ui->m_actionAboutGuard <<
|
||||||
|
m_ui->m_actionAddBrowser << m_ui->m_actionCloseCurrentTab <<
|
||||||
|
m_ui->m_actionCloseAllTabs;
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,5 +223,8 @@ void FormMain::showAbout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::showSettings() {
|
void FormMain::showSettings() {
|
||||||
FormSettings(this).exec();
|
if (FormSettings(this).exec() == QDialog::Accepted) {
|
||||||
|
// User applied new settings, reload neede components.
|
||||||
|
m_ui->m_tabWidget->checkTabBarVisibility();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>21</height>
|
<height>19</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="m_menuFile">
|
<widget class="QMenu" name="m_menuFile">
|
||||||
|
@ -158,6 +158,9 @@
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Add tab</string>
|
<string>Add tab</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+T</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionCloseAllTabs">
|
<action name="m_actionCloseAllTabs">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -166,11 +169,17 @@
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Close all tabs except current one</string>
|
<string>Close all tabs except current one</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+O</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionCloseCurrentTab">
|
<action name="m_actionCloseCurrentTab">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close current &tab</string>
|
<string>Close current &tab</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+C</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionNoActions">
|
<action name="m_actionNoActions">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -182,6 +191,9 @@
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>No actions are possible at this point of time.</string>
|
<string>No actions are possible at this point of time.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>829</width>
|
<width>910</width>
|
||||||
<height>414</height>
|
<height>445</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -147,8 +147,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>581</width>
|
<width>436</width>
|
||||||
<height>340</height>
|
<height>196</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
|
|
@ -45,10 +45,12 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
|
||||||
m_clearButton = new QToolButton(this);
|
m_clearButton = new QToolButton(this);
|
||||||
m_clearButton->setIcon(IconThemeFactory::getInstance()->fromTheme("document-revert"));
|
m_clearButton->setIcon(IconThemeFactory::getInstance()->fromTheme("document-revert"));
|
||||||
m_clearButton->setFocusPolicy(Qt::NoFocus);
|
m_clearButton->setFocusPolicy(Qt::NoFocus);
|
||||||
|
m_clearButton->setToolTip(tr("Reset shortcut."));
|
||||||
|
|
||||||
// Clear main shortcut catching button.
|
// Clear main shortcut catching button.
|
||||||
m_sequenceButton = new ShortcutButton(this);
|
m_sequenceButton = new ShortcutButton(this);
|
||||||
m_sequenceButton->setFocusPolicy(Qt::StrongFocus);
|
m_sequenceButton->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
m_sequenceButton->setToolTip(tr("Set shortcut."));
|
||||||
|
|
||||||
// Add both buttons to the layout.
|
// Add both buttons to the layout.
|
||||||
m_layout->addWidget(m_sequenceButton);
|
m_layout->addWidget(m_sequenceButton);
|
||||||
|
|
|
@ -27,17 +27,20 @@ void TabWidget::setupCornerButton() {
|
||||||
setCornerWidget(m_cornerButton);
|
setCornerWidget(m_cornerButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::tabInserted(int index) {
|
void TabWidget::checkTabBarVisibility() {
|
||||||
QTabWidget::tabInserted(index);
|
tabBar()->setVisible(count() > 1 || !Settings::getInstance()->value(APP_CFG_GUI,
|
||||||
|
|
||||||
// TODO: Opravit tento řádek, aby se korektně tabbar skrýval a objevoval atp.
|
|
||||||
tabBar()->setVisible(count() > 1 && Settings::getInstance()->value(APP_CFG_GUI,
|
|
||||||
"hide_tabbar_one_tab",
|
"hide_tabbar_one_tab",
|
||||||
true).toBool());
|
true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabWidget::tabInserted(int index) {
|
||||||
|
QTabWidget::tabInserted(index);
|
||||||
|
checkTabBarVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
void TabWidget::tabRemoved(int index) {
|
void TabWidget::tabRemoved(int index) {
|
||||||
QTabWidget::tabRemoved(index);
|
QTabWidget::tabRemoved(index);
|
||||||
|
checkTabBarVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::createConnections() {
|
void TabWidget::createConnections() {
|
||||||
|
|
|
@ -47,16 +47,20 @@ class TabWidget : public QTabWidget {
|
||||||
// Sets up properties of custom corner button.
|
// Sets up properties of custom corner button.
|
||||||
void setupCornerButton();
|
void setupCornerButton();
|
||||||
|
|
||||||
|
// Handlers of insertin/removing of tabs.
|
||||||
void tabInserted(int index);
|
void tabInserted(int index);
|
||||||
void tabRemoved(int index);
|
void tabRemoved(int index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
// Fixes tabs indexes.
|
||||||
void fixContentAfterIndexChange(int from);
|
void fixContentAfterIndexChange(int from);
|
||||||
void fixContentsAfterMove(int from, int to);
|
void fixContentsAfterMove(int from, int to);
|
||||||
|
|
||||||
// Fixes indexes of tab contents.
|
// Fixes indexes of tab contents.
|
||||||
void fixContentsIndexes(int starting_index, int ending_index);
|
void fixContentsIndexes(int starting_index, int ending_index);
|
||||||
|
|
||||||
|
void checkTabBarVisibility();
|
||||||
|
|
||||||
// Changes icon/text of the tab.
|
// Changes icon/text of the tab.
|
||||||
void changeTitle(int index, const QString &new_title);
|
void changeTitle(int index, const QString &new_title);
|
||||||
void changeIcon(int index, const QIcon &new_icon);
|
void changeIcon(int index, const QIcon &new_icon);
|
||||||
|
|
Loading…
Add table
Reference in a new issue