Changeset 1177 in vbox
- Timestamp:
- Mar 4, 2007 9:05:35 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile
r984 r1177 74 74 # Sources containing local definitions of classes that use the Q_OBJECT macro 75 75 ifneq ($(BUILD_TARGET),win) 76 VirtualBox_QT_MOCSRCS = src/COMDefs.cpp 76 VirtualBox_QT_MOCSRCS = src/COMDefs.cpp \ 77 src/VBoxSelectorWnd.cpp 77 78 endif 78 79 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h
r1000 r1177 38 38 class VBoxSnapshotsWgt; 39 39 class VBoxVMDetailsView; 40 class VBoxVMDescriptionPage; 40 41 41 42 class QLabel; … … 64 65 65 66 void vmNew(); 66 void vmSettings (const QString &category = QString::null );67 void vmSettings (const QString &category = QString::null, int = 0); 67 68 void vmDelete(); 68 69 void vmStart(); … … 72 73 void refreshVMList(); 73 74 void refreshVMItem (const QUuid &aID, bool aDetails, 74 bool aSnapshots); 75 bool aSnapshots, 76 bool aDescription); 75 77 76 78 void showHelpContents(); … … 90 92 91 93 void vmListBoxCurrentChanged (bool aRefreshDetails = true, 92 bool aRefreshSnapshots = true); 94 bool aRefreshSnapshots = true, 95 bool aRefreshDescription = true); 93 96 void mediaEnumFinished (const VBoxMediaList &); 94 97 … … 123 126 VBoxVMDetailsView *vmDetailsView; 124 127 VBoxSnapshotsWgt *vmSnapshotsWgt; 128 VBoxVMDescriptionPage *vmDescriptionPage; 125 129 126 130 QValueList <CSession> sessions; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r1121 r1177 194 194 mRefreshButton->setUsesTextLabel (true); 195 195 } 196 } 197 198 // VBoxVMDescriptionPage class 199 //////////////////////////////////////////////////////////////////////////////// 200 201 /** 202 * Comments page widget to represent VM comments. 203 */ 204 class VBoxVMDescriptionPage : public QWidget 205 { 206 Q_OBJECT 207 208 public: 209 210 VBoxVMDescriptionPage (VBoxSelectorWnd *, const char *); 211 ~VBoxVMDescriptionPage() {} 212 213 void setMachine (const CMachine &); 214 215 void languageChange(); 216 217 private slots: 218 219 void goToSettings(); 220 221 private: 222 223 VBoxSelectorWnd *mParent; 224 QToolButton *mBtnEdit; 225 QTextBrowser *mBrowser; 226 }; 227 228 VBoxVMDescriptionPage::VBoxVMDescriptionPage (VBoxSelectorWnd *aParent, 229 const char *aName) 230 : QWidget (aParent, aName), mParent (aParent) 231 , mBtnEdit (0), mBrowser (0) 232 { 233 /* main layout creation */ 234 QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout"); 235 /* mBrowser creation */ 236 mBrowser = new QTextBrowser (this, "mBrowser"); 237 mBrowser->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); 238 mBrowser->setFocusPolicy (QWidget::StrongFocus); 239 mBrowser->setLinkUnderline (false); 240 mBrowser->setFrameShape (QFrame::NoFrame); 241 mBrowser->setPaper (backgroundBrush()); 242 mainLayout->addWidget (mBrowser); 243 /* button layout creation */ 244 QHBoxLayout *btnLayout = new QHBoxLayout (mainLayout, 10, "btnLayout"); 245 QSpacerItem *spacer = new QSpacerItem (0, 0, 246 QSizePolicy::Expanding, 247 QSizePolicy::Minimum); 248 btnLayout->addItem (spacer); 249 /* button creation */ 250 mBtnEdit = new QToolButton (this, "mBtnEdit"); 251 mBtnEdit->setFocusPolicy (QWidget::StrongFocus); 252 mBtnEdit->setIconSet (VBoxGlobal::iconSet ("edit_shared_folder_16px.png", 253 "edit_shared_folder_disabled_16px.png")); 254 mBtnEdit->setTextPosition (QToolButton::BesideIcon); 255 mBtnEdit->setUsesTextLabel (true); 256 connect (mBtnEdit, SIGNAL (clicked()), this, SLOT (goToSettings())); 257 btnLayout->addWidget (mBtnEdit); 258 259 /* apply language settings */ 260 languageChange(); 261 } 262 263 void VBoxVMDescriptionPage::setMachine (const CMachine &aMachine) 264 { 265 mBrowser->setText (aMachine.GetDescription()); 266 } 267 268 void VBoxVMDescriptionPage::languageChange() 269 { 270 mBtnEdit->setTextLabel (tr ("Edit")); 271 mBtnEdit->setAccel (QString ("Ctrl+E")); 272 } 273 274 void VBoxVMDescriptionPage::goToSettings() 275 { 276 mParent->vmSettings ("#general", 2); 196 277 } 197 278 … … 308 389 QString::null); 309 390 391 /* VM comments page */ 392 vmDescriptionPage = new VBoxVMDescriptionPage (this, "vmDescriptionPage"); 393 vmTabWidget->addTab (vmDescriptionPage, 394 VBoxGlobal::iconSet ("edit_shared_folder_16px.png"), 395 QString::null); 396 310 397 /* add actions to the toolbar */ 311 398 … … 526 613 * VBoxVMSettingsDlg::setup(). 527 614 */ 528 void VBoxSelectorWnd::vmSettings (const QString &category /* = QString::null */)615 void VBoxSelectorWnd::vmSettings (const QString &category, int aSubPage) 529 616 { 530 617 VBoxVMListBoxItem *item = (VBoxVMListBoxItem *) vmListBox->selectedItem(); … … 543 630 VBoxVMSettingsDlg dlg (this, "VBoxVMSettingsDlg"); 544 631 dlg.getFromMachine (m); 545 dlg.setup (category );632 dlg.setup (category, aSubPage); 546 633 547 634 if (dlg.exec() == QDialog::Accepted) … … 736 823 AssertMsgReturn (item, ("Item must be always selected here"), (void) 0); 737 824 738 refreshVMItem (item->id(), true /* aDetails */, true /* aSnapshots */);825 refreshVMItem (item->id(), true, true, true); 739 826 } 740 827 … … 746 833 747 834 void VBoxSelectorWnd::refreshVMItem (const QUuid &aID, bool aDetails, 748 bool aSnapshots) 835 bool aSnapshots, 836 bool aDescription) 749 837 { 750 838 vmListBox->refresh (aID); 751 839 VBoxVMListBoxItem *item = (VBoxVMListBoxItem *) vmListBox->selectedItem(); 752 840 if (item && item->id() == aID) 753 vmListBoxCurrentChanged (aDetails, aSnapshots );841 vmListBoxCurrentChanged (aDetails, aSnapshots, aDescription); 754 842 } 755 843 … … 822 910 vmTabWidget->changeTab (vmDetailsView, tr ("&Details")); 823 911 vmTabWidget->changeTab (vmSnapshotsWgt, tr ("&Snapshots")); 912 vmTabWidget->changeTab (vmDescriptionPage, tr ("Des&cription")); 824 913 825 914 /* ensure the details and screenshot view are updated */ … … 893 982 894 983 vmDetailsView->languageChange(); 984 vmDescriptionPage->languageChange(); 895 985 } 896 986 … … 900 990 901 991 void VBoxSelectorWnd::vmListBoxCurrentChanged (bool aRefreshDetails, 902 bool aRefreshSnapshots) 992 bool aRefreshSnapshots, 993 bool aRefreshDescription) 903 994 { 904 995 if ( !vmListBox->selectedItem() && vmListBox->currentItem() >= 0 ) … … 931 1022 vmSnapshotsWgt->setMachine (m); 932 1023 } 1024 if (aRefreshDescription) 1025 { 1026 vmDescriptionPage->setMachine (m); 1027 } 933 1028 934 1029 CEnums::MachineState state = item->state(); … … 939 1034 vmDetailsView->setEnabled (modifyEnabled); 940 1035 vmSnapshotsWgt->setEnabled (!running); 1036 vmDescriptionPage->setEnabled (!running); 941 1037 942 1038 /* enable/disable modify actions */ … … 1041 1137 void VBoxSelectorWnd::machineStateChanged (const VBoxMachineStateChangeEvent &e) 1042 1138 { 1043 refreshVMItem (e.id, false /* aDetails */, false /* aSnapshots */);1139 refreshVMItem (e.id, false, false, false); 1044 1140 } 1045 1141 1046 1142 void VBoxSelectorWnd::machineDataChanged (const VBoxMachineDataChangeEvent &e) 1047 1143 { 1048 refreshVMItem (e.id, true /* aDetails */, false /* aSnapshots */);1144 refreshVMItem (e.id, true, false, true); 1049 1145 } 1050 1146 … … 1075 1171 void VBoxSelectorWnd::sessionStateChanged (const VBoxSessionStateChangeEvent &e) 1076 1172 { 1077 refreshVMItem (e.id, false /* aDetails */, false /* aSnapshots */);1173 refreshVMItem (e.id, false, false, false); 1078 1174 } 1079 1175 1080 1176 void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent &aEvent) 1081 1177 { 1082 refreshVMItem (aEvent.machineId, false, true); 1083 } 1178 refreshVMItem (aEvent.machineId, false, true, false); 1179 } 1180 1181 #include "VBoxSelectorWnd.moc" -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r1062 r1177 1182 1182 </grid> 1183 1183 </widget> 1184 <widget class="QWidget"> 1185 <property name="name"> 1186 <cstring>description</cstring> 1187 </property> 1188 <attribute name="title"> 1189 <string>&Description</string> 1190 </attribute> 1191 <vbox> 1192 <property name="name"> 1193 <cstring>unnamed</cstring> 1194 </property> 1195 <property name="margin"> 1196 <number>10</number> 1197 </property> 1198 <property name="spacing"> 1199 <number>10</number> 1200 </property> 1201 <widget class="QGroupBox"> 1202 <property name="name"> 1203 <cstring>gbDescription</cstring> 1204 </property> 1205 <property name="title"> 1206 <string>Virtual Machine &Description</string> 1207 </property> 1208 <vbox> 1209 <property name="name"> 1210 <cstring>unnamed</cstring> 1211 </property> 1212 <widget class="QTextEdit"> 1213 <property name="name"> 1214 <cstring>teDescription</cstring> 1215 </property> 1216 </widget> 1217 </vbox> 1218 </widget> 1219 </vbox> 1220 </widget> 1184 1221 </widget> 1185 1222 </vbox> … … 1804 1841 </property> 1805 1842 <property name="whatsThis" stdset="0"> 1806 <string>Controls the audio output driver. The <b>Null Audio Driver</b> 1843 <string>Controls the audio output driver. The <b>Null Audio Driver</b> 1807 1844 makes the guest see an audio card, however every access to it will be ignored.</string> 1808 1845 </property> … … 2722 2759 <functions> 2723 2760 <function access="private">init()</function> 2724 <function>setup( const QString & category)</function>2761 <function>setup( const QString &, int )</function> 2725 2762 <function>getFromMachine( const CMachine & machine )</function> 2726 2763 <function returnType="COMResult">putBackToMachine()</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r1074 r1177 822 822 * sign. 823 823 */ 824 void VBoxVMSettingsDlg::setup (const QString & category)825 { 826 if ( category)827 { 828 QListViewItem *item = listView->findItem ( category, listView_Link);824 void VBoxVMSettingsDlg::setup (const QString &aCategory, int aSubPage) 825 { 826 if (!aCategory.isNull()) 827 { 828 QListViewItem *item = listView->findItem (aCategory, listView_Link); 829 829 if (item) 830 { 830 831 listView->setSelected (item, true); 832 QObjectList *list = widgetStack->visibleWidget()->queryList ("QTabWidget"); 833 for (QObject *obj = list->first(); obj != NULL; obj = list->next()) 834 { 835 QTabWidget *tabStack = static_cast<QTabWidget*> (obj); 836 tabStack->setCurrentPage (aSubPage); 837 } 838 } 831 839 } 832 840 } … … 1066 1074 /* Saved state folder */ 1067 1075 leSnapshotFolder->setText (machine.GetSnapshotFolder()); 1076 1077 /* Description */ 1078 teDescription->setText (machine.GetDescription()); 1068 1079 1069 1080 /* hard disk images */ … … 1380 1391 cmachine.SetSnapshotFolder (leSnapshotFolder->text()); 1381 1392 1393 /* Description */ 1394 cmachine.SetDescription (teDescription->text()); 1395 1382 1396 /* hard disk images */ 1383 1397 {
Note:
See TracChangeset
for help on using the changeset viewer.