Changeset 537

Show
Ignore:
Timestamp:
03/31/06 21:33:15 (3 years ago)
Author:
hipplej
Message:

Make the AppearancePage? widgets do something. Added some nifty flag images.

Location:
trunk/src/gui
Files:
3 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/config/appearancepage.cpp

    r533 r537  
    2727#include "appearancepage.h" 
    2828 
     29#define FLAG_CN     ":/images/flags/cn.png" 
     30#define FLAG_EN     ":/images/flags/en.png" 
     31 
    2932/** Default Constructor */ 
    3033AppearancePage::AppearancePage(QWidget *parent) 
     
    3639  /* Create VidaliaSettings object */ 
    3740  _settings = new VidaliaSettings(); 
     41 
     42  /* Populate combo boxes */ 
     43  ui.cmboLanguage->addItem(QIcon(FLAG_EN), LanguageSupport::languages()["en"]); 
     44  ui.cmboLanguage->addItem(QIcon(FLAG_CN), LanguageSupport::languages()["zh-cn"]); 
     45     
     46  ui.cmboStyle->addItems(QStyleFactory::keys()); 
    3847} 
    3948 
     
    4958{ 
    5059  Q_UNUSED(errmsg); 
     60  QString languageName = ui.cmboLanguage-> currentText(); 
     61  QString languageCode = LanguageSupport::languages().key(languageName); 
     62   
     63  _settings->setLanguageCode(languageCode); 
     64  _settings->setInterfaceStyle(ui.cmboStyle->currentText()); 
     65   
    5166  return true; 
    5267} 
     
    5671AppearancePage::load() 
    5772{ 
    58  
     73  QString languageCode = _settings->getLanguageCode(); 
     74  QString languageName = LanguageSupport::languages()[languageCode]; 
     75  int index = ui.cmboLanguage->findText(languageName, Qt::MatchExactly); 
     76  ui.cmboLanguage->setCurrentIndex(index); 
     77   
     78  QString style = _settings->getInterfaceStyle(); 
     79  index = ui.cmboStyle->findText(style, Qt::MatchExactly); 
     80  ui.cmboStyle->setCurrentIndex(index); 
    5981} 
    6082 
  • trunk/src/gui/config/appearancepage.h

    r533 r537  
    2828#define _APPEARANCEPAGE_H 
    2929 
     30#include <QStyleFactory> 
     31#include <QLineEdit> 
     32 
    3033#include <config/vidaliasettings.h> 
     34#include <lang/languagesupport.h> 
    3135 
    3236#include "configpage.h" 
  • trunk/src/gui/config/appearancepage.ui

    r531 r537  
    292292   <enum>Qt::NoContextMenu</enum> 
    293293  </property> 
    294   <layout class="QVBoxLayout" > 
     294  <layout class="QGridLayout" > 
    295295   <property name="margin" > 
    296296    <number>9</number> 
     
    299299    <number>6</number> 
    300300   </property> 
    301    <item> 
    302     <widget class="QGroupBox" name="grpLanguage" > 
     301   <item row="2" column="0" > 
     302    <layout class="QHBoxLayout" > 
     303     <property name="margin" > 
     304      <number>0</number> 
     305     </property> 
     306     <property name="spacing" > 
     307      <number>6</number> 
     308     </property> 
     309     <item> 
     310      <spacer> 
     311       <property name="orientation" > 
     312        <enum>Qt::Horizontal</enum> 
     313       </property> 
     314       <property name="sizeHint" > 
     315        <size> 
     316         <width>40</width> 
     317         <height>20</height> 
     318        </size> 
     319       </property> 
     320      </spacer> 
     321     </item> 
     322     <item> 
     323      <widget class="QLabel" name="label" > 
     324       <property name="contextMenuPolicy" > 
     325        <enum>Qt::NoContextMenu</enum> 
     326       </property> 
     327       <property name="text" > 
     328        <string>These changes will only take effect after restarting Vidalia!</string> 
     329       </property> 
     330      </widget> 
     331     </item> 
     332     <item> 
     333      <spacer> 
     334       <property name="orientation" > 
     335        <enum>Qt::Horizontal</enum> 
     336       </property> 
     337       <property name="sizeHint" > 
     338        <size> 
     339         <width>40</width> 
     340         <height>20</height> 
     341        </size> 
     342       </property> 
     343      </spacer> 
     344     </item> 
     345    </layout> 
     346   </item> 
     347   <item row="1" column="0" > 
     348    <widget class="QGroupBox" name="grpStyle" > 
    303349     <property name="contextMenuPolicy" > 
    304350      <enum>Qt::NoContextMenu</enum> 
    305351     </property> 
     352     <property name="toolTip" > 
     353      <string/> 
     354     </property> 
    306355     <property name="title" > 
    307       <string>Interface Language</string> 
     356      <string>Interface Style</string> 
    308357     </property> 
    309358     <layout class="QGridLayout" > 
     
    328377      </item> 
    329378      <item row="0" column="0" > 
    330        <widget class="QComboBox" name="cmboLanguage" > 
     379       <widget class="QComboBox" name="cmboStyle" > 
    331380        <property name="minimumSize" > 
    332381         <size> 
     
    339388        </property> 
    340389        <property name="toolTip" > 
    341          <string>Choose the language used in Vidalia</string> 
     390         <string>Choose Vidalia's interface style</string> 
     391        </property> 
     392        <property name="editable" > 
     393         <bool>false</bool> 
    342394        </property> 
    343395       </widget> 
     
    346398    </widget> 
    347399   </item> 
    348    <item> 
    349     <widget class="QGroupBox" name="grpStyle" > 
     400   <item row="0" column="0" > 
     401    <widget class="QGroupBox" name="grpLanguage" > 
    350402     <property name="contextMenuPolicy" > 
    351403      <enum>Qt::NoContextMenu</enum> 
    352404     </property> 
    353      <property name="toolTip" > 
    354       <string/> 
    355      </property> 
    356405     <property name="title" > 
    357       <string>Interface Style</string> 
     406      <string>Interface Language</string> 
    358407     </property> 
    359408     <layout class="QGridLayout" > 
     
    378427      </item> 
    379428      <item row="0" column="0" > 
    380        <widget class="QComboBox" name="cmboStyle" > 
     429       <widget class="QComboBox" name="cmboLanguage" > 
    381430        <property name="minimumSize" > 
    382431         <size> 
     
    389438        </property> 
    390439        <property name="toolTip" > 
    391          <string>Choose Vidalia's interface style</string> 
     440         <string>Choose the language used in Vidalia</string> 
     441        </property> 
     442        <property name="editable" > 
     443         <bool>false</bool> 
     444        </property> 
     445        <property name="iconSize" > 
     446         <size> 
     447          <width>24</width> 
     448          <height>16</height> 
     449         </size> 
    392450        </property> 
    393451       </widget> 
     
    396454    </widget> 
    397455   </item> 
    398    <item> 
     456   <item row="3" column="0" > 
    399457    <spacer> 
    400458     <property name="orientation" > 
     
    403461     <property name="sizeHint" > 
    404462      <size> 
    405        <width>20</width> 
    406        <height>40</height> 
     463       <width>476</width> 
     464       <height>161</height> 
    407465      </size> 
    408466     </property> 
  • trunk/src/gui/res/vidalia.qrc

    r531 r537  
    6464        <file>128x128/tor-on.png</file> 
    6565    </qresource> 
     66    <qresource prefix="/images"> 
     67        <file>flags/cn.png</file> 
     68        <file>flags/en.png</file> 
     69    </qresource> 
    6670</RCC>