Vidalia  0.2.15
TorrcDialog.h
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file TorrcDialog.h
00013 ** \brief Torrc Dialog, contains the dialog for displaying and editing the torrc
00014 */
00015 
00016 #ifndef _TORRCDIALOG_H
00017 #define _TORRCDIALOG_H
00018 
00019 #include <QSyntaxHighlighter>
00020 
00021 class TorHighlighter : public QSyntaxHighlighter {
00022   public:
00023     /** Default constructor */
00024     TorHighlighter(QTextEdit *te) : QSyntaxHighlighter(te) {}
00025     /** Default deconstructor */
00026     ~TorHighlighter() {}
00027     /** Hightlights commented lines and gives some format to
00028      * the rest of the lines */
00029     void highlightBlock(const QString &text);
00030 };
00031 
00032 #include "ui_TorrcDialog.h"
00033 
00034 class TorControl;
00035 
00036 class TorrcDialog : public QDialog
00037 {
00038   Q_OBJECT
00039 
00040 public:
00041   /** Default constructor */
00042   TorrcDialog(QWidget *parent = 0);
00043   /** Destructor */
00044   ~TorrcDialog();
00045 
00046 private slots:
00047   /** Saves the settings specified to the torrc file
00048     * through the SAVECONF control */
00049   void saveTorrc();
00050 
00051 private:
00052   /** Loads the contents of the torrc file that Tor has loaded */
00053   void loadTorrc();
00054   /** Parses the options edited and sets them through SETCONF 
00055     * if they pass the parsing stage */
00056   bool parseAndSet(QString *errmsg = 0);
00057   
00058   Ui::TorrcDialog ui; /**< Qt Designer generated object. */
00059   /** TorControl object to comunicate with Tor */
00060   TorControl *tc;
00061   
00062 };
00063 
00064 #endif // _TORRCDIALOG_H