From c097592c3f05168499603901a19479cb07fc6cc1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 Feb 2012 19:36:11 +0300 Subject: Add visual page in settings. Move pickup particle settings to visual tab page. --- src/CMakeLists.txt | 2 ++ src/Makefile.am | 2 ++ src/gui/setup.cpp | 2 ++ src/gui/setup_video.cpp | 43 ++++++-------------------------- src/gui/setup_video.h | 6 ----- src/gui/setup_visual.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ src/gui/setup_visual.h | 40 ++++++++++++++++++++++++++++++ 7 files changed, 118 insertions(+), 41 deletions(-) create mode 100644 src/gui/setup_visual.cpp create mode 100644 src/gui/setup_visual.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3289aed66..982d9b5ca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -327,6 +327,8 @@ SET(SRCS gui/setup_players.h gui/setup_video.cpp gui/setup_video.h + gui/setup_visual.cpp + gui/setup_visual.h gui/sdlfont.cpp gui/sdlfont.h gui/shopwindow.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 3fad9f3ce..5b40ac447 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -330,6 +330,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/setup_relations.h \ gui/setup_video.cpp \ gui/setup_video.h \ + gui/setup_visual.cpp \ + gui/setup_visual.h \ gui/sdlfont.cpp \ gui/sdlfont.h \ gui/shopwindow.cpp \ diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 3408fba33..c7908a6ac 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -38,6 +38,7 @@ #include "gui/setup_players.h" #include "gui/setup_relations.h" #include "gui/setup_video.h" +#include "gui/setup_visual.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" @@ -92,6 +93,7 @@ Setup::Setup(): mPanel->enableScrollButtons(true); mTabs.push_back(new Setup_Video); + mTabs.push_back(new Setup_Visual); mTabs.push_back(new Setup_Audio); mTabs.push_back(new Setup_Perfomance); mTabs.push_back(new Setup_Joystick); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index cc3063a68..31060dcfd 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -275,8 +275,6 @@ Setup_Video::Setup_Video(): mOpenGLEnabled(config.getIntValue("opengl")), mCustomCursorEnabled(config.getBoolValue("customcursor")), mParticleEffectsEnabled(config.getBoolValue("particleeffects")), - mPickupChatEnabled(config.getBoolValue("showpickupchat")), - mPickupParticleEnabled(config.getBoolValue("showpickupparticle")), mOpacity(config.getFloatValue("guialpha")), mFps(config.getIntValue("fpslimit")), mAltFps(config.getIntValue("altfpslimit")), @@ -291,12 +289,6 @@ Setup_Video::Setup_Video(): mCustomCursorEnabled)), mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)), - mPickupNotifyLabel(new Label(_("Show pickup notification"))), - // TRANSLATORS: Refers to "Show own name" - mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), - // TRANSLATORS: Refers to "Show own name" - mPickupParticleCheckBox(new CheckBox(_("as particle"), - mPickupParticleEnabled)), mEnableResizeCheckBox(new CheckBox(_("Enable resize"), mEnableResize)), mNoFrameCheckBox(new CheckBox(_("No frame"), mNoFrame)), mSpeechSlider(new Slider(0, 3)), @@ -358,8 +350,6 @@ Setup_Video::Setup_Video(): mModeList->setActionEventId("videomode"); mCustomCursorCheckBox->setActionEventId("customcursor"); mParticleEffectsCheckBox->setActionEventId("particleeffects"); - mPickupChatCheckBox->setActionEventId("pickupchat"); - mPickupParticleCheckBox->setActionEventId("pickupparticle"); mAlphaSlider->setActionEventId("guialpha"); mFpsCheckBox->setActionEventId("fpslimitcheckbox"); mSpeechSlider->setActionEventId("speech"); @@ -376,8 +366,6 @@ Setup_Video::Setup_Video(): mModeList->addActionListener(this); mCustomCursorCheckBox->addActionListener(this); mParticleEffectsCheckBox->addActionListener(this); - mPickupChatCheckBox->addActionListener(this); - mPickupParticleCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); mFpsCheckBox->addActionListener(this); mSpeechSlider->addActionListener(this); @@ -407,8 +395,6 @@ Setup_Video::Setup_Video(): place(0, 0, scrollArea, 1, 6).setPadding(2); place(0, 6, mOpenGLDropDown, 1); -// place(0, 6, mHwAccelCheckBox, 6); - place(1, 0, mFsCheckBox, 2); place(1, 1, mCustomCursorCheckBox, 3); @@ -416,11 +402,9 @@ Setup_Video::Setup_Video(): place(1, 2, mEnableResizeCheckBox, 2); place(1, 3, mNoFrameCheckBox, 2); - place(1, 4, mParticleEffectsCheckBox, 2); - - place(1, 5, mPickupNotifyLabel, 4); - place(1, 6, mPickupChatCheckBox, 1); - place(2, 6, mPickupParticleCheckBox, 2); +// place(1, 5, mPickupNotifyLabel, 4); +// place(1, 6, mPickupChatCheckBox, 1); +// place(2, 6, mPickupParticleCheckBox, 2); place(0, 7, mAlphaSlider); place(1, 7, alphaLabel, 3); @@ -440,9 +424,11 @@ Setup_Video::Setup_Video(): place(1, 12, overlayDetailLabel); place(2, 12, mOverlayDetailField, 3).setPadding(2); - place(0, 13, mParticleDetailSlider); - place(1, 13, particleDetailLabel); - place(2, 13, mParticleDetailField, 3).setPadding(2); + place(0, 13, mParticleEffectsCheckBox, 5); + + place(0, 14, mParticleDetailSlider); + place(1, 14, particleDetailLabel); + place(2, 14, mParticleDetailField, 3).setPadding(2); int width = 600; @@ -547,8 +533,6 @@ void Setup_Video::apply() mOpacity = config.getFloatValue("guialpha"); mOverlayDetail = config.getIntValue("OverlayDetail"); mOpenGLEnabled = config.getIntValue("opengl"); - mPickupChatEnabled = config.getBoolValue("showpickupchat"); - mPickupParticleEnabled = config.getBoolValue("showpickupparticle"); mEnableResize = config.getBoolValue("enableresize"); mNoFrame = config.getBoolValue("noframe"); } @@ -589,8 +573,6 @@ void Setup_Video::cancel() config.setValue("guialpha", mOpacity); Image::setEnableAlpha(mOpacity != 1.0f); config.setValue("opengl", mOpenGLEnabled); - config.setValue("showpickupchat", mPickupChatEnabled); - config.setValue("showpickupparticle", mPickupParticleEnabled); config.setValue("enableresize", mEnableResize); config.setValue("noframe", mNoFrame); } @@ -674,15 +656,6 @@ void Setup_Video::action(const gcn::ActionEvent &event) _("Changes will take effect on map change.")); } } - else if (id == "pickupchat") - { - config.setValue("showpickupchat", mPickupChatCheckBox->isSelected()); - } - else if (id == "pickupparticle") - { - config.setValue("showpickupparticle", - mPickupParticleCheckBox->isSelected()); - } else if (id == "speech") { Being::Speech val = static_cast( diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 31d45d93d..ad6ca12d7 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -57,8 +57,6 @@ class Setup_Video : public SetupTab, public gcn::KeyListener int mOpenGLEnabled; bool mCustomCursorEnabled; bool mParticleEffectsEnabled; - bool mPickupChatEnabled; - bool mPickupParticleEnabled; float mOpacity; int mFps; int mAltFps; @@ -83,10 +81,6 @@ class Setup_Video : public SetupTab, public gcn::KeyListener gcn::CheckBox *mCustomCursorCheckBox; gcn::CheckBox *mParticleEffectsCheckBox; - gcn::Label *mPickupNotifyLabel; - gcn::CheckBox *mPickupChatCheckBox; - gcn::CheckBox *mPickupParticleCheckBox; - gcn::CheckBox *mEnableResizeCheckBox; gcn::CheckBox *mNoFrameCheckBox; diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp new file mode 100644 index 000000000..6df2dbf82 --- /dev/null +++ b/src/gui/setup_visual.cpp @@ -0,0 +1,64 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "gui/setup_visual.h" + +#include "gui/chatwindow.h" + +#include "gui/widgets/button.h" +#include "gui/widgets/chattab.h" +#include "gui/widgets/checkbox.h" +#include "gui/widgets/label.h" +#include "gui/widgets/layouthelper.h" +#include "gui/widgets/scrollarea.h" +#include "gui/widgets/setupitem.h" + +#include "configuration.h" +#include "localplayer.h" +#include "logger.h" + +#include "utils/gettext.h" + +#include "debug.h" + +Setup_Visual::Setup_Visual() +{ + setName(_("Visual")); + + // Do the layout + LayoutHelper h(this); + ContainerPlacer place = h.getPlacer(0, 0); + place(0, 0, mScroll, 10, 10); + + new SetupItemCheckBox(_("Show pickup notifications in chat"), "", + "showpickupchat", this, "showpickupchatEvent"); + + new SetupItemCheckBox(_("Show pickup notifications as particle effects"), + "", "showpickupparticle", this, "showpickupparticleEvent"); + + setDimension(gcn::Rectangle(0, 0, 550, 350)); +} + +void Setup_Visual::apply() +{ + SetupTabScroll::apply(); +} diff --git a/src/gui/setup_visual.h b/src/gui/setup_visual.h new file mode 100644 index 000000000..f5001b9e4 --- /dev/null +++ b/src/gui/setup_visual.h @@ -0,0 +1,40 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef GUI_SETUP_VISUAL_H +#define GUI_SETUP_VISUAL_H + +#include "guichanfwd.h" + +#include "gui/widgets/setuptabscroll.h" + +#include + +class Setup_Visual : public SetupTabScroll +{ + public: + Setup_Visual(); + + void apply(); +}; + +#endif -- cgit v1.2.3-60-g2f50