Settings changes.

This commit is contained in:
Martin Rotter 2013-11-09 18:04:50 +01:00
parent 8274369575
commit 96438d8b5f
7 changed files with 46 additions and 13 deletions

View File

@ -77,12 +77,18 @@ void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
row_id++;
}
else {
QMargins catcher_margins = catcher->contentsMargins();
catcher_margins.setRight(10);
catcher->setContentsMargins(catcher_margins);
m_layout->addWidget(label, row_id, 0);
m_layout->addWidget(catcher, row_id, 1);
second_column = true;
}
}
// Make sure that "spacer" is added.
m_layout->setRowStretch(row_id, 1);
m_layout->setRowStretch(second_column ? ++row_id : row_id, 1);
}

View File

@ -60,7 +60,10 @@ QList<QAction*> FormMain::getActions() {
QList<QAction*> actions;
actions << m_ui->m_actionImport << m_ui->m_actionExport <<
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;
}
@ -220,5 +223,8 @@ void FormMain::showAbout() {
}
void FormMain::showSettings() {
FormSettings(this).exec();
if (FormSettings(this).exec() == QDialog::Accepted) {
// User applied new settings, reload neede components.
m_ui->m_tabWidget->checkTabBarVisibility();
}
}

View File

@ -48,7 +48,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="m_menuFile">
@ -158,6 +158,9 @@
<property name="toolTip">
<string>Add tab</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+T</string>
</property>
</action>
<action name="m_actionCloseAllTabs">
<property name="text">
@ -166,11 +169,17 @@
<property name="toolTip">
<string>Close all tabs except current one</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+O</string>
</property>
</action>
<action name="m_actionCloseCurrentTab">
<property name="text">
<string>Close current &amp;tab</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+C</string>
</property>
</action>
<action name="m_actionNoActions">
<property name="enabled">
@ -182,6 +191,9 @@
<property name="toolTip">
<string>No actions are possible at this point of time.</string>
</property>
<property name="shortcut">
<string notr="true"/>
</property>
</action>
</widget>
<customwidgets>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>829</width>
<height>414</height>
<width>910</width>
<height>445</height>
</rect>
</property>
<property name="windowTitle">
@ -147,8 +147,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>340</height>
<width>436</width>
<height>196</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">

View File

@ -45,10 +45,12 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
m_clearButton = new QToolButton(this);
m_clearButton->setIcon(IconThemeFactory::getInstance()->fromTheme("document-revert"));
m_clearButton->setFocusPolicy(Qt::NoFocus);
m_clearButton->setToolTip(tr("Reset shortcut."));
// Clear main shortcut catching button.
m_sequenceButton = new ShortcutButton(this);
m_sequenceButton->setFocusPolicy(Qt::StrongFocus);
m_sequenceButton->setToolTip(tr("Set shortcut."));
// Add both buttons to the layout.
m_layout->addWidget(m_sequenceButton);

View File

@ -27,17 +27,20 @@ void TabWidget::setupCornerButton() {
setCornerWidget(m_cornerButton);
}
void TabWidget::tabInserted(int index) {
QTabWidget::tabInserted(index);
// TODO: Opravit tento řádek, aby se korektně tabbar skrýval a objevoval atp.
tabBar()->setVisible(count() > 1 && Settings::getInstance()->value(APP_CFG_GUI,
void TabWidget::checkTabBarVisibility() {
tabBar()->setVisible(count() > 1 || !Settings::getInstance()->value(APP_CFG_GUI,
"hide_tabbar_one_tab",
true).toBool());
}
void TabWidget::tabInserted(int index) {
QTabWidget::tabInserted(index);
checkTabBarVisibility();
}
void TabWidget::tabRemoved(int index) {
QTabWidget::tabRemoved(index);
checkTabBarVisibility();
}
void TabWidget::createConnections() {

View File

@ -47,16 +47,20 @@ class TabWidget : public QTabWidget {
// Sets up properties of custom corner button.
void setupCornerButton();
// Handlers of insertin/removing of tabs.
void tabInserted(int index);
void tabRemoved(int index);
public slots:
// Fixes tabs indexes.
void fixContentAfterIndexChange(int from);
void fixContentsAfterMove(int from, int to);
// Fixes indexes of tab contents.
void fixContentsIndexes(int starting_index, int ending_index);
void checkTabBarVisibility();
// Changes icon/text of the tab.
void changeTitle(int index, const QString &new_title);
void changeIcon(int index, const QIcon &new_icon);