diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index ac064397d..6d3f10bbc 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -70,6 +70,14 @@ SettingsPage::SettingsPage(QWidget *parent) /* Initialize help browser */ mHelpBrowser = new FloatingHelpBrowser(this, ui.helpButton); + /* set initial size the splitter */ + ui.splitter->setStretchFactor(0, 0); + ui.splitter->setStretchFactor(1, 1); + + QList sizes; + sizes << 200 << width(); // Qt calculates the right sizes + ui.splitter->setSizes(sizes); + /* Add own item delegate to get item width*/ RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this); itemDelegate->setSpacing(QSize(0, ITEM_SPACING)); @@ -82,6 +90,8 @@ SettingsPage::SettingsPage(QWidget *parent) if (geometry.isEmpty() == false) { restoreGeometry(geometry); } + // state of splitter + ui.splitter->restoreState(Settings->valueFromGroup("SettingDialog", "Splitter", QByteArray()).toByteArray()); connect(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int))); connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int))); @@ -91,7 +101,9 @@ SettingsPage::~SettingsPage() { /* Save window position */ Settings->setValueToGroup("SettingDialog", "Geometry", saveGeometry()); - lastPage = ui.stackedWidget->currentIndex (); + // state of splitter + Settings->setValueToGroup("SettingDialog", "Splitter", ui.splitter->saveState()); + //lastPage = ui.stackedWidget->currentIndex (); //_instance = NULL; } @@ -197,13 +209,8 @@ void SettingsPage::addPage(ConfigPage *page) { ui.stackedWidget->addWidget(page) ; - QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName(),ui.listWidget) ; - QFontMetrics fontMetrics = ui.listWidget->fontMetrics(); - int w = ITEM_SPACING*8; - w += ui.listWidget->iconSize().width(); - w += fontMetrics.width(item->text()); - if (w > ui.listWidget->maximumWidth()) - ui.listWidget->setMaximumWidth(w); + QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()); + ui.listWidget->addItem(item); } void diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index ce52b16cc..86a93559e 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -154,7 +154,7 @@ QString RshareSettings::getLanguageCode() } /** Sets the preferred language code. */ -void RshareSettings::setLanguageCode(QString languageCode) +void RshareSettings::setLanguageCode(const QString& languageCode) { setValue(SETTING_LANGUAGE, languageCode); } @@ -162,11 +162,11 @@ void RshareSettings::setLanguageCode(QString languageCode) /** Gets the interface style key (e.g., "windows", "motif", etc.) */ QString RshareSettings::getInterfaceStyle() { - return value(SETTING_STYLE).toString(); + return value(SETTING_STYLE, "fusion").toString(); } /** Sets the interface style key. */ -void RshareSettings::setInterfaceStyle(QString styleKey) +void RshareSettings::setInterfaceStyle(const QString& styleKey) { setValue(SETTING_STYLE, styleKey); } @@ -177,7 +177,7 @@ QString RshareSettings::getSheetName() return value(SETTING_SHEETNAME).toString(); } /** Sets the sheetname.*/ -void RshareSettings::setSheetName(QString sheet) +void RshareSettings::setSheetName(const QString& sheet) { setValue(SETTING_SHEETNAME, sheet); } @@ -865,7 +865,7 @@ bool RshareSettings::setRetroShareProtocol(bool value, QString &error) QSettings command("HKEY_CURRENT_USER\\Software\\Classes\\retroshare\\shell\\open\\command", QSettings::NativeFormat); command.setValue("Default", getAppPathForProtocol()); - state = command.status(); + //state = command.status(); } else { QSettings classRoot("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat); classRoot.remove("retroshare"); diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index fe35209ab..abf728391 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -99,15 +99,15 @@ public: /** Gets the currently preferred language code for RShare. */ QString getLanguageCode(); /** Saves the preferred language code. */ - void setLanguageCode(QString languageCode); + void setLanguageCode(const QString& languageCode); /** Gets the interface style key (e.g., "windows", "motif", etc.) */ QString getInterfaceStyle(); /** Sets the interface style key. */ - void setInterfaceStyle(QString styleKey); + void setInterfaceStyle(const QString& styleKey); /** Sets the stylesheet */ - void setSheetName(QString sheet); + void setSheetName(const QString& sheet); /** Gets the stylesheet */ QString getSheetName(); diff --git a/retroshare-gui/src/gui/settings/settingsw.ui b/retroshare-gui/src/gui/settings/settingsw.ui index 3fcfa50a8..fa6f197db 100644 --- a/retroshare-gui/src/gui/settings/settingsw.ui +++ b/retroshare-gui/src/gui/settings/settingsw.ui @@ -15,143 +15,157 @@ - - - - 50 - 16777215 - + + + + 0 + 0 + - - - 11 - + + Qt::Horizontal - - Qt::IgnoreAction + + false - - - 24 - 24 - - - - Qt::ElideRight - - - true - - - - - - - - - - - Qt::NoFocus - - - - :/icons/help_64.png:/icons/help_64.png - - - true - - - true - - - - - - - - 24 - 24 - - - - true - - - - - - - - 0 - 0 - - - - - 75 - true - - - - - - - - - - - Qt::Horizontal - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - - - 0 - 0 - 1313 - 849 - - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 0 + + + + 300 + 16777215 + + + + + 11 + + + + Qt::IgnoreAction + + + + 24 + 24 + + + + Qt::ElideRight + + + true + + + + + + + + + + Qt::NoFocus + + + + :/icons/help_64.png:/icons/help_64.png + + + true + + + true + + + + + + + + 24 + 24 + + + + true + + + + + + + + 0 + 0 + + + + + 75 + true + + + + + + + + + + + Qt::Horizontal - - - - - + + + + + QFrame::NoFrame + + + QFrame::Plain + + + true + + + + + 0 + 0 + 1313 + 849 + + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + 0 + + + + + + + + + + + @@ -163,7 +177,7 @@ - +