diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index d2d9c7722..4779cbc82 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -78,6 +78,7 @@ #include "statusbar/dhtstatus.h" #include "statusbar/hashingstatus.h" #include "statusbar/discstatus.h" +#include "statusbar/OpModeStatus.h" #include "statusbar/SoundStatus.h" #include @@ -358,6 +359,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); + statusBar()->addPermanentWidget(new OpModeStatus()); + statusBar()->addPermanentWidget(new SoundStatus()); /** Status Bar end ******/ diff --git a/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp b/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp new file mode 100644 index 000000000..ebe226d2a --- /dev/null +++ b/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp @@ -0,0 +1,78 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 RetroShare Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + +#include +#include + +#include "gui/statusbar/OpModeStatus.h" +#include +#include + +OpModeStatus::OpModeStatus(QWidget *parent) + : QComboBox(parent) +{ + /* add the options */ + addItem(tr("Normal Mode"), RS_OPMODE_FULL); + addItem(tr("No Anon D/L"), RS_OPMODE_NOTURTLE); + addItem(tr("Gaming Mode"), RS_OPMODE_GAMING); + addItem(tr("Low Traffic"), RS_OPMODE_MINIMAL); + + connect(this, SIGNAL(activated( int )), this, SLOT(setOpMode())); +} + + +void OpModeStatus::getOpMode() +{ + int opMode = rsConfig->getOperatingMode(); + switch(opMode) + { + default: + case RS_OPMODE_FULL: + setCurrentIndex(0); + break; + case RS_OPMODE_NOTURTLE: + setCurrentIndex(1); + break; + case RS_OPMODE_GAMING: + setCurrentIndex(2); + break; + case RS_OPMODE_MINIMAL: + setCurrentIndex(3); + break; + } +} + +void OpModeStatus::setOpMode() +{ + std::cerr << "OpModeStatus::setOpMode()"; + std::cerr << std::endl; + + int idx = currentIndex(); + QVariant var = itemData(idx); + uint32_t opMode = var.toUInt(); + + rsConfig->setOperatingMode(opMode); + + // reload to be safe. + getOpMode(); +} + + diff --git a/retroshare-gui/src/gui/statusbar/OpModeStatus.h b/retroshare-gui/src/gui/statusbar/OpModeStatus.h new file mode 100644 index 000000000..6e84aea3a --- /dev/null +++ b/retroshare-gui/src/gui/statusbar/OpModeStatus.h @@ -0,0 +1,41 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 RetroShare Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ +#ifndef OP_MODE_STATUS_H +#define OP_MODE_STATUS_H + +#include + +class OpModeStatus : public QComboBox +{ + Q_OBJECT + +public: + OpModeStatus(QWidget *parent = 0); + +private slots: + void setOpMode(); + +private: + void getOpMode(); + +}; + +#endif diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index a3595a3fe..06d1aa15d 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -395,6 +395,7 @@ HEADERS += rshare.h \ gui/statusbar/hashingstatus.h \ gui/statusbar/discstatus.h \ gui/statusbar/SoundStatus.h \ + gui/statusbar/OpModeStatus.h \ gui/advsearch/advancedsearchdialog.h \ gui/advsearch/expressionwidget.h \ gui/advsearch/guiexprelement.h \ @@ -679,6 +680,7 @@ SOURCES += main.cpp \ gui/statusbar/hashingstatus.cpp \ gui/statusbar/discstatus.cpp \ gui/statusbar/SoundStatus.cpp \ + gui/statusbar/OpModeStatus.cpp \ gui/toaster/MessageToaster.cpp \ gui/toaster/DownloadToaster.cpp \ gui/toaster/OnlineToaster.cpp \