mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
Merge pull request #2303 from PhenomRetroShare/Fix_SettingsListUsingQSplitter
Fix Preferences List using QSplitter
This commit is contained in:
commit
52da8357a9
@ -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<int> 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
|
||||
|
@ -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");
|
||||
|
@ -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();
|
||||
|
||||
|
@ -15,10 +15,23 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="SettingsHLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -43,8 +56,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="rightFrame">
|
||||
<layout class="QVBoxLayout" name="rightVLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="headerGLayout">
|
||||
@ -54,7 +66,7 @@
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
@ -152,6 +164,8 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -163,7 +177,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user