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

[vidalia-svn] r3117: Add a prettier dialog for prompting people for their control (vidalia/trunk/src/vidalia)



Author: edmanm
Date: 2008-09-20 21:43:08 -0400 (Sat, 20 Sep 2008)
New Revision: 3117

Added:
   vidalia/trunk/src/vidalia/controlpasswordinputdialog.cpp
   vidalia/trunk/src/vidalia/controlpasswordinputdialog.h
   vidalia/trunk/src/vidalia/controlpasswordinputdialog.ui
Modified:
   vidalia/trunk/src/vidalia/CMakeLists.txt
Log:
Add a prettier dialog for prompting people for their control port password
that also includes a checkbox for whether the user wants Vidalia to remember
the entered password, a Help button, and a Reset button.


Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt	2008-09-20 23:46:04 UTC (rev 3116)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt	2008-09-21 01:43:08 UTC (rev 3117)
@@ -183,6 +183,7 @@
   vidaliawindow.cpp
   vmessagebox.cpp
   helperprocess.cpp
+  controlpasswordinputdialog.cpp
 )
 qt4_wrap_cpp(vidalia_SRCS
   vidalia.h
@@ -191,10 +192,12 @@
   vidaliawindow.h
   vmessagebox.h
   helperprocess.h
+  controlpasswordinputdialog.h
 )
 
 ## Specify all the Qt Designer .ui files
 qt4_wrap_ui(vidalia_SRCS
+  controlpasswordinputdialog.ui
   mainwindow.ui
   about/aboutdialog.ui
   bwgraph/bwgraph.ui

Added: vidalia/trunk/src/vidalia/controlpasswordinputdialog.cpp
===================================================================
--- vidalia/trunk/src/vidalia/controlpasswordinputdialog.cpp	                        (rev 0)
+++ vidalia/trunk/src/vidalia/controlpasswordinputdialog.cpp	2008-09-21 01:43:08 UTC (rev 3117)
@@ -0,0 +1,44 @@
+/*
+**  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 controlpasswordinputdialog.cpp
+** \version $Id: mainwindow.cpp 3019 2008-08-30 01:28:46Z edmanm $
+** \brief Prompts the user to enter their control port password, and gives
+** them the option to save or attempt to reset it.
+*/
+
+#include "controlpasswordinputdialog.h"
+
+
+ControlPasswordInputDialog::ControlPasswordInputDialog(QWidget *parent)
+  : QDialog(parent)
+{
+  ui.setupUi(this);
+  setSizeGripEnabled(false);
+
+  ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok
+                                     | QDialogButtonBox::Cancel
+                                     | QDialogButtonBox::Reset
+                                     | QDialogButtonBox::Help);
+}
+
+QString
+ControlPasswordInputDialog::password() const
+{
+  return ui.linePassword->text();
+}
+
+bool
+ControlPasswordInputDialog::isSavePasswordChecked() const
+{
+  return ui.chkSavePassword->isChecked();
+}
+

Added: vidalia/trunk/src/vidalia/controlpasswordinputdialog.h
===================================================================
--- vidalia/trunk/src/vidalia/controlpasswordinputdialog.h	                        (rev 0)
+++ vidalia/trunk/src/vidalia/controlpasswordinputdialog.h	2008-09-21 01:43:08 UTC (rev 3117)
@@ -0,0 +1,39 @@
+/*
+**  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.
+*/
+
+#include <QDialog>
+#include <QString>
+
+#include "ui_controlpasswordinputdialog.h"
+
+
+class ControlPasswordInputDialog : public QDialog
+{
+  Q_OBJECT
+
+public:
+  /** Default constructor.
+   */
+  ControlPasswordInputDialog(QWidget *parent = 0);
+
+  /** Returns the password entered in the dialog. If the dialog was dismissed
+   * with the "Cancel" button, then the returned QString will be empty.
+   */
+  QString password() const;
+
+  /** Returns true if the "Remember my password" checkbox was checked at the
+   * time the dialog was dismissed.
+   */
+  bool isSavePasswordChecked() const;
+
+private:
+    Ui::ControlPasswordInputDialog ui; /**< Qt Designer generated object. */
+};
+

Added: vidalia/trunk/src/vidalia/controlpasswordinputdialog.ui
===================================================================
--- vidalia/trunk/src/vidalia/controlpasswordinputdialog.ui	                        (rev 0)
+++ vidalia/trunk/src/vidalia/controlpasswordinputdialog.ui	2008-09-21 01:43:08 UTC (rev 3117)
@@ -0,0 +1,162 @@
+<ui version="4.0" >
+ <class>ControlPasswordInputDialog</class>
+ <widget class="QDialog" name="ControlPasswordInputDialog" >
+  <property name="windowModality" >
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>420</width>
+    <height>201</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>410</width>
+    <height>189</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Password Required</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset resource="res/vidalia.qrc" >
+    <normaloff>:/images/32x32/dialog-password.png</normaloff>:/images/32x32/dialog-password.png</iconset>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>false</bool>
+  </property>
+  <property name="modal" >
+   <bool>true</bool>
+  </property>
+  <widget class="QWidget" name="gridLayoutWidget" >
+   <property name="geometry" >
+    <rect>
+     <x>19</x>
+     <y>19</y>
+     <width>381</width>
+     <height>161</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" name="gridLayout" >
+    <item row="0" column="0" >
+     <widget class="QLabel" name="lblIcon" >
+      <property name="text" >
+       <string/>
+      </property>
+      <property name="pixmap" >
+       <pixmap resource="res/vidalia.qrc" >:/images/48x48/dialog-password.png</pixmap>
+      </property>
+     </widget>
+    </item>
+    <item row="0" column="1" >
+     <widget class="QLabel" name="lblPrompt" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+        <horstretch>1</horstretch>
+        <verstretch>1</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="text" >
+       <string>Vidalia has connected to a running Tor process that requires a password. Please enter your control password: </string>
+      </property>
+      <property name="textFormat" >
+       <enum>Qt::PlainText</enum>
+      </property>
+      <property name="scaledContents" >
+       <bool>true</bool>
+      </property>
+      <property name="alignment" >
+       <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+      </property>
+      <property name="wordWrap" >
+       <bool>true</bool>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="0" >
+     <spacer name="verticalSpacer" >
+      <property name="orientation" >
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0" >
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item row="1" column="1" >
+     <widget class="QLineEdit" name="linePassword" >
+      <property name="echoMode" >
+       <enum>QLineEdit::Password</enum>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="1" >
+     <widget class="QCheckBox" name="chkSavePassword" >
+      <property name="text" >
+       <string>Remember my password</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="0" colspan="2" >
+     <widget class="QDialogButtonBox" name="buttonBox" >
+      <property name="orientation" >
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="standardButtons" >
+       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources>
+  <include location="res/vidalia.qrc" />
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ControlPasswordInputDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ControlPasswordInputDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>