- Timestamp:
- Aug 12, 2008 2:34:05 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxFilePathSelectorWidget.h
r11229 r11361 38 38 public: 39 39 40 enum SelectorMode40 enum Mode 41 41 { 42 PathMode= 0,43 FileMode42 Mode_Folder = 0, 43 Mode_File 44 44 }; 45 45 … … 47 47 ~VBoxFilePathSelectorWidget(); 48 48 49 void setMode ( SelectorMode aMode);50 SelectorMode mode() const;49 void setMode (Mode aMode); 50 Mode mode() const; 51 51 52 52 void setResetEnabled (bool aEnabled); 53 53 bool isResetEnabled () const; 54 54 55 #if 0 56 57 /// @todo enabling this requires to allow to customize the names of the 58 /// "Other..." and "Reset" items too which is not yet done. 59 55 60 void setNoneToolTip (const QString &aText); 56 61 void setSelectToolTip (const QString &aText); 57 62 void setResetToolTip (const QString &aText); 63 64 #endif /* 0 */ 58 65 59 66 bool isModified() const; … … 89 96 QFileIconProvider *mIconProvider; 90 97 QAction *mCopyAction; 91 SelectorMode mMode;98 Mode mMode; 92 99 QString mPath; 93 100 QString mNoneStr; -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFilePathSelectorWidget.cpp
r11229 r11361 30 30 #include <QFileIconProvider> 31 31 32 #include <VBoxDefs.h> 33 32 34 enum 33 35 { … … 41 43 , mIconProvider (new QFileIconProvider()) 42 44 , mCopyAction (new QAction (this)) 43 , mMode ( PathMode)45 , mMode (Mode_Folder) 44 46 { 45 47 /* Populate items */ … … 72 74 } 73 75 74 void VBoxFilePathSelectorWidget::setMode ( SelectorMode aMode)76 void VBoxFilePathSelectorWidget::setMode (Mode aMode) 75 77 { 76 78 mMode = aMode; 77 79 } 78 80 79 VBoxFilePathSelectorWidget:: SelectorMode VBoxFilePathSelectorWidget::mode() const81 VBoxFilePathSelectorWidget::Mode VBoxFilePathSelectorWidget::mode() const 80 82 { 81 83 return mMode; … … 96 98 } 97 99 100 #if 0 101 102 /// @todo enabling this requires to allow to customize the names of the 103 /// "Other..." and "Reset" items too which is not yet done. 104 98 105 void VBoxFilePathSelectorWidget::setNoneToolTip (const QString &aText) 99 106 { … … 116 123 } 117 124 125 #endif /* 0 */ 126 118 127 bool VBoxFilePathSelectorWidget::isModified() const 119 128 { … … 124 133 { 125 134 mPath = aPath.isEmpty() ? QString::null : aPath; 126 127 /* Attach corresponding icon */128 setItemIcon (PathId, QFileInfo (mPath).exists() ?129 mIconProvider->icon (QFileInfo (mPath)) :130 defaultIcon());131 132 /* Store full path as tooltip */133 setToolTip (filePath());134 setItemData (PathId, toolTip(), Qt::ToolTipRole);135 135 136 136 refreshText(); … … 150 150 void VBoxFilePathSelectorWidget::retranslateUi() 151 151 { 152 /* how do we interpret the "nothing selected" item? */ 153 if (isResetEnabled()) 154 { 155 mNoneStr = tr ("<reset to default>"); 156 mNoneTip = tr ("The actual default path value will be displayed after " 157 "accepting the changes and opening this dialog again."); 158 } 159 else 160 { 161 mNoneStr = tr ("<not selected>"); 162 mNoneTip = tr ("Please use the <b>Other...</b> item from the drop-down " 163 "list to select a desired path."); 164 } 165 152 166 /* Retranslate 'path' item */ 153 mNoneStr = tr ("None");154 167 if (mPath.isNull()) 155 168 { … … 166 179 setItemText (ResetId, tr ("Reset")); 167 180 181 /* set tooltips of the above two items based on the mode */ 182 switch (mMode) 183 { 184 case Mode_Folder: 185 setItemData (SelectId, 186 tr ("Opens a dialog to select a different folder."), 187 Qt::ToolTipRole); 188 setItemData (ResetId, 189 tr ("Resets the folder path to the default value."), 190 Qt::ToolTipRole); 191 break; 192 case Mode_File: 193 setItemData (SelectId, 194 tr ("Opens a dialog to select a different file."), 195 Qt::ToolTipRole); 196 setItemData (ResetId, 197 tr ("Resets the file path to the default value."), 198 Qt::ToolTipRole); 199 break; 200 default: 201 AssertFailedBreak(); 202 } 203 168 204 /* Retranslate copy action */ 169 205 mCopyAction->setText (tr ("&Copy")); … … 199 235 QIcon VBoxFilePathSelectorWidget::defaultIcon() const 200 236 { 201 if (mMode == PathMode)237 if (mMode == Mode_Folder) 202 238 return mIconProvider->icon (QFileIconProvider::Folder); 203 239 else … … 207 243 QString VBoxFilePathSelectorWidget::filePath() const 208 244 { 245 /// @todo (r=dmik) why is it used as if it always returns a full path while 246 /// it actually may not? 247 209 248 if (!mPath.isNull()) 210 249 { 211 if (mMode == PathMode) 212 return QDir (mPath).path(); 213 else 214 return QFileInfo (mPath).filePath(); 215 } 216 217 return mNoneTip; 250 switch (mMode) 251 { 252 case Mode_Folder: 253 return QDir (mPath).path(); 254 case Mode_File: 255 return QFileInfo (mPath).filePath(); 256 default: 257 AssertFailedBreak(); 258 } 259 } 260 261 return QString::null; 218 262 } 219 263 220 264 QString VBoxFilePathSelectorWidget::shrinkText (int aWidth) const 221 265 { 222 /* Full text stored in toolTip */ 223 QString fullText = toolTip(); 266 QString fullText = filePath(); 224 267 if (fullText.isEmpty()) 225 268 return fullText; … … 257 300 int newSize = fontMetrics().width (fullText); 258 301 259 return newSize < oldSize ? fullText : toolTip();302 return newSize < oldSize ? fullText : filePath(); 260 303 } 261 304 … … 265 308 { 266 309 if (itemText (PathId) != mNoneStr) 310 { 267 311 setItemText (PathId, mNoneStr); 312 setItemIcon (PathId, QIcon()); 313 setItemData (PathId, mNoneTip, Qt::ToolTipRole); 314 setToolTip (mNoneTip); 315 } 268 316 } 269 317 else … … 275 323 QStyle::CC_ComboBox, &options, QStyle::SC_ComboBoxEditField); 276 324 setItemText (PathId, shrinkText (rect.width() - iconSize().width())); 277 } 278 } 279 325 326 /* Attach corresponding icon */ 327 setItemIcon (PathId, QFileInfo (mPath).exists() ? 328 mIconProvider->icon (QFileInfo (mPath)) : 329 defaultIcon()); 330 331 /* Store full path as tooltip */ 332 setToolTip (filePath()); 333 setItemData (PathId, toolTip(), Qt::ToolTipRole); 334 } 335 } 336 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGLSettingsGeneral.cpp
r11229 r11361 31 31 Ui::VBoxGLSettingsGeneral::setupUi (this); 32 32 33 mPsVRDP->setMode (VBoxFilePathSelectorWidget:: FileMode);33 mPsVRDP->setMode (VBoxFilePathSelectorWidget::Mode_File); 34 34 35 35 /* Setup connections */ … … 76 76 Ui::VBoxGLSettingsGeneral::retranslateUi (this); 77 77 78 mPsVdi->setWhatsThis (tr ("Displays the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.")); 79 mPsVdi->setNoneToolTip (tr ("The actual default path will be displayed after accepting the changes and opening this dialog again.")); 80 mPsVdi->setSelectToolTip (tr ("Opens a dialog to select the default VDI folder.")); 81 mPsVdi->setResetToolTip (tr ("Resets the VDI folder path to the default value.")); 82 83 mPsMach->setWhatsThis (tr ("Displays the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.")); 84 mPsMach->setNoneToolTip (tr ("The actual default path will be displayed after accepting the changes and opening this dialog again.")); 85 mPsMach->setSelectToolTip (tr ("Opens a dialog to select the default virtual machine folder.")); 86 mPsMach->setResetToolTip (tr ("Resets the virtual machine folder path to the default value.")); 87 88 mPsVRDP->setWhatsThis (tr ("Displays the path to the library that provides authentication for Remote Display (VRDP) clients.")); 89 mPsVRDP->setNoneToolTip (tr ("The actual default library file will be displayed after accepting the changes and opening this dialog again.")); 90 mPsVRDP->setSelectToolTip (tr ("Opens a dialog to select the VRDP authentication library file.")); 91 mPsVRDP->setResetToolTip (tr ("Resets the authentication library file to the default value.")); 78 mPsVdi->setWhatsThis (tr ("Displays the path to the default VDI folder. " 79 "This folder is used, if not explicitly " 80 "specified otherwise, when adding existing or " 81 "creating new virtual hard disks.")); 82 mPsMach->setWhatsThis (tr ("Displays the path to the default virtual " 83 "machine folder. This folder is used, if not " 84 "explicitly specified otherwise, when creating " 85 "new virtual machines.")); 86 mPsVRDP->setWhatsThis (tr ("Displays the path to the library that " 87 "provides authentication for Remote Display " 88 "(VRDP) clients.")); 92 89 } 93 90 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsGeneral.cpp
r11229 r11361 377 377 378 378 /* Path selector */ 379 mPsSnapshot->setWhatsThis (tr ("Displays the path where snapshots of this virtual machine will be stored. Note that snapshots can take quite a lot of disk space."));380 mPsSnapshot->setNoneToolTip (tr ("The actual default path will be displayed after accepting the changes and opening this dialog again."));381 mPsSnapshot->setSelectToolTip (tr ("Selects the snapshot folder path."));382 mPsSnapshot->setResetToolTip (tr ("Resets the snapshot folder path to the default value."));379 mPsSnapshot->setWhatsThis (tr ("Displays the path where snapshots of this " 380 "virtual machine will be stored. Note that " 381 "snapshots can take quite a lot of disk " 382 "space.")); 383 383 } 384 384 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsSFDetails.cpp
r11229 r11361 115 115 Ui::VBoxVMSettingsSFDetails::retranslateUi (this); 116 116 117 mPsPath->setNoneToolTip (tr ("No shared folder path is currently selected."));118 mPsPath->setSelectToolTip (tr ("Selects shared folder path."));119 120 117 switch (mType) 121 118 {
Note:
See TracChangeset
for help on using the changeset viewer.