[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2377: vidalia.h missed the boat when we moved to CMake. Now we pro (in vidalia/trunk: . src/vidalia)



Author: edmanm
Date: 2008-03-01 20:21:07 -0500 (Sat, 01 Mar 2008)
New Revision: 2377

Added:
   vidalia/trunk/src/vidalia/vidalia.h.in
Removed:
   vidalia/trunk/src/vidalia/vidalia.h
Modified:
   vidalia/trunk/
   vidalia/trunk/CHANGELOG
   vidalia/trunk/src/vidalia/CMakeLists.txt
Log:
 r166@lysithea:  edmanm | 2008-03-01 20:19:34 -0500
 vidalia.h missed the boat when we moved to CMake. Now we properly configure
 the version number in it, instead of leaving that value hardcoded.



Property changes on: vidalia/trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r166] on 90112fd6-a33b-4cea-8d39-48ff1d78625c

Modified: vidalia/trunk/CHANGELOG
===================================================================
--- vidalia/trunk/CHANGELOG	2008-03-02 01:14:55 UTC (rev 2376)
+++ vidalia/trunk/CHANGELOG	2008-03-02 01:21:07 UTC (rev 2377)
@@ -1,3 +1,8 @@
+0.1.1   xx-xxx-2008
+  o Use CMake to configure the version number that ends up getting displayed
+    in the About box.
+
+
 0.1.0   01-Mar-2008
   o Migrate to CMake as our build system, instead of the previous mix of
     autoconf and qmake. See the updated INSTALL file for more information.

Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt	2008-03-02 01:14:55 UTC (rev 2376)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt	2008-03-02 01:21:07 UTC (rev 2377)
@@ -18,6 +18,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/help/browser
 )
 configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/vidalia.h.in
+  ${CMAKE_CURRENT_SOURCE_DIR}/vidalia.h
+)
+configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc.in
   ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc
 )

Deleted: vidalia/trunk/src/vidalia/vidalia.h

Added: vidalia/trunk/src/vidalia/vidalia.h.in
===================================================================
--- vidalia/trunk/src/vidalia/vidalia.h.in	                        (rev 0)
+++ vidalia/trunk/src/vidalia/vidalia.h.in	2008-03-02 01:21:07 UTC (rev 2377)
@@ -0,0 +1,138 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+/*
+** \file vidalia.h
+** \version $Id$
+** \brief Main Vidalia QApplication object
+*/
+
+#ifndef _VIDALIA_H
+#define _VIDALIA_H
+
+#if defined(Q_OS_WIN)
+#include <windows.h>
+#include <win32.h>
+#endif
+
+#include <QApplication>
+#include <QMap>
+#include <QString>
+#include <QKeySequence>
+
+#include <log.h>
+#include <vidaliasettings.h>
+#include <torcontrol.h>
+
+/** Vidalia's version string */
+#define VIDALIA_VERSION    "@VERSION@"
+
+/** Pointer to this Vidalia application instance. */
+#define vApp  ((Vidalia *)qApp)
+
+#define vDebug(fmt)   (vApp->log(Log::Debug, (fmt)))
+#define vInfo(fmt)    (vApp->log(Log::Info, (fmt)))
+#define vNotice(fmt)  (vApp->log(Log::Notice, (fmt)))
+#define vWarn(fmt)    (vApp->log(Log::Warn, (fmt)))
+#define vError(fmt)   (vApp->log(Log::Error, (fmt)))
+
+
+class Vidalia : public QApplication
+{
+  Q_OBJECT
+
+public:
+  /** Constructor. */
+  Vidalia(QStringList args, int &argc, char **argv);
+  /** Destructor. */
+  ~Vidalia();
+
+  /** Return the map of command-line arguments and values. */
+  static QMap<QString, QString> arguments() { return _args; }
+  /** Validates that all arguments were well-formed. */
+  static bool validateArguments(QString &errmsg);
+  /** Displays usage information for command-line args. */
+  static void showUsageMessageBox();
+  /** Returns true if the user wants to see usage information. */
+  static bool showUsage();
+  
+  /** Sets the current language. */
+  static bool setLanguage(QString languageCode = QString());
+  /** Sets the current GUI style. */
+  static bool setStyle(QString styleKey = QString());
+  
+  /** Returns the current language. */
+  static QString language() { return _language; }
+  /** Returns the current GUI style. */
+  static QString style() { return _style; }
+  /** Returns Vidalia's application version. */
+  static QString version() { return VIDALIA_VERSION; }
+
+  /** Returns Vidalia's main TorControl object. */
+  static TorControl* torControl() { return _torControl; }
+  
+  /** Returns the location Vidalia uses for its data files. */
+  static QString dataDirectory();
+  /** Returns the default location of Vidalia's data directory. */
+  static QString defaultDataDirectory();
+  
+  /** Returns the location of Vidalia's pid file. */
+  static QString pidFile();
+
+  /** Writes <b>msg</b> with severity <b>level</b> to Vidalia's log. */
+  static Log::LogMessage log(Log::LogLevel level, QString msg);
+ 
+  /** Enters the main event loop and waits until exit() is called. The signal
+   * running() will be emitted when the event loop has started. */
+  static int run();
+
+  /** Creates and binds a shortcut such that when <b>key</b> is pressed in
+   * <b>sender</b>'s context, <b>receiver</b>'s <b>slot</b> will be called. */
+  static void createShortcut(const QKeySequence &key, QWidget *sender,
+                             QWidget *receiver, const char *slot);
+
+signals:
+  /** Emitted when the application is running and the main event loop has
+   * started. */ 
+  void running();
+  /** Signals that the application needs to shutdown now. */
+  void shutdown();
+
+protected:
+#if defined(Q_OS_WIN)
+  /** Filters Windows events, looking for events of interest */
+  bool winEventFilter(MSG *msg, long *result);
+#endif
+
+private slots:
+  /** Called when the application's main event loop has started. This method
+   * will emit the running() signal to indicate that the application's event
+   * loop is running. */
+  void onEventLoopStarted();
+  
+private:
+  /** Catches debugging messages from Qt and sends them to 
+   * Vidalia's logs. */
+  static void qt_msg_handler(QtMsgType type, const char *msg);
+
+  /** Parse the list of command-line arguments. */
+  void parseArguments(QStringList args);
+  /** Returns true if the specified arguments wants a value. */
+  bool argNeedsValue(QString argName);
+
+  static QMap<QString, QString> _args; /**< List of command-line arguments.  */
+  static QString _style;               /**< The current GUI style.           */
+  static QString _language;            /**< The current language.            */
+  static TorControl* _torControl;      /**< Vidalia's main TorControl object.*/
+  static Log _log; /**< Logs debugging messages to file or stdout. */
+};
+
+#endif
+


Property changes on: vidalia/trunk/src/vidalia/vidalia.h.in
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native