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

[vidalia-svn] r2445: Don't bother configuring vidalia.h. We'll just put the versi (in vidalia/trunk: . src/vidalia)



Author: edmanm
Date: 2008-03-23 00:33:22 -0400 (Sun, 23 Mar 2008)
New Revision: 2445

Added:
   vidalia/trunk/src/vidalia/vidalia.h
Modified:
   vidalia/trunk/
   vidalia/trunk/config.h.in
   vidalia/trunk/src/vidalia/CMakeLists.txt
Log:
 r259@lysithea:  edmanm | 2008-03-23 00:33:18 -0400
 Don't bother configuring vidalia.h. We'll just put the version in config.h and
 include that instead.



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

Modified: vidalia/trunk/config.h.in
===================================================================
--- vidalia/trunk/config.h.in	2008-03-23 04:23:08 UTC (rev 2444)
+++ vidalia/trunk/config.h.in	2008-03-23 04:33:22 UTC (rev 2445)
@@ -1,4 +1,20 @@
+##
+##  $Id: $
+## 
+##  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.
+##
 
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define VIDALIA_VERSION    "@VERSION@"
+
 #cmakedefine HAVE_QSSLSOCKET_H
 
 #cmakedefine USE_QSSLSOCKET
@@ -9,3 +25,5 @@
 
 #cmakedefine SIZEOF_INT @SIZEOF_INT@
 
+#endif
+

Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt	2008-03-23 04:23:08 UTC (rev 2444)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt	2008-03-23 04:33:22 UTC (rev 2445)
@@ -18,10 +18,6 @@
   ${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
 )

Added: vidalia/trunk/src/vidalia/vidalia.h
===================================================================
--- vidalia/trunk/src/vidalia/vidalia.h	                        (rev 0)
+++ vidalia/trunk/src/vidalia/vidalia.h	2008-03-23 04:33:22 UTC (rev 2445)
@@ -0,0 +1,137 @@
+/*
+**  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>
+
+#include "config.h"
+
+/** 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
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native