Browse Source

Set parent object for advancedsettings

Remove borders
Resize column size correctly
adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
a8b394752e
  1. 17
      src/gui/advancedsettings.cpp
  2. 2
      src/gui/advancedsettings.h
  3. 54
      src/gui/options.ui
  4. 8
      src/gui/options_imp.cpp

17
src/gui/advancedsettings.cpp

@ -72,21 +72,22 @@ enum AdvSettingsRows
AdvancedSettings::AdvancedSettings(QWidget *parent) AdvancedSettings::AdvancedSettings(QWidget *parent)
: QTableWidget(parent) : QTableWidget(parent)
{ {
// Set visual appearance // column
setEditTriggers(QAbstractItemView::NoEditTriggers);
setAlternatingRowColors(true);
setColumnCount(2); setColumnCount(2);
QStringList header; QStringList header = { tr("Setting"), tr("Value", "Value set for this setting") };
header << tr("Setting") << tr("Value", "Value set for this setting");
setHorizontalHeaderLabels(header); setHorizontalHeaderLabels(header);
setColumnWidth(0, width() / 2); // row
horizontalHeader()->setStretchLastSection(true);
verticalHeader()->setVisible(false);
setRowCount(ROW_COUNT); setRowCount(ROW_COUNT);
verticalHeader()->setVisible(false);
// etc.
setAlternatingRowColors(true);
setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals // Signals
connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int))); connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int)));
// Load settings // Load settings
loadAdvancedSettings(); loadAdvancedSettings();
resizeColumnToContents(0);
horizontalHeader()->setStretchLastSection(true);
} }
void AdvancedSettings::saveAdvancedSettings() void AdvancedSettings::saveAdvancedSettings()

2
src/gui/advancedsettings.h

@ -41,7 +41,7 @@ class AdvancedSettings: public QTableWidget
Q_OBJECT Q_OBJECT
public: public:
AdvancedSettings(QWidget *parent = 0); AdvancedSettings(QWidget *parent);
public slots: public slots:
void saveAdvancedSettings(); void saveAdvancedSettings();

54
src/gui/options.ui

@ -162,8 +162,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>454</width> <width>480</width>
<height>610</height> <height>672</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
@ -520,8 +520,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>454</width> <width>487</width>
<height>942</height> <height>1040</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -1033,8 +1033,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>361</width> <width>450</width>
<height>586</height> <height>658</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -1563,8 +1563,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>275</width> <width>376</width>
<height>401</height> <height>444</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -1947,8 +1947,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>440</width> <width>555</width>
<height>481</height> <height>527</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
@ -2341,8 +2341,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>332</width> <width>419</width>
<height>480</height> <height>537</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2707,31 +2707,7 @@
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabAdvancedPage"> <widget class="QWidget" name="tabAdvancedPage">
<layout class="QVBoxLayout" name="verticalLayout_35"> <layout class="QVBoxLayout" name="advPageLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_advanced">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_10">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -2747,10 +2723,6 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item>
</layout>
</widget>
</widget>
</widget> </widget>
</item> </item>
<item> <item>

8
src/gui/options_imp.cpp

@ -279,10 +279,8 @@ options_imp::options_imp(QWidget *parent)
// Tab selection mechanism // Tab selection mechanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*))); connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
// Load Advanced settings // Load Advanced settings
QVBoxLayout *adv_layout = new QVBoxLayout(); advancedSettings = new AdvancedSettings(tabAdvancedPage);
advancedSettings = new AdvancedSettings(); advPageLayout->addWidget(advancedSettings);
adv_layout->addWidget(advancedSettings);
scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton())); connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
// Adapt size // Adapt size
@ -312,8 +310,6 @@ options_imp::~options_imp()
foreach (const QString &path, addedScanDirs) foreach (const QString &path, addedScanDirs)
ScanFoldersModel::instance()->removePath(path); ScanFoldersModel::instance()->removePath(path);
ScanFoldersModel::instance()->configure(); // reloads "removed" paths ScanFoldersModel::instance()->configure(); // reloads "removed" paths
delete scrollArea_advanced->layout();
delete advancedSettings;
} }
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous)

Loading…
Cancel
Save