Added new fixes from Phenom (AddFrameListeInsteadOfToolBar_v0.6_7360.patch)

Add an option for List item icon size.                          
Save state for List Item and Option window.                     
Make ListItem linked with Function pointer instead of SLOT char.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7361 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-10 18:05:18 +00:00
parent bcff888eb7
commit 995d63c979
10 changed files with 561 additions and 399 deletions

View File

@ -235,6 +235,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
//ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
setNewPage(Settings->getLastPageInMainWindow());
/* Load listWidget postion */
QByteArray geometry = Settings->valueFromGroup("MainWindow", "SplitterState", QByteArray()).toByteArray();
if (geometry.isEmpty() == false) {
ui->splitter->restoreState(geometry);
}
/** StatusBar section ********/
/* initialize combobox in status bar */
@ -304,6 +309,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
MainWindow::~MainWindow()
{
Settings->setLastPageInMainWindow(ui->stackPages->currentIndex());
/* Save listWidget position */
Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState());
delete peerstatus;
delete natstatus;
@ -463,15 +470,16 @@ void MainWindow::initStackedPage()
#ifdef UNFINISHED
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow()));
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), &MainWindow::showApplWindow, SLOT(showApplWindow()));
ui->toolBarAction->addSeparator();
notify += applicationWindow->getNotify();
#endif
addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), SLOT(addFriend()));
addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), SLOT(showabout()));
addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), SLOT(doQuit()));
/** Add icon on Action bar */
addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), &MainWindow::addFriend, SLOT(addFriend()));
addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), &MainWindow::showSettings, SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout()));
addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit()));
QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > >::iterator notifyIt;
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
@ -498,19 +506,22 @@ QAction *MainWindow::createPageAction(const QIcon &icon, const QString &text, QA
}
/** Adds the given action to the toolbar and hooks its triggered() signal to
* the specified slot (if given). */
void MainWindow::addAction(QAction *action, const char *slot)
* the specified slot (if given).
* Have to pass function pointer and slot, because we can't make slot of function pointer */
void MainWindow::addAction(QAction *action, FunctionType actionFunction, const char *slot)
{
QFont font;
font = action->font();
font.setPointSize(9);
action->setFont(font);
ui->toolBarAction->addAction(action);
connect(action, SIGNAL(triggered()), this, slot);
if (slot) connect(action, SIGNAL(triggered()), this, slot);
QListWidgetItem *item = new QListWidgetItem(action->icon(),action->text()) ;
item->setData(Qt::UserRole,QString(slot));
ui->listWidget->addItem(item) ;
if (slot) _functionList[slot] = actionFunction;
}
/** Add the given page to the stackPage and list. */
@ -540,12 +551,9 @@ void MainWindow::setNewPage(int page)
ui->listWidget->setCurrentRow(page);
} else {
QString procName = ui->listWidget->item(page)->data(Qt::UserRole).toString();
#ifdef UNFINISHED
if (procName == SLOT(showApplWindow())) showApplWindow();
#endif
if (procName == SLOT(showSettings())) showSettings();
if (procName == SLOT(showabout())) showabout();
if (procName == SLOT(doQuit())) doQuit();
FunctionType function = _functionList[procName];
if (function) (this->*function)();
ui->listWidget->setCurrentRow(ui->stackPages->currentIndex());
}
}
@ -1404,11 +1412,13 @@ void MainWindow::settingsChanged()
ui->listWidget->item(i)->setHidden(Settings->getActionButtonLoc());
}
}
int size = Settings->getToolButtonSize();
int toolSize = Settings->getToolButtonSize();
ui->toolBarPage->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBarPage->setIconSize(QSize(size,size));
ui->toolBarPage->setIconSize(QSize(toolSize,toolSize));
ui->toolBarAction->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBarAction->setIconSize(QSize(size,size));
ui->toolBarAction->setIconSize(QSize(toolSize,toolSize));
int itemSize = Settings->getListItemIconSize();
ui->listWidget->setIconSize(QSize(itemSize,itemSize));
}
void MainWindow::externalLinkActivated(const QUrl &url)

View File

@ -232,10 +232,13 @@ private:
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
BandwidthGraph* _bandwidthGraph;
typedef void (MainWindow::*FunctionType)();
/** Creates a new action for a Main page. */
QAction* createPageAction(const QIcon &icon, const QString &text, QActionGroup *group);
/** Adds a new action to the toolbar. */
void addAction(QAction *action, const char *slot = 0);
void addAction(QAction *action, FunctionType actionFunction, const char *slot = 0);
QMap<QString, FunctionType> _functionList;
QString nameAndLocation;

View File

@ -12,34 +12,20 @@
</property>
<property name="windowTitle">
<string notr="true">MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>421</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>2</number>
</property>
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>

View File

@ -102,6 +102,21 @@ bool AppearancePage::save(QString &errmsg)
case 3:
Settings->setToolButtonSize(32);
}
switch (ui.cmboListItemSize->currentIndex())
{
case 0:
Settings->setListItemIconSize(8);
break;
case 1:
Settings->setListItemIconSize(16);
break;
case 2:
default:
Settings->setListItemIconSize(24);
break;
case 3:
Settings->setListItemIconSize(32);
}
/* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText());
@ -159,6 +174,21 @@ void AppearancePage::load()
case 32:
ui.cmboTollButtonsSize->setCurrentIndex(3);
}
switch (Settings->getListItemIconSize())
{
case 8:
ui.cmboListItemSize->setCurrentIndex(0);
break;
case 16:
ui.cmboListItemSize->setCurrentIndex(1);
break;
case 24:
default:
ui.cmboListItemSize->setCurrentIndex(2);
break;
case 32:
ui.cmboListItemSize->setCurrentIndex(3);
}
}
void AppearancePage::loadStyleSheet(int index)

View File

@ -20,190 +20,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="4" column="0">
<widget class="QGroupBox" name="grpToolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QGridLayout" name="gridLayout_ToolBar">
<item row="4" column="0">
<widget class="QFrame" name="frameAction">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtActionOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtActionOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="framePage">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtPageOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtPageOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelActionToolBar">
<property name="text">
<string>Where do you want to have the buttons for menu?</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPageToolBar">
<property name="text">
<string>Where do you want to have the buttons for the page?</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelToolButtonStyle">
<property name="text">
<string>Choose the style of Tool Buttons.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QComboBox" name="cmboTollButtonsStyle">
<item>
<property name="text">
<string>Icon Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Beside Icon</string>
</property>
</item>
<item>
<property name="text">
<string>Text Under Icon</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QComboBox" name="cmboTollButtonsSize">
<item>
<property name="text">
<string>Icon Size = 8x8</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 16x16</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 24x24</string>
</property>
</item>
<item>
<property name="text">
<string>Inon Size = 32x32</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="grpLanguage">
<property name="minimumSize">
@ -261,44 +77,6 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="grpStyleSheet">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="gridLayout_StyleSheet">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyleSheet">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="grpStyle">
<property name="minimumSize">
@ -346,6 +124,286 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="grpStyleSheet">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="gridLayout_StyleSheet">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyleSheet">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="7" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<widget class="QGroupBox" name="grpToolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>228</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QGridLayout" name="gridLayout_ToolBar">
<item row="4" column="0">
<widget class="QFrame" name="frameAction">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtActionOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtActionOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelActionToolBar">
<property name="text">
<string>Where do you want to have the buttons for menu?</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="framePage">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtPageOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtPageOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPageToolBar">
<property name="text">
<string>Where do you want to have the buttons for the page?</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QFrame" name="frameToolListStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QGridLayout" name="gridLayoutToolListStyle">
<item row="2" column="0">
<widget class="QComboBox" name="cmboTollButtonsStyle">
<item>
<property name="text">
<string>Icon Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Beside Icon</string>
</property>
</item>
<item>
<property name="text">
<string>Text Under Icon</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelToolButtonStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose the style of Tool Buttons.</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelListItemStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose the style of List Items.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="cmboTollButtonsSize">
<item>
<property name="text">
<string>Icon Size = 8x8</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 16x16</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 24x24</string>
</property>
</item>
<item>
<property name="text">
<string>Inon Size = 32x32</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmboListItemSize">
<item>
<property name="text">
<string>Icon Size = 8x8</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 16x16</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 24x24</string>
</property>
</item>
<item>
<property name="text">
<string>Inon Size = 32x32</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -54,24 +54,32 @@ int RSettingsWin::lastPage = 0;
RSettingsWin::RSettingsWin(QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
{
setupUi(this);
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
setModal(false);
/* Initialize help browser */
mHelpBrowser = new FloatingHelpBrowser(this, helpButton);
mHelpBrowser = new FloatingHelpBrowser(this, ui.helpButton);
initStackedWidget();
connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int)));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveChanges()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
/* Load window position */
QByteArray geometry = Settings->valueFromGroup("SettingDialog", "Geometry", QByteArray()).toByteArray();
if (geometry.isEmpty() == false) {
restoreGeometry(geometry);
}
connect(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int)));
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(saveChanges()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
}
RSettingsWin::~RSettingsWin()
{
lastPage = stackedWidget->currentIndex ();
/* Save window position */
Settings->setValueToGroup("SettingDialog", "Geometry", saveGeometry());
lastPage = ui.stackedWidget->currentIndex ();
_instance = NULL;
}
@ -104,13 +112,13 @@ void RSettingsWin::dialogFinished(int result)
/*static*/ void RSettingsWin::postModDirectories(bool update_local)
{
if (_instance == NULL || _instance->isHidden() || _instance->stackedWidget == NULL) {
if (_instance == NULL || _instance->isHidden() || _instance->ui.stackedWidget == NULL) {
return;
}
if (update_local) {
if (_instance->stackedWidget->currentIndex() == Directories) {
ConfigPage *Page = dynamic_cast<ConfigPage *> (_instance->stackedWidget->currentWidget());
if (_instance->ui.stackedWidget->currentIndex() == Directories) {
ConfigPage *Page = dynamic_cast<ConfigPage *> (_instance->ui.stackedWidget->currentWidget());
if (Page) {
Page->load();
}
@ -121,8 +129,8 @@ void RSettingsWin::dialogFinished(int result)
void
RSettingsWin::initStackedWidget()
{
stackedWidget->setCurrentIndex(-1);
stackedWidget->removeWidget(stackedWidget->widget(0));
ui.stackedWidget->setCurrentIndex(-1);
ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0));
addPage(new GeneralPage(0));
addPage(new ServerPage());
@ -157,16 +165,16 @@ RSettingsWin::initStackedWidget()
void RSettingsWin::addPage(ConfigPage *page)
{
stackedWidget->addWidget(page) ;
ui.stackedWidget->addWidget(page) ;
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()) ;
listWidget->addItem(item) ;
ui.listWidget->addItem(item) ;
}
void
RSettingsWin::setNewPage(int page)
{
ConfigPage *pagew = dynamic_cast<ConfigPage*>(stackedWidget->widget(page)) ;
ConfigPage *pagew = dynamic_cast<ConfigPage*>(ui.stackedWidget->widget(page)) ;
mHelpBrowser->hide();
@ -176,11 +184,11 @@ RSettingsWin::setNewPage(int page)
mHelpBrowser->clear();
return ;
}
pageName->setText(pagew->pageName());
pageicon->setPixmap(pagew->iconPixmap()) ;
ui.pageName->setText(pagew->pageName());
ui.pageicon->setPixmap(pagew->iconPixmap()) ;
stackedWidget->setCurrentIndex(page);
listWidget->setCurrentRow(page);
ui.stackedWidget->setCurrentIndex(page);
ui.listWidget->setCurrentRow(page);
mHelpBrowser->setHelpText(pagew->helpText());
}
@ -192,15 +200,15 @@ RSettingsWin::saveChanges()
QString errmsg;
/* Call each config page's save() method to save its data */
int i, count = stackedWidget->count();
for (i = 0; i < count; i++)
int i, count = ui.stackedWidget->count();
for (i = 0; i < count; i++)
{
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
ConfigPage *page = dynamic_cast<ConfigPage *>(ui.stackedWidget->widget(i));
if (page && page->wasLoaded()) {
if (!page->save(errmsg))
{
/* Display the offending page */
stackedWidget->setCurrentWidget(page);
ui.stackedWidget->setCurrentWidget(page);
/* Show the user what went wrong */
QMessageBox::warning(this,

View File

@ -28,7 +28,7 @@
class FloatingHelpBrowser;
class RSettingsWin: public QDialog, private Ui::Settings
class RSettingsWin: public QDialog
{
Q_OBJECT
@ -61,6 +61,9 @@ private:
FloatingHelpBrowser *mHelpBrowser;
static RSettingsWin *_instance;
static int lastPage;
/* UI - from Designer */
Ui::Settings ui;
};
#endif // !RSETTINGSWIN_HPP_

View File

@ -48,6 +48,7 @@
#define SETTING_ACTIONBUTTONLOC "ActionButtonLocation"
#define SETTING_TOOLBUTTONSTYLE "ToolButtonStyle"
#define SETTING_TOOLBUTTONSIZE "ToolButtonSize"
#define SETTING_LISTITEMICONSIZE "ListItemIconSize"
#define SETTING_DATA_DIRECTORY "DataDirectory"
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
@ -277,6 +278,45 @@ void RshareSettings::setToolButtonSize(int size)
setValue(SETTING_TOOLBUTTONSIZE, 32);
}
}
/** Gets the list item icon's size.*/
int RshareSettings::getListItemIconSize()
{
int intValue=value(SETTING_LISTITEMICONSIZE, 24).toInt();
switch (intValue)
{
case 8:
return 8;
case 16:
return 16;
case 24:
default:
return 24;
case 32:
return 32;
}
}
/** Sets the list item icon's size.*/
void RshareSettings::setListItemIconSize(int size)
{
switch (size)
{
case 8:
setValue(SETTING_LISTITEMICONSIZE, 8);
break;
case 16:
setValue(SETTING_LISTITEMICONSIZE, 16);
break;
case 24:
default:
setValue(SETTING_LISTITEMICONSIZE, 24);
break;
case 32:
setValue(SETTING_LISTITEMICONSIZE, 32);
}
}
static QString getKeyForLastDir(RshareSettings::enumLastDir type)
{
switch (type) {

View File

@ -132,6 +132,11 @@ public:
/** Sets the tool button's size.*/
void setToolButtonSize(int size);
/** Gets the list item icon's size.*/
int getListItemIconSize();
/** Sets the list item icon's size.*/
void setListItemIconSize(int size);
/** Returns true if RetroShare's main window should be visible when the
* application starts. */
bool getStartMinimized();

View File

@ -3,88 +3,41 @@
<class>Settings</class>
<widget class="QDialog" name="Settings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>366</height>
</rect>
</property>
<property name="windowTitle">
<rect>
<x>0</x>
<y>0</y>
<width>820</width>
<height>620</height>
</rect>
</property>
<property name="windowTitle">
<string>Options</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="spacing">
<number>0</number>
</property>
<property name="gridSize">
<size>
<width>100</width>
<height>24</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="pageName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
@ -140,43 +93,109 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" rowspan="3">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="spacing">
<number>0</number>
</property>
<property name="gridSize">
<size>
<width>100</width>
<height>24</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>664</width>
<height>501</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page"/>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>