Changeset 10611 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Jul 14, 2008 6:48:33 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGLSettingsUpdate.h
r10584 r10611 50 50 51 51 void toggleUpdater (bool aOn); 52 void toggleType();53 52 void activatedPeriod (int aIndex); 54 53 … … 57 56 void showEvent (QShowEvent *aEvent); 58 57 59 QRadioButton *mLastSelected;60 58 bool mSettingsChanged; 61 59 }; -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxUpdateDlg.h
r10515 r10611 61 61 enum 62 62 { 63 NeverCheck = -2, 64 AutoCheck = -3 63 NeverCheck = -2 65 64 }; 66 65 … … 72 71 73 72 bool isNecessary(); 74 bool is Automatic();73 bool isNeverCheck(); 75 74 76 75 QString data() const; … … 100 99 101 100 static bool isNecessary(); 102 static bool isAutomatic();103 101 104 102 VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGLSettingsUpdate.cpp
r10584 r10611 26 26 27 27 VBoxGLSettingsUpdate::VBoxGLSettingsUpdate() 28 : mLastSelected (0) 29 , mSettingsChanged (false) 28 : mSettingsChanged (false) 30 29 { 31 30 /* Apply UI decorations */ … … 33 32 34 33 /* Setup connections */ 35 connect (m GbCheck, SIGNAL (toggled (bool)),34 connect (mCbCheck, SIGNAL (toggled (bool)), 36 35 this, SLOT (toggleUpdater (bool))); 37 connect (mRbAuto, SIGNAL (clicked()), this, SLOT (toggleType()));38 connect (mRbOncePer, SIGNAL (clicked()), this, SLOT (toggleType()));39 36 connect (mCbOncePer, SIGNAL (activated (int)), 40 37 this, SLOT (activatedPeriod (int))); … … 50 47 GetExtraData (VBoxDefs::GUI_UpdateDate)); 51 48 52 if (data.index() == VBoxUpdateData::NeverCheck) 53 { 54 mGbCheck->setChecked (false); 55 } 56 else 57 { 58 mGbCheck->setChecked (true); 59 60 if (data.isAutomatic()) 61 { 62 mRbAuto->setChecked (true); 63 } 64 else 65 { 66 mRbOncePer->setChecked (true); 67 Assert (data.index() >= 0); 68 mCbOncePer->setCurrentIndex (data.index()); 69 } 70 } 49 mCbCheck->setChecked (!data.isNeverCheck()); 50 if (mCbCheck->isChecked()) 51 mCbOncePer->setCurrentIndex (data.index()); 71 52 mTxDate->setText (data.date()); 72 53 … … 80 61 return; 81 62 82 int index = -1; 83 84 if (!mGbCheck->isChecked()) 85 { 86 index = VBoxUpdateData::NeverCheck; 87 } 88 else 89 { 90 if (mRbAuto->isChecked()) 91 index = VBoxUpdateData::AutoCheck; 92 else 93 index = mCbOncePer->currentIndex(); 94 } 63 int index = mCbCheck->isChecked() ? mCbOncePer->currentIndex() : 64 VBoxUpdateData::NeverCheck; 95 65 Assert (index != -1); 96 66 97 67 VBoxUpdateData newData (index); 98 99 68 vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateDate, 100 69 newData.data()); … … 103 72 void VBoxGLSettingsUpdate::setOrderAfter (QWidget *aWidget) 104 73 { 105 setTabOrder (aWidget, mGbCheck); 106 setTabOrder (mGbCheck, mRbAuto); 107 setTabOrder (mRbAuto, mRbOncePer); 108 setTabOrder (mRbOncePer, mCbOncePer); 74 setTabOrder (aWidget, mCbCheck); 75 setTabOrder (mCbCheck, mCbOncePer); 109 76 } 110 77 … … 124 91 void VBoxGLSettingsUpdate::toggleUpdater (bool aOn) 125 92 { 126 /* Toggle auto-exclusiveness on/off to let the buttons be 127 * unchecked both in case of group-box is not checked and 128 * exclusively checked in case of group-box is checked. */ 129 mRbAuto->setAutoExclusive (aOn); 130 mRbOncePer->setAutoExclusive (aOn); 93 /* Enable/disable the sub widget */ 94 mLbOncePer->setEnabled (aOn); 95 mCbOncePer->setEnabled (aOn); 131 96 132 /* Enable/disable the sub widget */ 133 mGbCheckContent->setEnabled (aOn); 134 135 /* Toggle both buttons off when the group box unchecked. */ 136 if (!aOn) 137 { 138 mLastSelected = mRbOncePer->isChecked() ? mRbOncePer : mRbAuto; 139 mRbAuto->blockSignals (true); 140 mRbOncePer->blockSignals (true); 141 mRbAuto->setChecked (false); 142 mRbOncePer->setChecked (false); 143 mRbAuto->blockSignals (false); 144 mRbOncePer->blockSignals (false); 97 /* Update 'check for new version' time */ 98 if (aOn) 99 activatedPeriod (mCbOncePer->currentIndex()); 100 else 145 101 activatedPeriod (VBoxUpdateData::NeverCheck); 146 }147 /* Toggle last checked button on when the group box checked. */148 else if (!mRbAuto->isChecked() && !mRbOncePer->isChecked())149 {150 mLastSelected->blockSignals (true);151 mLastSelected->setChecked (true);152 mLastSelected->blockSignals (false);153 toggleType();154 }155 }156 157 void VBoxGLSettingsUpdate::toggleType()158 {159 mCbOncePer->setEnabled (mRbOncePer->isChecked());160 activatedPeriod (mRbAuto->isChecked() ?161 VBoxUpdateData::AutoCheck : mCbOncePer->currentIndex());162 102 } 163 103 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxUpdateDlg.cpp
r10515 r10611 125 125 } 126 126 127 bool VBoxUpdateData::is Automatic()128 { 129 return mIndex == AutoCheck;127 bool VBoxUpdateData::isNeverCheck() 128 { 129 return mIndex == NeverCheck; 130 130 } 131 131 … … 143 143 { 144 144 return mIndex == NeverCheck ? VBoxUpdateDlg::tr ("never") : 145 mIndex == AutoCheck ? VBoxUpdateDlg::tr ("on startup") :146 145 mDate.toString ("yyyy.MM.dd"); 147 146 } … … 150 149 { 151 150 /* Parse standard values */ 152 if (aData == "auto") 153 mIndex = AutoCheck; 154 else if (aData == "never") 151 if (aData == "never") 155 152 mIndex = NeverCheck; 156 153 /* Parse other values */ … … 182 179 { 183 180 /* Encode standard values */ 184 if (aIndex == AutoCheck) 185 mData = "auto"; 186 else if (aIndex == NeverCheck) 181 if (aIndex == NeverCheck) 187 182 mData = "never"; 188 183 /* Encode other values */ … … 218 213 219 214 return data.isNecessary(); 220 }221 222 bool VBoxUpdateDlg::isAutomatic()223 {224 VBoxUpdateData data (vboxGlobal().virtualBox().225 GetExtraData (VBoxDefs::GUI_UpdateDate));226 227 return data.isAutomatic();228 215 } 229 216 -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxGLSettingsUpdate.ui
r10584 r10611 40 40 <number>0</number> 41 41 </property> 42 <item row="0" column="1" colspan="2">43 <widget class="QCheckBox" name="m GbCheck" >42 <item row="0" column="1" > 43 <widget class="QCheckBox" name="mCbCheck" > 44 44 <property name="text" > 45 45 <string>&Check for a new version</string> … … 61 61 <size> 62 62 <width>40</width> 63 <height> 20</height>63 <height>10</height> 64 64 </size> 65 65 </property> … … 67 67 </item> 68 68 <item row="1" column="1" > 69 < spacer>70 <property name=" orientation" >71 < enum>Qt::Horizontal</enum>69 <layout class="QHBoxLayout" > 70 <property name="spacing" > 71 <number>0</number> 72 72 </property> 73 <property name="sizeType" > 74 <enum>QSizePolicy::Fixed</enum> 75 </property> 76 <property name="sizeHint" > 77 <size> 78 <width>20</width> 79 <height>40</height> 80 </size> 81 </property> 82 </spacer> 73 <item> 74 <spacer> 75 <property name="orientation" > 76 <enum>Qt::Horizontal</enum> 77 </property> 78 <property name="sizeType" > 79 <enum>QSizePolicy::Fixed</enum> 80 </property> 81 <property name="sizeHint" > 82 <size> 83 <width>20</width> 84 <height>10</height> 85 </size> 86 </property> 87 </spacer> 88 </item> 89 <item> 90 <widget class="QLabel" name="mLbOncePer" > 91 <property name="text" > 92 <string>&Once per</string> 93 </property> 94 <property name="buddy" > 95 <cstring>mCbOncePer</cstring> 96 </property> 97 </widget> 98 </item> 99 <item> 100 <spacer> 101 <property name="orientation" > 102 <enum>Qt::Horizontal</enum> 103 </property> 104 <property name="sizeType" > 105 <enum>QSizePolicy::Fixed</enum> 106 </property> 107 <property name="sizeHint" > 108 <size> 109 <width>16</width> 110 <height>10</height> 111 </size> 112 </property> 113 </spacer> 114 </item> 115 <item> 116 <widget class="QComboBox" name="mCbOncePer" /> 117 </item> 118 <item> 119 <spacer> 120 <property name="orientation" > 121 <enum>Qt::Horizontal</enum> 122 </property> 123 <property name="sizeHint" > 124 <size> 125 <width>0</width> 126 <height>10</height> 127 </size> 128 </property> 129 </spacer> 130 </item> 131 </layout> 83 132 </item> 84 <item row="1" column="2" > 85 <widget class="QWidget" native="1" name="mGbCheckContent" > 86 <layout class="QGridLayout" > 87 <property name="leftMargin" > 88 <number>0</number> 89 </property> 90 <property name="topMargin" > 91 <number>0</number> 92 </property> 93 <property name="rightMargin" > 94 <number>0</number> 95 </property> 96 <property name="bottomMargin" > 97 <number>0</number> 98 </property> 99 <property name="verticalSpacing" > 100 <number>0</number> 101 </property> 102 <item row="0" column="0" > 103 <widget class="QRadioButton" name="mRbAuto" > 104 <property name="text" > 105 <string>On &startup</string> 106 </property> 107 </widget> 108 </item> 109 <item row="1" column="0" > 110 <widget class="QRadioButton" name="mRbOncePer" > 111 <property name="text" > 112 <string>&Once per</string> 113 </property> 114 </widget> 115 </item> 116 <item row="1" column="1" > 117 <layout class="QHBoxLayout" > 118 <property name="spacing" > 119 <number>0</number> 120 </property> 121 <item> 122 <spacer> 123 <property name="orientation" > 124 <enum>Qt::Horizontal</enum> 125 </property> 126 <property name="sizeType" > 127 <enum>QSizePolicy::Fixed</enum> 128 </property> 129 <property name="sizeHint" > 130 <size> 131 <width>16</width> 132 <height>16</height> 133 </size> 134 </property> 135 </spacer> 136 </item> 137 <item> 138 <widget class="QComboBox" name="mCbOncePer" /> 139 </item> 140 <item> 141 <spacer> 142 <property name="orientation" > 143 <enum>Qt::Horizontal</enum> 144 </property> 145 <property name="sizeHint" > 146 <size> 147 <width>0</width> 148 <height>16</height> 149 </size> 150 </property> 151 </spacer> 152 </item> 153 </layout> 154 </item> 155 </layout> 156 </widget> 157 </item> 158 <item row="2" column="1" colspan="2" > 133 <item row="2" column="1" > 159 134 <layout class="QHBoxLayout" > 160 135 <property name="spacing" > … … 186 161 </layout> 187 162 </item> 188 <item row="3" column=" 2" >163 <item row="3" column="1" > 189 164 <spacer> 190 165 <property name="orientation" > … … 193 168 <property name="sizeHint" > 194 169 <size> 195 <width> 20</width>196 <height> 40</height>170 <width>10</width> 171 <height>0</height> 197 172 </size> 198 173 </property>
Note:
See TracChangeset
for help on using the changeset viewer.