Commit 773c094b authored by Justin Hipple's avatar Justin Hipple
Browse files

Each config page is now it's own seperate widget. Added an icon we might want...

Each config page is now it's own seperate widget. Added an icon we might want to use for the "Language/Style" page. This took me way longer than it should have.

svn:r526
parent eb8c0837
Loading
Loading
Loading
Loading
+76 −0
Changes for src/gui/config/advancedpage.cpp: 76 added lines, 0 removed lines.
Original line number Diff line number Diff line
/****************************************************************
 *  Vidalia is distributed under the following license:
 *
 *  Copyright (C) 2006,  Matt Edman, Justin Hipple
 *
 *  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 (at your option) 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., 51 Franklin Street, Fifth Floor, 
 *  Boston, MA  02110-1301, USA.
 ****************************************************************/

/** 
 * \file advancedpage.cpp
 * \version $Id$
 */
 
#include "advancedpage.h"

/** Constructor */
AdvancedPage::AdvancedPage(QWidget *parent)
: QWidget(parent)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  /* Bind event to actions */
  connect(ui.btnBrowseTorConfig, SIGNAL(clicked()), this, SLOT(browseTorConfig()));

  /* Hide platform specific features */
#ifdef Q_WS_WIN
  ui.grpPermissions->setVisible(false);
#endif
}

/* Saves all settings for this page */
void
AdvancedPage::saveChanges(TorSettings* torSettings)
{
  torSettings->setControlPort(ui.lineControlPort->text().toUShort());
  torSettings->setTorrc(ui.lineTorConfig->text());
  torSettings->setUser(ui.lineUser->text());
  torSettings->setGroup(ui.lineGroup->text());
}

/* Loads previously saved settings */
void
AdvancedPage::loadSettings(TorSettings* torSettings)
{
  ui.lineControlPort->setText(QString::number(torSettings->getControlPort()));
  ui.lineTorConfig->setText(torSettings->getTorrc());
  ui.lineUser->setText(torSettings->getUser());
  ui.lineGroup->setText(torSettings->getGroup());
}

/** Open a QFileDialog to browse for Tor config file. */
void
AdvancedPage::browseTorConfig()
{
  QString filename = QDir::convertSeparators(
                       QFileDialog::getOpenFileName(this,
                         tr("Select Tor Configuration File")));
  if (!filename.isEmpty()) {
    ui.lineTorConfig->setText(filename);
  }
}
+57 −0
Changes for src/gui/config/advancedpage.h: 57 added lines, 0 removed lines.
Original line number Diff line number Diff line
/****************************************************************
 *  Vidalia is distributed under the following license:
 *
 *  Copyright (C) 2006,  Matt Edman, Justin Hipple
 *
 *  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 (at your option) 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., 51 Franklin Street, Fifth Floor, 
 *  Boston, MA  02110-1301, USA.
 ****************************************************************/

/** 
 * \file advancedpage.h
 * \version $Id$
 */

#ifndef _ADVANCEDPAGE_H
#define _ADVANCEDPAGE_H

#include <QFileDialog>
#include <config/torsettings.h>

#include "ui_advancedpage.h"

class AdvancedPage : public QWidget
{
  Q_OBJECT

public:
  /** Default Constructor */
  AdvancedPage(QWidget *parent = 0);
  /** Saves the changes on this page */
  void saveChanges(TorSettings *torsettings);
  /** Loads the settings for this page */
  void loadSettings(TorSettings *torSettings);

private slots:
  /** Called when user clicks "Browse" to choose location of Tor config file */
  void browseTorConfig();
  
private:
  /** Qt Designer generated object */
  Ui::AdvancedPage ui;
};

#endif
+527 −0
Changes for src/gui/config/advancedpage.ui: 527 added lines, 0 removed lines.
Original line number Diff line number Diff line
<ui version="4.0" >
 <author></author>
 <comment></comment>
 <exportmacro></exportmacro>
 <class>AdvancedPage</class>
 <widget class="QWidget" name="AdvancedPage" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>507</width>
    <height>543</height>
   </rect>
  </property>
  <property name="palette" >
   <palette>
    <active>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>208</red>
      <green>208</green>
      <blue>208</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>247</red>
      <green>247</green>
      <blue>247</blue>
     </color>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>139</red>
      <green>139</green>
      <blue>139</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>240</red>
      <green>240</green>
      <blue>240</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>128</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>255</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>231</red>
      <green>231</green>
      <blue>231</blue>
     </color>
    </active>
    <inactive>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>208</red>
      <green>208</green>
      <blue>208</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>247</red>
      <green>247</green>
      <blue>247</blue>
     </color>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>139</red>
      <green>139</green>
      <blue>139</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>240</red>
      <green>240</green>
      <blue>240</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>192</red>
      <green>192</green>
      <blue>192</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>255</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>231</red>
      <green>231</green>
      <blue>231</blue>
     </color>
    </inactive>
    <disabled>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>208</red>
      <green>208</green>
      <blue>208</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>247</red>
      <green>247</green>
      <blue>247</blue>
     </color>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>139</red>
      <green>139</green>
      <blue>139</blue>
     </color>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>104</red>
      <green>104</green>
      <blue>104</blue>
     </color>
     <color>
      <red>240</red>
      <green>240</green>
      <blue>240</blue>
     </color>
     <color>
      <red>240</red>
      <green>240</green>
      <blue>240</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>0</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>128</blue>
     </color>
     <color>
      <red>255</red>
      <green>255</green>
      <blue>255</blue>
     </color>
     <color>
      <red>0</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>255</red>
      <green>0</green>
      <blue>255</blue>
     </color>
     <color>
      <red>231</red>
      <green>231</green>
      <blue>231</blue>
     </color>
    </disabled>
   </palette>
  </property>
  <property name="font" >
   <font>
    <family>Arial</family>
    <pointsize>10</pointsize>
    <weight>50</weight>
    <italic>false</italic>
    <bold>false</bold>
    <underline>false</underline>
    <strikeout>false</strikeout>
   </font>
  </property>
  <property name="contextMenuPolicy" >
   <enum>Qt::NoContextMenu</enum>
  </property>
  <layout class="QVBoxLayout" >
   <property name="margin" >
    <number>9</number>
   </property>
   <property name="spacing" >
    <number>6</number>
   </property>
   <item>
    <widget class="QGroupBox" name="grpControlPort" >
     <property name="contextMenuPolicy" >
      <enum>Qt::NoContextMenu</enum>
     </property>
     <property name="title" >
      <string>Control Port</string>
     </property>
     <layout class="QVBoxLayout" >
      <property name="margin" >
       <number>9</number>
      </property>
      <property name="spacing" >
       <number>6</number>
      </property>
      <item>
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </property>
        <property name="spacing" >
         <number>6</number>
        </property>
        <item>
         <widget class="QLineEdit" name="lineControlPort" >
          <property name="sizePolicy" >
           <sizepolicy>
            <hsizetype>0</hsizetype>
            <vsizetype>0</vsizetype>
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
          <property name="maximumSize" >
           <size>
            <width>55</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="contextMenuPolicy" >
           <enum>Qt::NoContextMenu</enum>
          </property>
          <property name="toolTip" >
           <string>Port that Vidalia uses to communicate with Tor. </string>
          </property>
          <property name="text" >
           <string>9051</string>
          </property>
         </widget>
        </item>
        <item>
         <spacer>
          <property name="orientation" >
           <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" >
           <size>
            <width>221</width>
            <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <widget class="QGroupBox" name="grpTorConfigFile" >
     <property name="contextMenuPolicy" >
      <enum>Qt::NoContextMenu</enum>
     </property>
     <property name="title" >
      <string>Alternate Tor Configuration File</string>
     </property>
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>9</number>
      </property>
      <property name="spacing" >
       <number>6</number>
      </property>
      <item>
       <widget class="QLineEdit" name="lineTorConfig" >
        <property name="enabled" >
         <bool>true</bool>
        </property>
        <property name="cursor" >
         <cursor>4</cursor>
        </property>
        <property name="contextMenuPolicy" >
         <enum>Qt::NoContextMenu</enum>
        </property>
        <property name="toolTip" >
         <string>Start Tor with the specified configuration file (torrc)</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="btnBrowseTorConfig" >
        <property name="enabled" >
         <bool>true</bool>
        </property>
        <property name="minimumSize" >
         <size>
          <width>0</width>
          <height>0</height>
         </size>
        </property>
        <property name="contextMenuPolicy" >
         <enum>Qt::NoContextMenu</enum>
        </property>
        <property name="toolTip" >
         <string>Select path to Tor configuration file</string>
        </property>
        <property name="text" >
         <string>Browse</string>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <widget class="QGroupBox" name="grpPermissions" >
     <property name="minimumSize" >
      <size>
       <width>0</width>
       <height>0</height>
      </size>
     </property>
     <property name="contextMenuPolicy" >
      <enum>Qt::NoContextMenu</enum>
     </property>
     <property name="title" >
      <string>Permissions</string>
     </property>
     <layout class="QVBoxLayout" >
      <property name="margin" >
       <number>9</number>
      </property>
      <property name="spacing" >
       <number>6</number>
      </property>
      <item>
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </property>
        <property name="spacing" >
         <number>6</number>
        </property>
        <item>
         <widget class="QLabel" name="label_3" >
          <property name="contextMenuPolicy" >
           <enum>Qt::NoContextMenu</enum>
          </property>
          <property name="text" >
           <string>Run as User:</string>
          </property>
          <property name="indent" >
           <number>8</number>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QLineEdit" name="lineUser" >
          <property name="contextMenuPolicy" >
           <enum>Qt::NoContextMenu</enum>
          </property>
          <property name="toolTip" >
           <string>Vidalia will run with this User's permissions</string>
          </property>
         </widget>
        </item>
       </layout>
      </item>
      <item>
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </property>
        <property name="spacing" >
         <number>6</number>
        </property>
        <item>
         <widget class="QLabel" name="label_9" >
          <property name="contextMenuPolicy" >
           <enum>Qt::NoContextMenu</enum>
          </property>
          <property name="text" >
           <string>Run as Group:</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QLineEdit" name="lineGroup" >
          <property name="toolTip" >
           <string>Vidalia will run with this Group's permissions</string>
          </property>
         </widget>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <spacer>
     <property name="orientation" >
      <enum>Qt::Vertical</enum>
     </property>
     <property name="sizeHint" >
      <size>
       <width>443</width>
       <height>27</height>
      </size>
     </property>
    </spacer>
   </item>
  </layout>
 </widget>
 <pixmapfunction></pixmapfunction>
 <resources/>
 <connections/>
</ui>
+12 −3
Changes for src/gui/config/config.pri: 12 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -21,13 +21,22 @@
#  02110-1301, USA.
#################################################################

FORMS += $$PWD/configdialog.ui
FORMS += $$PWD/configdialog.ui \
         $$PWD/generalpage.ui \
         $$PWD/serverpage.ui \
         $$PWD/advancedpage.ui

HEADERS += $$PWD/configdialog.h \
           $$PWD/ipvalidator.h \
           $$PWD/portvalidator.h
           $$PWD/portvalidator.h \
           $$PWD/generalpage.h \
           $$PWD/serverpage.h \
           $$PWD/advancedpage.h

SOURCES += $$PWD/configdialog.cpp \
           $$PWD/ipvalidator.cpp \
           $$PWD/portvalidator.cpp
           $$PWD/portvalidator.cpp \
           $$PWD/generalpage.cpp \
           $$PWD/serverpage.cpp \
           $$PWD/advancedpage.cpp
+21 −310

File changed.

Preview size limit exceeded, changes collapsed.

Loading