mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 14:10:54 -04:00
Fix Preferences List using QSplitter
Make use of fusion style the default else Items aren't shown well.
This commit is contained in:
parent
10dc182cc7
commit
7a6a4e3423
4 changed files with 168 additions and 147 deletions
|
@ -70,6 +70,14 @@ SettingsPage::SettingsPage(QWidget *parent)
|
||||||
/* Initialize help browser */
|
/* Initialize help browser */
|
||||||
mHelpBrowser = new FloatingHelpBrowser(this, ui.helpButton);
|
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*/
|
/* Add own item delegate to get item width*/
|
||||||
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
||||||
itemDelegate->setSpacing(QSize(0, ITEM_SPACING));
|
itemDelegate->setSpacing(QSize(0, ITEM_SPACING));
|
||||||
|
@ -82,6 +90,8 @@ SettingsPage::SettingsPage(QWidget *parent)
|
||||||
if (geometry.isEmpty() == false) {
|
if (geometry.isEmpty() == false) {
|
||||||
restoreGeometry(geometry);
|
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(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int)));
|
||||||
connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
|
connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
|
||||||
|
@ -91,7 +101,9 @@ SettingsPage::~SettingsPage()
|
||||||
{
|
{
|
||||||
/* Save window position */
|
/* Save window position */
|
||||||
Settings->setValueToGroup("SettingDialog", "Geometry", saveGeometry());
|
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;
|
//_instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,13 +209,8 @@ void SettingsPage::addPage(ConfigPage *page)
|
||||||
{
|
{
|
||||||
ui.stackedWidget->addWidget(page) ;
|
ui.stackedWidget->addWidget(page) ;
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName(),ui.listWidget) ;
|
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName());
|
||||||
QFontMetrics fontMetrics = ui.listWidget->fontMetrics();
|
ui.listWidget->addItem(item);
|
||||||
int w = ITEM_SPACING*8;
|
|
||||||
w += ui.listWidget->iconSize().width();
|
|
||||||
w += fontMetrics.width(item->text());
|
|
||||||
if (w > ui.listWidget->maximumWidth())
|
|
||||||
ui.listWidget->setMaximumWidth(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -154,7 +154,7 @@ QString RshareSettings::getLanguageCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the preferred language code. */
|
/** Sets the preferred language code. */
|
||||||
void RshareSettings::setLanguageCode(QString languageCode)
|
void RshareSettings::setLanguageCode(const QString& languageCode)
|
||||||
{
|
{
|
||||||
setValue(SETTING_LANGUAGE, languageCode);
|
setValue(SETTING_LANGUAGE, languageCode);
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,11 @@ void RshareSettings::setLanguageCode(QString languageCode)
|
||||||
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
||||||
QString RshareSettings::getInterfaceStyle()
|
QString RshareSettings::getInterfaceStyle()
|
||||||
{
|
{
|
||||||
return value(SETTING_STYLE).toString();
|
return value(SETTING_STYLE, "fusion").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the interface style key. */
|
/** Sets the interface style key. */
|
||||||
void RshareSettings::setInterfaceStyle(QString styleKey)
|
void RshareSettings::setInterfaceStyle(const QString& styleKey)
|
||||||
{
|
{
|
||||||
setValue(SETTING_STYLE, styleKey);
|
setValue(SETTING_STYLE, styleKey);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ QString RshareSettings::getSheetName()
|
||||||
return value(SETTING_SHEETNAME).toString();
|
return value(SETTING_SHEETNAME).toString();
|
||||||
}
|
}
|
||||||
/** Sets the sheetname.*/
|
/** Sets the sheetname.*/
|
||||||
void RshareSettings::setSheetName(QString sheet)
|
void RshareSettings::setSheetName(const QString& sheet)
|
||||||
{
|
{
|
||||||
setValue(SETTING_SHEETNAME, 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);
|
QSettings command("HKEY_CURRENT_USER\\Software\\Classes\\retroshare\\shell\\open\\command", QSettings::NativeFormat);
|
||||||
command.setValue("Default", getAppPathForProtocol());
|
command.setValue("Default", getAppPathForProtocol());
|
||||||
state = command.status();
|
//state = command.status();
|
||||||
} else {
|
} else {
|
||||||
QSettings classRoot("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
QSettings classRoot("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||||
classRoot.remove("retroshare");
|
classRoot.remove("retroshare");
|
||||||
|
|
|
@ -99,15 +99,15 @@ public:
|
||||||
/** Gets the currently preferred language code for RShare. */
|
/** Gets the currently preferred language code for RShare. */
|
||||||
QString getLanguageCode();
|
QString getLanguageCode();
|
||||||
/** Saves the preferred language code. */
|
/** Saves the preferred language code. */
|
||||||
void setLanguageCode(QString languageCode);
|
void setLanguageCode(const QString& languageCode);
|
||||||
|
|
||||||
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
||||||
QString getInterfaceStyle();
|
QString getInterfaceStyle();
|
||||||
/** Sets the interface style key. */
|
/** Sets the interface style key. */
|
||||||
void setInterfaceStyle(QString styleKey);
|
void setInterfaceStyle(const QString& styleKey);
|
||||||
|
|
||||||
/** Sets the stylesheet */
|
/** Sets the stylesheet */
|
||||||
void setSheetName(QString sheet);
|
void setSheetName(const QString& sheet);
|
||||||
/** Gets the stylesheet */
|
/** Gets the stylesheet */
|
||||||
QString getSheetName();
|
QString getSheetName();
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,23 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="SettingsHLayout">
|
<layout class="QHBoxLayout" name="SettingsHLayout">
|
||||||
<item>
|
<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">
|
<widget class="QListWidget" name="listWidget">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>50</width>
|
<width>300</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -43,8 +56,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
<widget class="QFrame" name="rightFrame">
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="rightVLayout">
|
<layout class="QVBoxLayout" name="rightVLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="headerGLayout">
|
<layout class="QGridLayout" name="headerGLayout">
|
||||||
|
@ -54,7 +66,7 @@
|
||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
|
@ -152,6 +164,8 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -163,7 +177,7 @@
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue