summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-15 00:50:47 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-15 00:50:47 +0300
commit255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3 (patch)
tree1849456d254f60d20b60e54e51df4f354106aa1a /src
parentb6dae23ca33ee0032260080819a59ec6363f72f6 (diff)
downloadmv-255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3.tar.gz
mv-255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3.tar.bz2
mv-255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3.tar.xz
mv-255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3.zip
Add buttons Themes, Video, Perfomance in select server screen.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp64
-rw-r--r--src/client.h3
-rw-r--r--src/gui/setup.cpp22
-rw-r--r--src/gui/setup.h2
-rw-r--r--src/gui/widgets/tabbedarea.cpp13
-rw-r--r--src/gui/widgets/tabbedarea.h2
6 files changed, 98 insertions, 8 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 47d0e9a21..608bb5c8b 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -247,6 +247,9 @@ Client::Client(const Options &options):
mQuitDialog(0),
mDesktop(0),
mSetupButton(0),
+ mVideoButton(0),
+ mThemesButton(0),
+ mPerfomanceButton(0),
mState(STATE_CHOOSE_SERVER),
mOldState(STATE_START),
mIcon(0),
@@ -828,11 +831,28 @@ int Client::exec()
mDesktop = new Desktop;
top->add(mDesktop);
+ int x = top->getWidth();
mSetupButton = new Button(_("Setup"), "Setup", this);
- mSetupButton->setPosition(top->getWidth()
- - mSetupButton->getWidth() - 3, 3);
+ x -= mSetupButton->getWidth() + 3;
+ mSetupButton->setPosition(x, 3);
top->add(mSetupButton);
+ mPerfomanceButton = new Button(
+ _("Perfomance"), "Perfomance", this);
+ x -= mPerfomanceButton->getWidth() + 6;
+ mPerfomanceButton->setPosition(x, 3);
+ top->add(mPerfomanceButton);
+
+ mVideoButton = new Button(_("Video"), "Video", this);
+ x -= mVideoButton->getWidth() + 6;
+ mVideoButton->setPosition(x, 3);
+ top->add(mVideoButton);
+
+ mThemesButton = new Button(_("Themes"), "Themes", this);
+ x -= mThemesButton->getWidth() + 6;
+ mThemesButton->setPosition(x, 3);
+ top->add(mThemesButton);
+
int screenWidth = config.getIntValue("screenwidth");
int screenHeight = config.getIntValue("screenheight");
@@ -1138,6 +1158,12 @@ int Client::exec()
delete mSetupButton;
mSetupButton = 0;
+ delete mVideoButton;
+ mVideoButton = 0;
+ delete mThemesButton;
+ mThemesButton = 0;
+ delete mPerfomanceButton;
+ mPerfomanceButton = 0;
delete mDesktop;
mDesktop = 0;
@@ -1329,16 +1355,38 @@ void Client::optionChanged(const std::string &name)
void Client::action(const gcn::ActionEvent &event)
{
- Window *window = 0;
+ bool show(false);
+ std::string tab = "";
if (event.getId() == "Setup")
- window = setupWindow;
+ {
+ show = true;
+ }
+ else if (event.getId() == "Video")
+ {
+ show = true;
+ tab = "Video";
+ }
+ else if (event.getId() == "Themes")
+ {
+ show = true;
+ tab = "Theme";
+ }
+ else if (event.getId() == "Perfomance")
+ {
+ show = true;
+ tab = "Perfomance";
+ }
- if (window)
+ if (setupWindow)
{
- window->setVisible(!window->isVisible());
- if (window->isVisible())
- window->requestMoveToTop();
+ setupWindow->setVisible(!setupWindow->isVisible());
+ if (setupWindow->isVisible())
+ {
+ if (!tab.empty())
+ setupWindow->activateTab(tab);
+ setupWindow->requestMoveToTop();
+ }
}
}
diff --git a/src/client.h b/src/client.h
index 4409cf8db..08bc1ecbf 100644
--- a/src/client.h
+++ b/src/client.h
@@ -317,6 +317,9 @@ private:
QuitDialog *mQuitDialog;
Desktop *mDesktop;
Button *mSetupButton;
+ Button *mVideoButton;
+ Button *mThemesButton;
+ Button *mPerfomanceButton;
State mState;
State mOldState;
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 33f379743..ae7a3109c 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -198,4 +198,26 @@ void Setup::doCancel()
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel));
}
+void Setup::activateTab(const std::string &name)
+{
+ std::string tmp = gettext(name.c_str());
+ mPanel->setSelectedTab(tmp);
+/*
+ for (std::list<SetupTab*>::const_iterator it = mTabs.begin();
+ it != mTabs.end(); ++it)
+ {
+ if (*it)
+ {
+ SetupTab *tab = *it;
+ logger->log("check tab: " + tab->getName());
+ if (tab->getName() == tmp)
+ {
+ mPanel->setSelectedTab(name);
+ return;
+ }
+ }
+ }
+*/
+}
+
Setup *setupWindow;
diff --git a/src/gui/setup.h b/src/gui/setup.h
index cdaf7db99..b499da4ee 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -73,6 +73,8 @@ class Setup : public Window, public gcn::ActionListener
void doCancel();
+ void activateTab(const std::string &name);
+
private:
std::list<SetupTab*> mTabs;
std::list<Window*> mWindowsToReset;
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 940dad12a..47b02c925 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -241,6 +241,19 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab)
widgetResized(NULL);
}
+void TabbedArea::setSelectedTab(const std::string &name)
+{
+ for (TabContainer::const_iterator itr = mTabs.begin(),
+ itr_end = mTabs.end(); itr != itr_end; ++itr)
+ {
+ if ((*itr).first && (*itr).first->getCaption() == name)
+ {
+ setSelectedTab((*itr).first);
+ return;
+ }
+ }
+}
+
void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
{
int width = getWidth() - 2 * getFrameSize()
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index a91b4c199..3ad113b4c 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -122,6 +122,8 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
void setSelectedTab(gcn::Tab *tab);
+ void setSelectedTab(const std::string &name);
+
void widgetResized(const gcn::Event &event);
/*