summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn <bjorn@horst-dieter.(none)>2009-04-12 19:04:20 +0200
committerBjørn <bjorn@horst-dieter.(none)>2009-04-12 19:06:38 +0200
commit9f5b89189f00c959882f86067634a512e6970614 (patch)
tree8964803d49528d35585f1fb26f8f22e3c7353a52
parenta6998fbdfaf84aa1920564d97e3421ed28c9a893 (diff)
downloadmana-9f5b89189f00c959882f86067634a512e6970614.tar.gz
mana-9f5b89189f00c959882f86067634a512e6970614.tar.bz2
mana-9f5b89189f00c959882f86067634a512e6970614.tar.xz
mana-9f5b89189f00c959882f86067634a512e6970614.zip
Moved client version string creation to preprocessor
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/widgets/container.cpp5
-rw-r--r--src/gui/widgets/container.h11
-rw-r--r--src/gui/widgets/desktop.cpp5
-rw-r--r--src/gui/widgets/desktop.h9
-rw-r--r--src/main.cpp27
-rw-r--r--src/main.h16
7 files changed, 34 insertions, 41 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index b2474ead..6e5e7809 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -104,7 +104,7 @@ Setup::Setup():
add(panel);
- Label *version = new Label(Main::version);
+ Label *version = new Label(FULL_VERSION);
version->setPosition(5, height - version->getHeight() - 5);
add(version);
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index 10ef78a5..70731730 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -21,6 +21,11 @@
#include "gui/widgets/container.h"
+Container::Container()
+{
+ setOpaque(false);
+}
+
Container::~Container()
{
while (!mWidgets.empty())
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index a6d1610e..dd286609 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -25,13 +25,18 @@
#include <guichan/widgets/container.hpp>
/**
- * A widget container. The only difference between the standard Guichan
- * container and this one is that childs added to this container are
- * automatically deleted when the container is deleted.
+ * A widget container.
+ *
+ * The main difference between the standard Guichan container and this one is
+ * that childs added to this container are automatically deleted when the
+ * container is deleted.
+ *
+ * This container is also non-opaque by default.
*/
class Container : public gcn::Container
{
public:
+ Container();
~Container();
};
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 4b806095..a4164bcc 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -39,7 +39,7 @@ Desktop::Desktop()
Wallpaper::loadWallpapers();
- versionLabel = new Label(Main::version);
+ gcn::Label *versionLabel = new Label(FULL_VERSION);
add(versionLabel, 25, 2);
}
@@ -47,7 +47,6 @@ Desktop::~Desktop()
{
if (mWallpaper)
mWallpaper->decRef();
- delete versionLabel;
}
void Desktop::reloadWallpaper()
@@ -80,7 +79,7 @@ void Desktop::draw(gcn::Graphics *graphics)
(getHeight() - mWallpaper->getHeight()) / 2);
}
- drawChildren(graphics);
+ Container::draw(graphics);
}
void Desktop::setBestFittingWallpaper()
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index 7eabde54..ad04ee96 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -22,11 +22,11 @@
#ifndef DESKTOP_H
#define DESKTOP_H
-#include <guichan/widgets/container.hpp>
+#include "gui/widgets/container.h"
+
#include <guichan/widgetlistener.hpp>
class Image;
-class Label;
/**
* Desktop widget, for drawing a background image and color.
@@ -37,9 +37,11 @@ class Label;
* When the desktop widget is resized, the background image is automatically
* updated.
*
+ * The desktop also displays the client version in the top-right corner.
+ *
* \ingroup GUI
*/
-class Desktop : public gcn::Container, gcn::WidgetListener
+class Desktop : public Container, gcn::WidgetListener
{
public:
Desktop();
@@ -58,7 +60,6 @@ class Desktop : public gcn::Container, gcn::WidgetListener
void setBestFittingWallpaper();
Image *mWallpaper;
- Label *versionLabel;
};
#endif // DESKTOP_H
diff --git a/src/main.cpp b/src/main.cpp
index a42e8b82..667e7456 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -164,20 +164,6 @@ Graphics *graphics;
unsigned char state;
std::string errorMessage;
-namespace Main {
-#ifdef PACKAGE_VERSION
-#ifdef TMWSERV_SUPPORT
-const std::string version = strprintf("v%s (tmwserv)", PACKAGE_VERSION);
-#else
-const std::string version = strprintf("v%s (eAthena)", PACKAGE_VERSION);
-#endif
-#else
-const std::string version = _("Unknown Version");
-#endif
-}
-
-Desktop *desktop;
-
Sound sound;
Music *bgm;
@@ -593,12 +579,7 @@ static void printHelp()
static void printVersion()
{
-#ifdef PACKAGE_VERSION
- std::cout << _("The Mana World version ") << Main::version << std::endl;
-#else
- std::cout << _("The Mana World version ") << Main::version <<
- _("(local build?)") << std::endl;
-#endif
+ std::cout << _("The Mana World ") << FULL_VERSION << std::endl;
}
static void parseOptions(int argc, char *argv[], Options &options)
@@ -910,7 +891,7 @@ int main(int argc, char *argv[])
logger->setLogFile(homeDir + std::string("/tmw.log"));
// Log the tmw version
- logger->log("The Mana World %s", Main::version.c_str());
+ logger->log("The Mana World %s", FULL_VERSION);
initConfiguration(options);
logger->setLogToStandardOut(config.getValue("logToStandardOut", 0));
@@ -928,7 +909,7 @@ int main(int argc, char *argv[])
setupWindow = new Setup;
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
- desktop = new Desktop;
+ Desktop *desktop = new Desktop;
top->add(desktop);
ProgressBar *progressBar = new ProgressBar(0.0f, 100, 20, 168, 116, 31);
gcn::Label *progressLabel = new Label;
@@ -1563,8 +1544,6 @@ int main(int argc, char *argv[])
}
delete guiPalette;
- top->remove(desktop);
- delete desktop;
logger->log("Quitting");
exitEngine();
diff --git a/src/main.h b/src/main.h
index 95f779eb..49a034f5 100644
--- a/src/main.h
+++ b/src/main.h
@@ -61,6 +61,16 @@
#define PACKAGE_VERSION "0.0.29"
#endif
+#ifdef PACKAGE_VERSION
+#ifdef TMWSERV_SUPPORT
+#define FULL_VERSION "v" PACKAGE_VERSION " (tmwserv)"
+#else
+#define FULL_VERSION "v" PACKAGE_VERSION " (eAthena)"
+#endif
+#else
+#define FULL_VERSION "Unknown Version"
+#endif
+
#ifndef PKG_DATADIR
#define PKG_DATADIR ""
#endif
@@ -128,10 +138,4 @@ extern char n_server, n_character;
extern unsigned char state;
extern std::string errorMessage;
-namespace Main {
-
-extern const std::string version;
-
-}
-
#endif