mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
reworked settings
now there is only one global object for loading and saving settings RshareSettings *Settings; the class RSettings can be used too, but it is not prefered, because the default settings has no affect git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2964 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e68e6b54ef
commit
6baf56285b
@ -364,15 +364,13 @@ TBoard::TBoard(QWidget *parent) {
|
||||
score = 0;
|
||||
level = 0;
|
||||
|
||||
RshareSettings settings;
|
||||
maxScore = settings.value("/about/maxsc").toInt();
|
||||
maxScore = Settings->value("/about/maxsc").toInt();
|
||||
}
|
||||
TBoard::~TBoard() {
|
||||
RshareSettings settings;
|
||||
int oldMax = settings.value("/about/maxsc").toInt();
|
||||
int oldMax = Settings->value("/about/maxsc").toInt();
|
||||
int newMax = qMax(maxScore, score);
|
||||
if (oldMax < newMax) {
|
||||
settings.setValue("/about/maxsc", newMax);
|
||||
Settings->setValue("/about/maxsc", newMax);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rsforums.h"
|
||||
|
||||
#include "settings/rsettings.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
@ -109,6 +107,8 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
m_bProcessSettings = false;
|
||||
|
||||
connect( ui.forumTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
@ -219,41 +219,46 @@ ForumsDialog::~ForumsDialog()
|
||||
|
||||
void ForumsDialog::processSettings(bool bLoad)
|
||||
{
|
||||
m_bProcessSettings = true;
|
||||
|
||||
QHeaderView *pHeader = ui.threadTreeWidget->header () ;
|
||||
|
||||
RSettings settings(QString("ForumsDialog"));
|
||||
Settings->beginGroup(QString("ForumsDialog"));
|
||||
|
||||
if (bLoad) {
|
||||
// load settings
|
||||
|
||||
// expandFiles
|
||||
bool bValue = settings.value("expandButton", true).toBool();
|
||||
bool bValue = Settings->value("expandButton", true).toBool();
|
||||
ui.expandButton->setChecked(bValue);
|
||||
togglethreadview_internal();
|
||||
|
||||
// filterColumn
|
||||
int nValue = FilterColumnToComboBox(settings.value("filterColumn", true).toInt());
|
||||
int nValue = FilterColumnToComboBox(Settings->value("filterColumn", true).toInt());
|
||||
ui.filterColumnComboBox->setCurrentIndex(nValue);
|
||||
|
||||
// index of viewBox
|
||||
ui.viewBox->setCurrentIndex(settings.value("viewBox", VIEW_THREADED).toInt());
|
||||
ui.viewBox->setCurrentIndex(Settings->value("viewBox", VIEW_THREADED).toInt());
|
||||
|
||||
// state of thread tree
|
||||
pHeader->restoreState(settings.value("ThreadTree").toByteArray());
|
||||
pHeader->restoreState(Settings->value("ThreadTree").toByteArray());
|
||||
|
||||
// state of splitter
|
||||
ui.splitter->restoreState(settings.value("Splitter").toByteArray());
|
||||
ui.threadSplitter->restoreState(settings.value("threadSplitter").toByteArray());
|
||||
ui.splitter->restoreState(Settings->value("Splitter").toByteArray());
|
||||
ui.threadSplitter->restoreState(Settings->value("threadSplitter").toByteArray());
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of thread tree
|
||||
settings.setValue("ThreadTree", pHeader->saveState());
|
||||
Settings->setValue("ThreadTree", pHeader->saveState());
|
||||
|
||||
// state of splitter
|
||||
settings.setValue("Splitter", ui.splitter->saveState());
|
||||
settings.setValue("threadSplitter", ui.threadSplitter->saveState());
|
||||
Settings->setValue("Splitter", ui.splitter->saveState());
|
||||
Settings->setValue("threadSplitter", ui.threadSplitter->saveState());
|
||||
}
|
||||
|
||||
Settings->endGroup();
|
||||
m_bProcessSettings = false;
|
||||
}
|
||||
|
||||
void ForumsDialog::forumListCustomPopupMenu( QPoint point )
|
||||
@ -344,8 +349,7 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
|
||||
void ForumsDialog::togglethreadview()
|
||||
{
|
||||
// save state of button
|
||||
RSettings settings(QString("ForumsDialog"));
|
||||
settings.setValue("expandButton", ui.expandButton->isChecked());
|
||||
Settings->setValueToGroup("ForumsDialog", "expandButton", ui.expandButton->isChecked());
|
||||
|
||||
togglethreadview_internal();
|
||||
}
|
||||
@ -1436,15 +1440,22 @@ void ForumsDialog::clearFilter()
|
||||
|
||||
void ForumsDialog::changedViewBox()
|
||||
{
|
||||
if (m_bProcessSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
// save index
|
||||
RSettings settings(QString("ForumsDialog"));
|
||||
settings.setValue("viewBox", ui.viewBox->currentIndex());
|
||||
Settings->setValueToGroup("ForumsDialog", "viewBox", ui.viewBox->currentIndex());
|
||||
|
||||
insertThreads();
|
||||
}
|
||||
|
||||
void ForumsDialog::filterColumnChanged()
|
||||
{
|
||||
if (m_bProcessSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nFilterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
||||
if (nFilterColumn == COLUMN_CONTENT) {
|
||||
// need content ... refill
|
||||
@ -1454,8 +1465,7 @@ void ForumsDialog::filterColumnChanged()
|
||||
}
|
||||
|
||||
// save index
|
||||
RSettings settings(QString("ForumsDialog"));
|
||||
settings.setValue("filterColumn", nFilterColumn);
|
||||
Settings->setValueToGroup("ForumsDialog", "filterColumn", nFilterColumn);
|
||||
}
|
||||
|
||||
void ForumsDialog::FilterItems()
|
||||
|
@ -95,6 +95,8 @@ private:
|
||||
void FilterItems();
|
||||
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int nFilterColumn);
|
||||
|
||||
bool m_bProcessSettings;
|
||||
|
||||
QTreeWidgetItem *YourForums;
|
||||
QTreeWidgetItem *SubscribedForums;
|
||||
QTreeWidgetItem *PopularForums;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <rsiface/rsinit.h>
|
||||
#include "GenCertDialog.h"
|
||||
#include "InfoDialog.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
@ -122,11 +122,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
RshareSettings settings;
|
||||
|
||||
if (settings.value(QString::fromUtf8("FirstRun"), true).toBool())
|
||||
if (Settings->value(QString::fromUtf8("FirstRun"), true).toBool())
|
||||
{
|
||||
settings.setValue(QString::fromUtf8("FirstRun"), false);
|
||||
Settings->setValue(QString::fromUtf8("FirstRun"), false);
|
||||
QuickStartWizard *qstartWizard = new QuickStartWizard(this);
|
||||
qstartWizard->exec();
|
||||
}
|
||||
@ -573,9 +571,7 @@ void MainWindow::createActions()
|
||||
*/
|
||||
void MainWindow::doQuit()
|
||||
{
|
||||
RshareSettings settings;
|
||||
|
||||
if(!settings.value(QString::fromUtf8("doQuit"), false).toBool())
|
||||
if(!Settings->value(QString::fromUtf8("doQuit"), false).toBool())
|
||||
{
|
||||
QString queryWrn;
|
||||
queryWrn.clear();
|
||||
@ -603,9 +599,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
static bool firstTime = true;
|
||||
|
||||
RshareSettings settings;
|
||||
|
||||
if(!settings.value(QString::fromUtf8("ClosetoTray"), false).toBool())
|
||||
if(!Settings->value(QString::fromUtf8("ClosetoTray"), false).toBool())
|
||||
{
|
||||
if (trayIcon->isVisible()) {
|
||||
if (firstTime)
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
#include "settings/rsettings.h"
|
||||
#include <QtGui>
|
||||
|
||||
/* Images for context menu icons */
|
||||
@ -93,7 +92,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
m_bProcessSettings = false;
|
||||
|
||||
connect( ui.messagestreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.messagestreeView, SIGNAL(clicked ( const QModelIndex &) ) , this, SLOT( clicked( const QModelIndex & ) ) );
|
||||
@ -245,37 +246,45 @@ MessagesDialog::~MessagesDialog()
|
||||
|
||||
void MessagesDialog::processSettings(bool bLoad)
|
||||
{
|
||||
m_bProcessSettings = true;
|
||||
|
||||
QHeaderView *msgwheader = ui.messagestreeView->header () ;
|
||||
|
||||
RSettings settings(QString("MessageDialog"));
|
||||
Settings->beginGroup(QString("MessageDialog"));
|
||||
|
||||
if (bLoad) {
|
||||
// load settings
|
||||
|
||||
// expandFiles
|
||||
bool bValue = settings.value("expandFiles", true).toBool();
|
||||
bool bValue = Settings->value("expandFiles", true).toBool();
|
||||
ui.expandFilesButton->setChecked(bValue);
|
||||
ui.msgList->setVisible(bValue);
|
||||
togglefileview_internal();
|
||||
|
||||
// filterColumn
|
||||
int nValue = FilterColumnToComboBox(settings.value("filterColumn", true).toInt());
|
||||
int nValue = FilterColumnToComboBox(Settings->value("filterColumn", true).toInt());
|
||||
ui.filterColumnComboBox->setCurrentIndex(nValue);
|
||||
|
||||
// state of message tree
|
||||
msgwheader->restoreState(settings.value("MessageTree").toByteArray());
|
||||
msgwheader->restoreState(Settings->value("MessageTree").toByteArray());
|
||||
|
||||
// state of splitter
|
||||
ui.msgSplitter_2->restoreState(settings.value("Splitter2").toByteArray());
|
||||
ui.msgSplitter->restoreState(Settings->value("Splitter").toByteArray());
|
||||
ui.msgSplitter_2->restoreState(Settings->value("Splitter2").toByteArray());
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of message tree
|
||||
settings.setValue("MessageTree", msgwheader->saveState());
|
||||
Settings->setValue("MessageTree", msgwheader->saveState());
|
||||
|
||||
// state of splitter
|
||||
settings.setValue("Splitter2", ui.msgSplitter_2->saveState());
|
||||
Settings->setValue("Splitter", ui.msgSplitter->saveState());
|
||||
Settings->setValue("Splitter2", ui.msgSplitter_2->saveState());
|
||||
}
|
||||
|
||||
Settings->endGroup();
|
||||
|
||||
m_bProcessSettings = false;
|
||||
}
|
||||
|
||||
// replaced by shortcut
|
||||
@ -582,8 +591,7 @@ void MessagesDialog::togglefileview_internal()
|
||||
void MessagesDialog::togglefileview()
|
||||
{
|
||||
// save state of files view
|
||||
RSettings settings(QString("MessageDialog"));
|
||||
settings.setValue("expandFiles", ui.expandFilesButton->isChecked());
|
||||
Settings->setValueToGroup("MessageDialog", "expandFiles", ui.expandFilesButton->isChecked());
|
||||
|
||||
togglefileview_internal();
|
||||
}
|
||||
@ -1341,15 +1349,17 @@ void MessagesDialog::buttonsicononly()
|
||||
ui.printbutton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
|
||||
RSettings settings(QString("MessageDialog"));
|
||||
Settings->beginGroup(QString("MessageDialog"));
|
||||
|
||||
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void MessagesDialog::buttonstextbesideicon()
|
||||
@ -1362,23 +1372,21 @@ void MessagesDialog::buttonstextbesideicon()
|
||||
ui.printbutton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
RSettings settings(QString("MessageDialog"));
|
||||
Settings->beginGroup(QString("MessageDialog"));
|
||||
|
||||
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void MessagesDialog::buttonstextundericon()
|
||||
{
|
||||
RshareSettings settings;
|
||||
|
||||
settings.beginGroup("MessageDialog");
|
||||
|
||||
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
ui.removemessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
ui.replymessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
@ -1387,24 +1395,24 @@ void MessagesDialog::buttonstextundericon()
|
||||
ui.printbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
|
||||
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
Settings->beginGroup("MessageDialog");
|
||||
|
||||
settings.endGroup();
|
||||
Settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
|
||||
Settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
|
||||
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void MessagesDialog::loadToolButtonsettings()
|
||||
{
|
||||
RshareSettings settings;
|
||||
Settings->beginGroup("MessageDialog");
|
||||
|
||||
settings.beginGroup("MessageDialog");
|
||||
|
||||
if(settings.value("ToolButon_Stlye1","0").toInt() == 0)
|
||||
if(Settings->value("ToolButon_Stlye1","0").toInt() == 0)
|
||||
{
|
||||
qDebug() << "ToolButon IconOnly";
|
||||
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
@ -1416,7 +1424,7 @@ void MessagesDialog::loadToolButtonsettings()
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
}
|
||||
|
||||
else if (settings.value("ToolButon_Stlye1","2").toInt() ==2)
|
||||
else if (Settings->value("ToolButon_Stlye1","2").toInt() ==2)
|
||||
{
|
||||
qDebug() << "ToolButon TextBesideIcon";
|
||||
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
@ -1428,7 +1436,7 @@ void MessagesDialog::loadToolButtonsettings()
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
}
|
||||
|
||||
else if(settings.value("ToolButon_Stlye1","3").toInt() ==3)
|
||||
else if(Settings->value("ToolButon_Stlye1","3").toInt() ==3)
|
||||
{
|
||||
qDebug() << "ToolButton TextUnderIcon";
|
||||
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
@ -1440,7 +1448,7 @@ void MessagesDialog::loadToolButtonsettings()
|
||||
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void MessagesDialog::filterRegExpChanged()
|
||||
@ -1462,6 +1470,10 @@ void MessagesDialog::filterRegExpChanged()
|
||||
|
||||
void MessagesDialog::filterColumnChanged()
|
||||
{
|
||||
if (m_bProcessSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nFilterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
||||
if (nFilterColumn == COLUMN_CONTENT) {
|
||||
// need content ... refill
|
||||
@ -1470,8 +1482,7 @@ void MessagesDialog::filterColumnChanged()
|
||||
proxyModel->setFilterKeyColumn(nFilterColumn);
|
||||
|
||||
// save index
|
||||
RSettings settings(QString("MessageDialog"));
|
||||
settings.setValue("filterColumn", nFilterColumn);
|
||||
Settings->setValueToGroup("MessageDialog", "filterColumn", nFilterColumn);
|
||||
}
|
||||
|
||||
void MessagesDialog::updateMessageSummaryList()
|
||||
|
@ -97,7 +97,7 @@ private slots:
|
||||
void clearFilter();
|
||||
|
||||
private:
|
||||
class QStandardItemModel *MessagesModel;
|
||||
class QStandardItemModel *MessagesModel;
|
||||
QSortFilterProxyModel *proxyModel;
|
||||
|
||||
bool getCurrentMsg(std::string &cid, std::string &mid);
|
||||
@ -112,6 +112,8 @@ private:
|
||||
|
||||
void processSettings(bool bLoad);
|
||||
|
||||
bool m_bProcessSettings;
|
||||
|
||||
std::string mCurrCertId;
|
||||
std::string mCurrMsgId;
|
||||
|
||||
|
@ -804,8 +804,7 @@ void MessengerWindow::show()
|
||||
|
||||
void MessengerWindow::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
//RshareSettings config;
|
||||
//config.saveWidgetInformation(this);
|
||||
//Settings->saveWidgetInformation(this);
|
||||
|
||||
hide();
|
||||
event->ignore();
|
||||
@ -913,12 +912,7 @@ void MessengerWindow::loadmystatusmessage()
|
||||
/** Save own status message */
|
||||
void MessengerWindow::savestatusmessage()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Profile");
|
||||
|
||||
settings.setValue("StatusMessage",ui.messagelineEdit->text());
|
||||
|
||||
settings.endGroup();
|
||||
Settings->setValueToGroup("Profile", "StatusMessage",ui.messagelineEdit->text());
|
||||
|
||||
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
|
||||
}
|
||||
|
@ -808,46 +808,31 @@ void NetworkDialog::updateNetworkStatus()
|
||||
|
||||
void NetworkDialog::on_actionTabsnorth_activated()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("NetworkDialog");
|
||||
|
||||
ui.networkTab->setTabPosition(QTabWidget::North);
|
||||
|
||||
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
|
||||
settings.endGroup();
|
||||
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
|
||||
}
|
||||
|
||||
void NetworkDialog::on_actionTabssouth_activated()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("NetworkDialog");
|
||||
|
||||
ui.networkTab->setTabPosition(QTabWidget::South);
|
||||
|
||||
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
|
||||
settings.endGroup();
|
||||
|
||||
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
|
||||
|
||||
}
|
||||
|
||||
void NetworkDialog::on_actionTabswest_activated()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("NetworkDialog");
|
||||
|
||||
ui.networkTab->setTabPosition(QTabWidget::West);
|
||||
|
||||
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
|
||||
settings.endGroup();
|
||||
|
||||
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
|
||||
}
|
||||
|
||||
void NetworkDialog::on_actionTabsright_activated()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("NetworkDialog");
|
||||
|
||||
ui.networkTab->setTabPosition(QTabWidget::East);
|
||||
|
||||
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
|
||||
settings.endGroup();
|
||||
|
||||
Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
|
||||
}
|
||||
|
||||
void NetworkDialog::on_actionTabsTriangular_activated()
|
||||
@ -864,29 +849,28 @@ void NetworkDialog::on_actionTabsRounded_activated()
|
||||
|
||||
void NetworkDialog::loadtabsettings()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("NetworkDialog");
|
||||
Settings->beginGroup("NetworkDialog");
|
||||
|
||||
if(settings.value("TabWidget_Position","0").toInt() == 0)
|
||||
if(Settings->value("TabWidget_Position","0").toInt() == 0)
|
||||
{
|
||||
qDebug() << "Tab North";
|
||||
ui.networkTab->setTabPosition(QTabWidget::North);
|
||||
}
|
||||
else if (settings.value("TabWidget_Position","1").toInt() == 1)
|
||||
else if (Settings->value("TabWidget_Position","1").toInt() == 1)
|
||||
{
|
||||
qDebug() << "Tab South";
|
||||
ui.networkTab->setTabPosition(QTabWidget::South);
|
||||
}
|
||||
else if (settings.value("TabWidget_Position","2").toInt() ==2)
|
||||
else if (Settings->value("TabWidget_Position","2").toInt() ==2)
|
||||
{
|
||||
qDebug() << "Tab West";
|
||||
ui.networkTab->setTabPosition(QTabWidget::West);
|
||||
}
|
||||
else if(settings.value("TabWidget_Position","3").toInt() ==3)
|
||||
else if(Settings->value("TabWidget_Position","3").toInt() ==3)
|
||||
{
|
||||
qDebug() << "Tab East";
|
||||
ui.networkTab->setTabPosition(QTabWidget::East);
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
@ -74,9 +74,7 @@ void NewsFeed::updateFeed()
|
||||
if (!rsNotify)
|
||||
return;
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings settings;
|
||||
uint flags = settings.getNewsFeedFlags();
|
||||
uint flags = Settings->getNewsFeedFlags();
|
||||
|
||||
/* check for new messages */
|
||||
RsFeedItem fi;
|
||||
|
@ -149,20 +149,20 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
pxm.fill(_currentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
|
||||
RSettings settings(QString("Chat"));
|
||||
|
||||
mCurrentFont.fromString(settings.value(QString::fromUtf8("ChatScreenFont")).toString());
|
||||
Settings->beginGroup(QString("Chat"));
|
||||
mCurrentFont.fromString(Settings->value(QString::fromUtf8("ChatScreenFont")).toString());
|
||||
ui.lineEdit->setFont(mCurrentFont);
|
||||
|
||||
|
||||
setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue"));
|
||||
|
||||
if (settings.value(QString::fromUtf8("GroupChat_History"), true).toBool())
|
||||
if (Settings->value(QString::fromUtf8("GroupChat_History"), true).toBool())
|
||||
{
|
||||
QStringList him;
|
||||
historyKeeper.getMessages(him, "", "THIS", 8);
|
||||
foreach(QString mess, him)
|
||||
ui.msgText->append(mess);
|
||||
}
|
||||
Settings->endGroup();
|
||||
|
||||
//setChatInfo(mess, "green");
|
||||
|
||||
@ -956,9 +956,7 @@ void PeersDialog::insertChat()
|
||||
QTextEdit *msgWidget = ui.msgText;
|
||||
std::list<ChatInfo>::iterator it;
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings settings;
|
||||
uint chatflags = settings.getChatFlags();
|
||||
uint chatflags = Settings->getChatFlags();
|
||||
|
||||
/* add in lines at the bottom */
|
||||
for(it = newchat.begin(); it != newchat.end(); it++)
|
||||
@ -1015,10 +1013,10 @@ void PeersDialog::insertChat()
|
||||
RsChat::embedHtml(doc, body, defEmbedAhref);
|
||||
|
||||
// embed smileys
|
||||
settings.beginGroup("Chat");
|
||||
if (settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool())
|
||||
Settings->beginGroup("Chat");
|
||||
if (Settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool())
|
||||
RsChat::embedHtml(doc, body, defEmbedImg);
|
||||
settings.endGroup();
|
||||
Settings->endGroup();
|
||||
|
||||
msgContents = doc.toString(-1); // -1 removes any annoying carriage return misinterpreted by QTextEdit
|
||||
extraTxt += msgContents;
|
||||
@ -1287,10 +1285,9 @@ void PeersDialog::setFont()
|
||||
mCurrentFont.setItalic(ui.textitalicChatButton->isChecked());
|
||||
ui.lineEdit->setFont(mCurrentFont);
|
||||
ui.lineEdit->setTextColor(_currentColor);
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Chat");
|
||||
settings.setValue(QString::fromUtf8("ChatScreenFont"), mCurrentFont.toString());
|
||||
settings.endGroup();
|
||||
Settings->beginGroup("Chat");
|
||||
Settings->setValue(QString::fromUtf8("ChatScreenFont"), mCurrentFont.toString());
|
||||
Settings->endGroup();
|
||||
|
||||
|
||||
ui.lineEdit->setFocus();
|
||||
@ -1848,15 +1845,14 @@ void PeersDialog::setCurrentFileName(const QString &fileName)
|
||||
|
||||
////play sound when recv a message
|
||||
void PeersDialog::playsound(){
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Sound");
|
||||
settings.beginGroup("SoundFilePath");
|
||||
QString OnlineSound= settings.value("NewChatMessage","").toString();
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Enable");
|
||||
bool flag= settings.value("NewChatMessage",false).toBool();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
Settings->beginGroup("Sound");
|
||||
Settings->beginGroup("SoundFilePath");
|
||||
QString OnlineSound = Settings->value("NewChatMessage","").toString();
|
||||
Settings->endGroup();
|
||||
Settings->beginGroup("Enable");
|
||||
bool flag = Settings->value("NewChatMessage",false).toBool();
|
||||
Settings->endGroup();
|
||||
Settings->endGroup();
|
||||
if(!OnlineSound.isEmpty()&&flag)
|
||||
if(QSound::isAvailable())
|
||||
QSound::play(OnlineSound);
|
||||
|
@ -170,12 +170,9 @@ void QuickStartWizard::on_pushButtonSystemBack_clicked()
|
||||
|
||||
void QuickStartWizard::on_pushButtonSystemFinish_clicked()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
|
||||
|
||||
settings.setValue(QString::fromUtf8("doQuit"), quitbox());
|
||||
|
||||
settings.setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked());
|
||||
Settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
|
||||
Settings->setValue(QString::fromUtf8("doQuit"), quitbox());
|
||||
Settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked());
|
||||
|
||||
saveChanges();
|
||||
|
||||
@ -356,14 +353,11 @@ bool QuickStartWizard::messageBoxOk(QString msg)
|
||||
void
|
||||
QuickStartWizard::loadGeneral()
|
||||
{
|
||||
RshareSettings settings;
|
||||
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(settings.runRetroshareOnBoot());
|
||||
|
||||
ui.checkBoxStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
|
||||
ui.checkBoxQuit->setChecked(settings.value(QString::fromUtf8("doQuit"), false).toBool());
|
||||
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot());
|
||||
ui.checkBoxStartMinimized->setChecked(Settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
ui.checkBoxQuit->setChecked(Settings->value(QString::fromUtf8("doQuit"), false).toBool());
|
||||
|
||||
//ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool());
|
||||
//ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool());
|
||||
}
|
||||
|
||||
bool QuickStartWizard::quitbox() const {
|
||||
|
@ -104,8 +104,6 @@ SearchDialog::SearchDialog(QWidget *parent)
|
||||
initialiseFileTypeMappings();
|
||||
}
|
||||
|
||||
RshareSettings rsharesettings;
|
||||
|
||||
connect(ui.toggleAdvancedSearchBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog()));
|
||||
|
||||
connect( ui.searchResultWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchtableWidgetCostumPopupMenu( QPoint ) ) );
|
||||
@ -447,9 +445,8 @@ void SearchDialog::hideEvent(QHideEvent * event)
|
||||
void SearchDialog::toggleAdvancedSearchDialog(bool toggled)
|
||||
{
|
||||
// record the users preference for future reference
|
||||
RshareSettings rsharesettings;
|
||||
QString key (UI_PREF_ADVANCED_SEARCH);
|
||||
rsharesettings.setValue(key, QVariant(toggled));
|
||||
Settings->setValue(key, QVariant(toggled));
|
||||
|
||||
showAdvSearchDialog(toggled);
|
||||
}
|
||||
|
@ -728,19 +728,16 @@ SharedFilesDialog::fileAssotiationAction(const QString fileName)
|
||||
{
|
||||
QAction* result = 0;
|
||||
|
||||
RshareSettings* settings = new RshareSettings();
|
||||
//QSettings* settings= new QSettings(qApp->applicationDirPath()+"/sett.ini",
|
||||
// QSettings::IniFormat);
|
||||
settings->beginGroup("FileAssotiations");
|
||||
Settings->beginGroup("FileAssotiations");
|
||||
|
||||
QString key = AddFileAssociationDialog::cleanFileType(currentFile) ;
|
||||
if ( settings->contains(key) )
|
||||
if ( Settings->contains(key) )
|
||||
{
|
||||
result = new QAction(QIcon(IMAGE_PLAY), tr( "Open File" ), this );
|
||||
connect( result , SIGNAL( triggered() ),
|
||||
this, SLOT( runCommandForFile() ) );
|
||||
|
||||
currentCommand = (settings->value( key )).toString();
|
||||
currentCommand = (Settings->value( key )).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -750,7 +747,7 @@ SharedFilesDialog::fileAssotiationAction(const QString fileName)
|
||||
this, SLOT( tryToAddNewAssotiation() ) );
|
||||
}
|
||||
|
||||
delete settings;
|
||||
Settings->endGroup();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -783,15 +780,10 @@ SharedFilesDialog::tryToAddNewAssotiation()
|
||||
|
||||
if (ti==QDialog::Accepted)
|
||||
{
|
||||
RshareSettings settings;
|
||||
//QSettings settings( qApp->applicationDirPath()+"/sett.ini",
|
||||
// QSettings::IniFormat);
|
||||
settings.beginGroup("FileAssotiations");
|
||||
|
||||
QString currType = afad.resultFileType() ;
|
||||
QString currCmd = afad.resultCommand() ;
|
||||
|
||||
settings.setValue(currType, currCmd);
|
||||
Settings->setValueToGroup("FileAssotiations", currType, currCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,26 +78,23 @@ void SoundManager::event_NewChatMessage()
|
||||
|
||||
void SoundManager::reInit()
|
||||
{
|
||||
RshareSettings settings;
|
||||
Settings->beginGroup("Sound");
|
||||
Settings->beginGroup("Enable");
|
||||
enable_eventUser_go_Online = Settings->value("User_go_Online",false).toBool();
|
||||
enable_eventUser_go_Offline = Settings->value("User_go_Offline",false).toBool();
|
||||
enable_eventFileSend_Finished = Settings->value("FileSend_Finished",false).toBool();
|
||||
enable_eventFileRecive_Incoming = Settings->value("FileRecive_Incoming",false).toBool();
|
||||
enable_eventFileRecive_Finished = Settings->value("FileRecive_Finished",false).toBool();
|
||||
enable_eventNewChatMessage = Settings->value("NewChatMessage",false).toBool();
|
||||
Settings->endGroup();
|
||||
|
||||
settings.beginGroup("Sound");
|
||||
settings.beginGroup("Enable");
|
||||
enable_eventUser_go_Online = settings.value("User_go_Online",false).toBool();
|
||||
enable_eventUser_go_Offline = settings.value("User_go_Offline",false).toBool();
|
||||
enable_eventFileSend_Finished = settings.value("FileSend_Finished",false).toBool();
|
||||
enable_eventFileRecive_Incoming = settings.value("FileRecive_Incoming",false).toBool();
|
||||
enable_eventFileRecive_Finished = settings.value("FileRecive_Finished",false).toBool();
|
||||
enable_eventNewChatMessage = settings.value("NewChatMessage",false).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("SoundFilePath");
|
||||
SoundFileUser_go_Online = settings.value("User_go_Online","").toString();
|
||||
SoundFileUser_go_Offline =settings.value("User_go_Offline","").toString();
|
||||
SoundFileFileSend_Finished = settings.value("FileSend_Finished","").toString();
|
||||
SoundFileFileRecive_Incoming = settings.value("FileRecive_Incoming","").toString();
|
||||
SoundFileFileRecive_Finished = settings.value("FileRecive_Finished","").toString();
|
||||
SoundFileNewChatMessage = settings.value("NewChatMessage","").toString();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
Settings->beginGroup("SoundFilePath");
|
||||
SoundFileUser_go_Online = Settings->value("User_go_Online","").toString();
|
||||
SoundFileUser_go_Offline = Settings->value("User_go_Offline","").toString();
|
||||
SoundFileFileSend_Finished = Settings->value("FileSend_Finished","").toString();
|
||||
SoundFileFileRecive_Incoming = Settings->value("FileRecive_Incoming","").toString();
|
||||
SoundFileFileRecive_Finished = Settings->value("FileRecive_Finished","").toString();
|
||||
SoundFileNewChatMessage = Settings->value("NewChatMessage","").toString();
|
||||
Settings->endGroup();
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,7 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Create Bandwidth Graph related QObjects */
|
||||
RshareSettings settings;
|
||||
settings.loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
_rsLogoBar = NULL;
|
||||
|
||||
@ -109,8 +108,7 @@ void StartDialog::show()
|
||||
|
||||
void StartDialog::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.saveWidgetInformation(this);
|
||||
Settings->saveWidgetInformation(this);
|
||||
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
@ -56,9 +56,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
RshareSettings settings;
|
||||
|
||||
settings.loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
|
||||
|
||||
|
||||
@ -229,8 +227,7 @@ void PopupChatDialog::flash()
|
||||
|
||||
void PopupChatDialog::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.saveWidgetInformation(this);
|
||||
Settings->saveWidgetInformation(this);
|
||||
|
||||
hide();
|
||||
event->ignore();
|
||||
@ -291,8 +288,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
||||
std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
RSettings settings(QString("Chat"));
|
||||
if (settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool())
|
||||
if (Settings->valueFromGroup(QString("Chat"), QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool())
|
||||
{
|
||||
QHashIterator<QString, QString> i(smileys);
|
||||
while(i.hasNext())
|
||||
|
@ -42,8 +42,7 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
@ -179,14 +178,14 @@ void CreateForumMsg::createMsg()
|
||||
close();
|
||||
}
|
||||
|
||||
void CreateForumMsg::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
void CreateForumMsg::cancelMsg()
|
||||
{
|
||||
close();
|
||||
return;
|
||||
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
void CreateForumMsg::loadEmoticonsForums()
|
||||
|
@ -57,7 +57,9 @@ private slots:
|
||||
void addSmileys();
|
||||
void addFile();
|
||||
void addAttachment(std::string);
|
||||
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private:
|
||||
/** Define the popup menus for the Context menu */
|
||||
|
@ -56,8 +56,6 @@
|
||||
HelpBrowser::HelpBrowser(QWidget *parent)
|
||||
: RWindow("HelpBrowser", parent)
|
||||
{
|
||||
RshareSettings _settings;
|
||||
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
#if defined(Q_WS_MAC)
|
||||
|
@ -48,8 +48,7 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
|
||||
setupViewActions();
|
||||
setupInsertActions();
|
||||
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
@ -227,8 +226,7 @@ void ChanMsgDialog::closeEvent (QCloseEvent * event)
|
||||
event->ignore();
|
||||
hide();
|
||||
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -242,8 +242,7 @@ void NotifyQt::UpdateGUI()
|
||||
|
||||
if (rsNotify->NotifyPopupMessage(type, id, msg))
|
||||
{
|
||||
RshareSettings settings;
|
||||
uint popupflags = settings.getNotifyFlags();
|
||||
uint popupflags = Settings->getNotifyFlags();
|
||||
|
||||
/* id the name */
|
||||
std::string name = rsPeers->getPeerName(id);
|
||||
|
@ -61,13 +61,8 @@ void StatusMessage::closeEvent (QCloseEvent * event)
|
||||
/** Saves the changes on this page */
|
||||
void StatusMessage::save()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Profile");
|
||||
Settings->setValueToGroup("Profile", "StatusMessage",ui.txt_StatusMessage->text());
|
||||
|
||||
settings.setValue("StatusMessage",ui.txt_StatusMessage->text());
|
||||
|
||||
settings.endGroup();
|
||||
|
||||
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString());
|
||||
|
||||
close();
|
||||
|
@ -69,10 +69,9 @@ AppearancePage::save(QString &errmsg)
|
||||
QString languageCode =
|
||||
LanguageSupport::languageCode(ui.cmboLanguage->currentText());
|
||||
|
||||
RshareSettings settings;
|
||||
settings.setLanguageCode(languageCode);
|
||||
settings.setInterfaceStyle(ui.cmboStyle->currentText());
|
||||
settings.setSheetName(ui.styleSheetCombo->currentText());
|
||||
Settings->setLanguageCode(languageCode);
|
||||
Settings->setInterfaceStyle(ui.cmboStyle->currentText());
|
||||
Settings->setSheetName(ui.styleSheetCombo->currentText());
|
||||
|
||||
/* Set to new style */
|
||||
Rshare::setStyle(ui.cmboStyle->currentText());
|
||||
@ -85,21 +84,19 @@ AppearancePage::save(QString &errmsg)
|
||||
void
|
||||
AppearancePage::load()
|
||||
{
|
||||
RshareSettings settings;
|
||||
|
||||
int index = ui.cmboLanguage->findData(settings.getLanguageCode());
|
||||
int index = ui.cmboLanguage->findData(Settings->getLanguageCode());
|
||||
ui.cmboLanguage->setCurrentIndex(index);
|
||||
|
||||
index = ui.cmboStyle->findData(Rshare::style().toLower());
|
||||
ui.cmboStyle->setCurrentIndex(index);
|
||||
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(settings.getSheetName()));
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(Settings->getSheetName()));
|
||||
|
||||
/** load saved internal styleSheet **/
|
||||
//QFile file(":/qss/" + (settings.getSheetName().toLower()) + ".qss");
|
||||
|
||||
/** load saved extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + (settings.getSheetName().toLower()) + ".qss");
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + (Settings->getSheetName().toLower()) + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
|
@ -22,13 +22,13 @@
|
||||
#include "rsiface/rspeers.h" //for rsPeers variable
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include <rshare.h>
|
||||
#include "ChatPage.h"
|
||||
|
||||
#include "rsettings.h"
|
||||
|
||||
/** Constructor */
|
||||
ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
@ -52,12 +52,14 @@ ChatPage::closeEvent (QCloseEvent * event)
|
||||
bool
|
||||
ChatPage::save(QString &errmsg)
|
||||
{
|
||||
RSettings settings(QString("Chat"));
|
||||
Settings->beginGroup(QString("Chat"));
|
||||
|
||||
settings.setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat());
|
||||
settings.setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat());
|
||||
settings.setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory());
|
||||
settings.setValue(QString::fromUtf8("ChatScreenFont"), fontTempChat.toString());
|
||||
Settings->setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat());
|
||||
Settings->setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat());
|
||||
Settings->setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory());
|
||||
Settings->setValue(QString::fromUtf8("ChatScreenFont"), fontTempChat.toString());
|
||||
|
||||
Settings->endGroup();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -66,14 +68,16 @@ ChatPage::save(QString &errmsg)
|
||||
void
|
||||
ChatPage::load()
|
||||
{
|
||||
RSettings settings(QString("Chat"));
|
||||
Settings->beginGroup(QString("Chat"));
|
||||
|
||||
ui.checkBox_emoteprivchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool());
|
||||
ui.checkBox_emotegroupchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool());
|
||||
ui.checkBox_groupchathistory->setChecked(settings.value(QString::fromUtf8("GroupChat_History"), true).toBool());
|
||||
ui.checkBox_emoteprivchat->setChecked(Settings->value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool());
|
||||
ui.checkBox_emotegroupchat->setChecked(Settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool());
|
||||
ui.checkBox_groupchathistory->setChecked(Settings->value(QString::fromUtf8("GroupChat_History"), true).toBool());
|
||||
|
||||
fontTempChat.fromString(Settings->value(QString::fromUtf8("ChatScreenFont")).toString());
|
||||
|
||||
Settings->endGroup();
|
||||
|
||||
fontTempChat.fromString(settings.value(QString::fromUtf8("ChatScreenFont")).toString());
|
||||
|
||||
ui.labelChatFontPreview->setText(fontTempChat.rawName());
|
||||
ui.labelChatFontPreview->setFont(fontTempChat);
|
||||
}
|
||||
|
@ -166,12 +166,8 @@ FileAssociationsPage::save (QString &errmsg)
|
||||
void
|
||||
FileAssociationsPage::load()
|
||||
{
|
||||
RshareSettings settings;
|
||||
// QSettings* settings = new QSettings( qApp->applicationDirPath()+"/sett.ini",
|
||||
// QSettings::IniFormat);
|
||||
//
|
||||
// settings.beginGroup("FileAssotiations");
|
||||
QStringList keys = settings.allKeys();
|
||||
// Settings->beginGroup("FileAssotiations");
|
||||
QStringList keys = Settings->allKeys();
|
||||
|
||||
table->setRowCount( keys.count() );
|
||||
|
||||
@ -179,7 +175,7 @@ FileAssociationsPage::load()
|
||||
QStringList::const_iterator ki;
|
||||
for(ki=keys.constBegin(); ki!=keys.constEnd(); ki++)
|
||||
{
|
||||
QString val = (settings.value(*ki, "")).toString();
|
||||
QString val = (Settings->value(*ki, "")).toString();
|
||||
|
||||
addNewItemToTable( rowi, 0, *ki );
|
||||
addNewItemToTable( rowi, 1, val );
|
||||
@ -187,7 +183,6 @@ FileAssociationsPage::load()
|
||||
rowi++;
|
||||
}
|
||||
|
||||
//delete settings;
|
||||
if (keys.count()==0)
|
||||
{
|
||||
removeAction->setEnabled(false);
|
||||
@ -206,8 +201,7 @@ FileAssociationsPage::remove()
|
||||
QTableWidgetItem const * titem = table->item( currentRow,0);
|
||||
QString key = (titem->data(QTableWidgetItem::Type)).toString();
|
||||
|
||||
RshareSettings settings;
|
||||
settings.remove(key);
|
||||
Settings->remove(key);
|
||||
table->removeRow( currentRow );
|
||||
|
||||
if ( table->rowCount()==0 )
|
||||
@ -235,8 +229,7 @@ FileAssociationsPage::addnew()
|
||||
QString currCmd = afad.resultCommand() ;
|
||||
|
||||
|
||||
RshareSettings settings;
|
||||
if ( !settings.contains(currType) )//new item should be added only if
|
||||
if ( !Settings->contains(currType) )//new item should be added only if
|
||||
{ // it wasn't entered before.
|
||||
int nridx = table->rowCount();//new row index
|
||||
table->setRowCount(nridx+1);
|
||||
@ -257,7 +250,7 @@ FileAssociationsPage::addnew()
|
||||
}
|
||||
}
|
||||
|
||||
settings.setValue(currType, currCmd);
|
||||
Settings->setValue(currType, currCmd);
|
||||
|
||||
removeAction->setEnabled(true);
|
||||
editAction->setEnabled(true);
|
||||
@ -290,8 +283,7 @@ FileAssociationsPage::edit()
|
||||
|
||||
titem->setData(QTableWidgetItem::Type, currCmd);
|
||||
|
||||
RshareSettings settings;
|
||||
settings.setValue(currType, currCmd);
|
||||
Settings->setValue(currType, currCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,14 +55,13 @@ GeneralPage::~GeneralPage()
|
||||
bool
|
||||
GeneralPage::save(QString &errmsg)
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
|
||||
Settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
|
||||
|
||||
settings.setValue(QString::fromUtf8("doQuit"), quit());
|
||||
Settings->setValue(QString::fromUtf8("doQuit"), quit());
|
||||
|
||||
settings.setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
|
||||
Settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
|
||||
|
||||
settings.setRunRetroshareOnBoot(
|
||||
Settings->setRunRetroshareOnBoot(
|
||||
ui.chkRunRetroshareAtSystemStartup->isChecked());
|
||||
|
||||
return true;
|
||||
@ -72,14 +71,13 @@ GeneralPage::save(QString &errmsg)
|
||||
void
|
||||
GeneralPage::load()
|
||||
{
|
||||
RshareSettings settings;
|
||||
ui.chkRunRetroshareAtSystemStartup->setChecked(settings.runRetroshareOnBoot());
|
||||
ui.chkRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot());
|
||||
|
||||
ui.checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
ui.checkStartMinimized->setChecked(Settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
|
||||
ui.checkQuit->setChecked(settings.value(QString::fromUtf8("doQuit"), false).toBool());
|
||||
ui.checkQuit->setChecked(Settings->value(QString::fromUtf8("doQuit"), false).toBool());
|
||||
|
||||
ui.checkClosetoTray->setChecked(settings.value(QString::fromUtf8("ClosetoTray"), false).toBool());
|
||||
ui.checkClosetoTray->setChecked(Settings->value(QString::fromUtf8("ClosetoTray"), false).toBool());
|
||||
|
||||
|
||||
}
|
||||
@ -104,8 +102,7 @@ bool GeneralPage::closetoTray() const {
|
||||
void
|
||||
GeneralPage::toggleShowOnStartup(bool checked)
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.setShowMainWindowAtStart(checked);
|
||||
Settings->setShowMainWindowAtStart(checked);
|
||||
}
|
||||
|
||||
void GeneralPage::setAutoLogin(){
|
||||
|
@ -108,10 +108,9 @@ NotifyPage::save(QString &errmsg)
|
||||
if (ui.chat_Focus->isChecked())
|
||||
chatflags |= RS_CHAT_FOCUS;
|
||||
|
||||
RshareSettings settings;
|
||||
settings.setNotifyFlags(notifyflags);
|
||||
settings.setNewsFeedFlags(newsflags);
|
||||
settings.setChatFlags(chatflags);
|
||||
Settings->setNotifyFlags(notifyflags);
|
||||
Settings->setNewsFeedFlags(newsflags);
|
||||
Settings->setChatFlags(chatflags);
|
||||
|
||||
load();
|
||||
return true;
|
||||
@ -122,11 +121,9 @@ NotifyPage::save(QString &errmsg)
|
||||
void NotifyPage::load()
|
||||
{
|
||||
/* extract from rsNotify the flags */
|
||||
RshareSettings settings;
|
||||
|
||||
uint notifyflags = settings.getNotifyFlags();
|
||||
uint newsflags = settings.getNewsFeedFlags();
|
||||
uint chatflags = settings.getChatFlags();
|
||||
uint notifyflags = Settings->getNotifyFlags();
|
||||
uint newsflags = Settings->getNewsFeedFlags();
|
||||
uint chatflags = Settings->getChatFlags();
|
||||
|
||||
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
|
||||
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);
|
||||
|
@ -56,25 +56,24 @@ SoundPage::~SoundPage()
|
||||
bool
|
||||
SoundPage::save(QString &errmsg)
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Sound");
|
||||
settings.beginGroup("Enable");
|
||||
settings.setValue("User_go_Online",ui.checkBoxSound->isChecked());
|
||||
Settings->beginGroup("Sound");
|
||||
Settings->beginGroup("Enable");
|
||||
Settings->setValue("User_go_Online",ui.checkBoxSound->isChecked());
|
||||
//settings.setValue("User_go_Offline",ui.checkBoxSound_2->isChecked());
|
||||
settings.setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
|
||||
settings.setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
|
||||
settings.setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
|
||||
settings.setValue("NewChatMessage",ui.checkBoxSound_6->isChecked());
|
||||
settings.endGroup();
|
||||
settings.beginGroup("SoundFilePath");
|
||||
settings.setValue("User_go_Online",ui.txt_SoundFile->text());
|
||||
Settings->setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
|
||||
Settings->setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
|
||||
Settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
|
||||
Settings->setValue("NewChatMessage",ui.checkBoxSound_6->isChecked());
|
||||
Settings->endGroup();
|
||||
Settings->beginGroup("SoundFilePath");
|
||||
Settings->setValue("User_go_Online",ui.txt_SoundFile->text());
|
||||
//settings.setValue("User_go_Offline",ui.txt_SoundFile2->text());
|
||||
settings.setValue("FileSend_Finished",ui.txt_SoundFile3->text());
|
||||
settings.setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
|
||||
settings.setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
|
||||
settings.setValue("NewChatMessage",ui.txt_SoundFile6->text());
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
Settings->setValue("FileSend_Finished",ui.txt_SoundFile3->text());
|
||||
Settings->setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
|
||||
Settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
|
||||
Settings->setValue("NewChatMessage",ui.txt_SoundFile6->text());
|
||||
Settings->endGroup();
|
||||
Settings->endGroup();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -85,15 +84,14 @@ SoundPage::save(QString &errmsg)
|
||||
void
|
||||
SoundPage::load()
|
||||
{
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Sound");
|
||||
settings.beginGroup("SoundFilePath");
|
||||
ui.txt_SoundFile->setText(settings.value("User_go_Online","").toString());
|
||||
Settings->beginGroup("Sound");
|
||||
Settings->beginGroup("SoundFilePath");
|
||||
ui.txt_SoundFile->setText(Settings->value("User_go_Online","").toString());
|
||||
//ui.txt_SoundFile2->setText(settings.value("User_go_Offline","").toString());
|
||||
ui.txt_SoundFile3->setText(settings.value("FileSend_Finished","").toString());
|
||||
ui.txt_SoundFile4->setText(settings.value("FileRecive_Incoming","").toString());
|
||||
ui.txt_SoundFile5->setText(settings.value("FileRecive_Finished","").toString());
|
||||
ui.txt_SoundFile6->setText(settings.value("NewChatMessage","").toString());
|
||||
ui.txt_SoundFile3->setText(Settings->value("FileSend_Finished","").toString());
|
||||
ui.txt_SoundFile4->setText(Settings->value("FileRecive_Incoming","").toString());
|
||||
ui.txt_SoundFile5->setText(Settings->value("FileRecive_Finished","").toString());
|
||||
ui.txt_SoundFile6->setText(Settings->value("NewChatMessage","").toString());
|
||||
|
||||
if(!ui.txt_SoundFile->text().isEmpty())ui.checkBoxSound->setEnabled(true);
|
||||
//if(!ui.txt_SoundFile2->text().isEmpty())ui.checkBoxSound_2->setEnabled(true);
|
||||
@ -102,17 +100,17 @@ SoundPage::load()
|
||||
if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true);
|
||||
if(!ui.txt_SoundFile6->text().isEmpty())ui.checkBoxSound_6->setEnabled(true);
|
||||
|
||||
settings.endGroup();
|
||||
Settings->endGroup();
|
||||
|
||||
settings.beginGroup("Enable");
|
||||
ui.checkBoxSound->setChecked(settings.value("User_go_Online",false).toBool());
|
||||
Settings->beginGroup("Enable");
|
||||
ui.checkBoxSound->setChecked(Settings->value("User_go_Online",false).toBool());
|
||||
//ui.checkBoxSound_2->setChecked(settings.value("User_go_Offline",false).toBool());
|
||||
ui.checkBoxSound_3->setChecked(settings.value("FileSend_Finished",false).toBool());
|
||||
ui.checkBoxSound_4->setChecked(settings.value("FileRecive_Incoming",false).toBool());
|
||||
ui.checkBoxSound_5->setChecked(settings.value("FileRecive_Finished",false).toBool());
|
||||
ui.checkBoxSound_6->setChecked(settings.value("NewChatMessage",false).toBool());
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
ui.checkBoxSound_3->setChecked(Settings->value("FileSend_Finished",false).toBool());
|
||||
ui.checkBoxSound_4->setChecked(Settings->value("FileRecive_Incoming",false).toBool());
|
||||
ui.checkBoxSound_5->setChecked(Settings->value("FileRecive_Finished",false).toBool());
|
||||
ui.checkBoxSound_6->setChecked(Settings->value("NewChatMessage",false).toBool());
|
||||
Settings->endGroup();
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void SoundPage::on_cmd_openFile()
|
||||
|
@ -64,6 +64,22 @@ RSettings::setValue(const QString &key, const QVariant &val)
|
||||
QSettings::setValue(key, val);
|
||||
}
|
||||
|
||||
QVariant RSettings::valueFromGroup(const QString &group, const QString &key, const QVariant &defaultVal)
|
||||
{
|
||||
beginGroup(group);
|
||||
QVariant val = value(key, defaultVal);
|
||||
endGroup();
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void RSettings::setValueToGroup(const QString &group, const QString &key, const QVariant &val)
|
||||
{
|
||||
beginGroup(group);
|
||||
setValue(key, val);
|
||||
endGroup();
|
||||
}
|
||||
|
||||
/** Sets the default setting for <b>key</b> to <b>val</b>. */
|
||||
void
|
||||
RSettings::setDefault(const QString &key, const QVariant &val)
|
||||
|
@ -54,6 +54,10 @@ public:
|
||||
/** Sets the value associated with <b>key</b> to <b>val</b>. */
|
||||
virtual void setValue(const QString &key, const QVariant &val);
|
||||
|
||||
virtual QVariant valueFromGroup(const QString &group, const QString &key,
|
||||
const QVariant &defaultVal = QVariant());
|
||||
virtual void setValueToGroup(const QString &group, const QString &key, const QVariant &val);
|
||||
|
||||
protected:
|
||||
/** Sets the default setting for <b>key</b> to <b>val</b>. */
|
||||
void setDefault(const QString &key, const QVariant &val);
|
||||
|
@ -69,8 +69,14 @@
|
||||
#define DEFAULT_BWGRAPH_FILTER (BWGRAPH_SEND|BWGRAPH_REC)
|
||||
#define DEFAULT_BWGRAPH_ALWAYS_ON_TOP false
|
||||
|
||||
RshareSettings::RshareSettings(std::string filename) : RSettings(filename) {
|
||||
initSettings();
|
||||
// the one and only global settings object
|
||||
RshareSettings *Settings = NULL;
|
||||
|
||||
/*static*/ void RshareSettings::Create ()
|
||||
{
|
||||
if (Settings == NULL) {
|
||||
Settings = new RshareSettings ();
|
||||
}
|
||||
}
|
||||
|
||||
/** Default Constructor */
|
||||
|
@ -48,13 +48,8 @@ class RshareSettings : public RSettings
|
||||
{
|
||||
|
||||
public:
|
||||
/** Default constructor. */
|
||||
RshareSettings();
|
||||
|
||||
/** Default constructor. */
|
||||
RshareSettings(std::string filename);
|
||||
|
||||
void initSettings();
|
||||
/* create settings object */
|
||||
static void Create ();
|
||||
|
||||
/** Gets the currently preferred language code for RShare. */
|
||||
QString getLanguageCode();
|
||||
@ -119,22 +114,27 @@ public:
|
||||
uint getNotifyFlags();
|
||||
void setNotifyFlags(uint flags);
|
||||
|
||||
//! Save placement, state and size information of a window.
|
||||
void saveWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Save placement, state and size information of a window.
|
||||
void saveWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Load placement, state and size information of a window.
|
||||
void loadWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Method overload. Save window and toolbar information.
|
||||
void saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
//! Load placement, state and size information of a window.
|
||||
void loadWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Method overload. Restore window and toolbar information.
|
||||
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
//! Method overload. Save window and toolbar information.
|
||||
void saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
|
||||
//! Method overload. Restore window and toolbar information.
|
||||
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
|
||||
protected:
|
||||
/** Default constructor. */
|
||||
RshareSettings();
|
||||
|
||||
void initSettings();
|
||||
};
|
||||
|
||||
// the one and only global settings object
|
||||
extern RshareSettings *Settings;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -68,15 +68,14 @@ void OnlineToaster::chatButtonSlot() {
|
||||
}
|
||||
|
||||
void OnlineToaster::play(){
|
||||
RshareSettings settings;
|
||||
settings.beginGroup("Sound");
|
||||
settings.beginGroup("SoundFilePath");
|
||||
QString OnlineSound= settings.value("User_go_Online","").toString();
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Enable");
|
||||
bool flag= settings.value("User_go_Online",false).toBool();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
Settings->beginGroup("Sound");
|
||||
Settings->beginGroup("SoundFilePath");
|
||||
QString OnlineSound = Settings->value("User_go_Online","").toString();
|
||||
Settings->endGroup();
|
||||
Settings->beginGroup("Enable");
|
||||
bool flag = Settings->value("User_go_Online",false).toBool();
|
||||
Settings->endGroup();
|
||||
Settings->endGroup();
|
||||
if(!OnlineSound.isEmpty()&&flag)
|
||||
if(QSound::isAvailable())
|
||||
QSound::play(OnlineSound);
|
||||
|
@ -61,8 +61,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
setWindowTitle(tr("RetroShare"));
|
||||
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
// Setting icons
|
||||
this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
@ -155,8 +154,7 @@ void ApplicationWindow::createActions()
|
||||
|
||||
void ApplicationWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
Settings->saveWidgetInformation(this);
|
||||
|
||||
hide();
|
||||
e->ignore();
|
||||
|
@ -43,9 +43,6 @@ StatisticDialog::StatisticDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Create Bandwidth Graph related QObjects */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
/* Bind events to actions */
|
||||
createActions();
|
||||
|
||||
@ -85,12 +82,6 @@ StatisticDialog::StatisticDialog(QWidget *parent)
|
||||
|
||||
}
|
||||
|
||||
/** Default destructor */
|
||||
StatisticDialog::~StatisticDialog()
|
||||
{
|
||||
delete _settings;
|
||||
}
|
||||
|
||||
/**
|
||||
Custom event handler. Checks if the event is a bandwidth update event. If it
|
||||
is, it will add the data point to the history and updates the graph.*/
|
||||
@ -182,7 +173,7 @@ StatisticDialog::loadSettings()
|
||||
|
||||
|
||||
/* Set the line filter checkboxes accordingly */
|
||||
uint filter = _settings->getBWGraphFilter();
|
||||
uint filter = Settings->getBWGraphFilter();
|
||||
ui.chkReceiveRate->setChecked(filter & BWGRAPH_REC);
|
||||
ui.chkSendRate->setChecked(filter & BWGRAPH_SEND);
|
||||
|
||||
@ -215,13 +206,13 @@ StatisticDialog::saveChanges()
|
||||
showSettingsFrame(false);
|
||||
|
||||
/* Save the opacity */
|
||||
_settings->setBWGraphOpacity(ui.sldrOpacity->value());
|
||||
Settings->setBWGraphOpacity(ui.sldrOpacity->value());
|
||||
|
||||
|
||||
|
||||
/* Save the line filter values */
|
||||
_settings->setBWGraphFilter(BWGRAPH_REC, ui.chkReceiveRate->isChecked());
|
||||
_settings->setBWGraphFilter(BWGRAPH_SEND, ui.chkSendRate->isChecked());
|
||||
Settings->setBWGraphFilter(BWGRAPH_REC, ui.chkReceiveRate->isChecked());
|
||||
Settings->setBWGraphFilter(BWGRAPH_SEND, ui.chkSendRate->isChecked());
|
||||
|
||||
/* Update the graph frame settings */
|
||||
ui.frmGraph->setShowCounters(ui.chkReceiveRate->isChecked(),
|
||||
|
@ -42,8 +42,7 @@ class StatisticDialog : public MainPage
|
||||
public:
|
||||
/** Default Constructor */
|
||||
StatisticDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~StatisticDialog();
|
||||
|
||||
protected:
|
||||
/** Called to deliver a bandwidth update event from RetroShare. */
|
||||
void customEvent(QEvent *event);
|
||||
|
@ -53,7 +53,10 @@ int main(int argc, char *argv[])
|
||||
/* RetroShare Core Objects */
|
||||
RsInit::InitRsConfig();
|
||||
bool okStart = RsInit::InitRetroShare(argc, argv);
|
||||
|
||||
|
||||
/* create global settings object */
|
||||
RshareSettings::Create ();
|
||||
|
||||
/*
|
||||
Function RsConfigMinimised is not available in SVN, so I commented it out.
|
||||
bool startMinimised = RsConfigStartMinimised(config);
|
||||
@ -163,9 +166,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
/* only show window, if not startMinimized */
|
||||
RshareSettings _settings;
|
||||
|
||||
if(!_settings.value(QString::fromUtf8("StartMinimized"), false).toBool())
|
||||
if(!Settings->value(QString::fromUtf8("StartMinimized"), false).toBool())
|
||||
{
|
||||
|
||||
w->show();
|
||||
@ -179,13 +180,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* dive into the endless loop */
|
||||
// return ret;
|
||||
int ti = rshare.exec();
|
||||
delete w ;
|
||||
int ti = rshare.exec();
|
||||
delete w ;
|
||||
|
||||
Settings->sync();
|
||||
delete Settings;
|
||||
|
||||
return ti ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -96,8 +96,7 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, QString dir)
|
||||
|
||||
/* Check if we're supposed to reset our config before proceeding. */
|
||||
if (_args.contains(ARG_RESET)) {
|
||||
RshareSettings settings;
|
||||
settings.reset();
|
||||
Settings->reset();
|
||||
}
|
||||
|
||||
/* Handle the -loglevel and -logfile options. */
|
||||
@ -314,8 +313,7 @@ Rshare::setLanguage(QString languageCode)
|
||||
{
|
||||
/* If the language code is empty, use the previously-saved setting */
|
||||
if (languageCode.isEmpty()) {
|
||||
RshareSettings settings;
|
||||
languageCode = settings.getLanguageCode();
|
||||
languageCode = Settings->getLanguageCode();
|
||||
}
|
||||
/* Translate into the desired langauge */
|
||||
if (LanguageSupport::translate(languageCode)) {
|
||||
@ -334,8 +332,7 @@ Rshare::setStyle(QString styleKey)
|
||||
{
|
||||
/* If no style was specified, use the previously-saved setting */
|
||||
if (styleKey.isEmpty()) {
|
||||
RshareSettings settings;
|
||||
styleKey = settings.getInterfaceStyle();
|
||||
styleKey = Settings->getInterfaceStyle();
|
||||
}
|
||||
/* Apply the specified GUI style */
|
||||
if (QApplication::setStyle(styleKey)) {
|
||||
@ -350,8 +347,7 @@ Rshare::setSheet(QString sheet)
|
||||
{
|
||||
/* If no stylesheet was specified, use the previously-saved setting */
|
||||
if (sheet.isEmpty()) {
|
||||
RshareSettings settings;
|
||||
sheet = settings.getSheetName();
|
||||
sheet = Settings->getSheetName();
|
||||
}
|
||||
/* Apply the specified GUI stylesheet */
|
||||
_stylesheet = sheet;
|
||||
|
Loading…
Reference in New Issue
Block a user