Changeset 2492 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 4, 2007 10:49:54 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20922
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r2458 r2492 140 140 void prepareFloppyMenu(); 141 141 void prepareDVDMenu(); 142 143 142 void prepareNetworkMenu(); 144 void activateNetworkMenu (int); 143 144 void highlightFloppy (int); 145 void highlightDVD (int); 146 void highlightNetworkMenu (int); 147 148 void hideFloppyMenu(); 149 void hideDVDMenu(); 150 void hideNetworkMenu(); 145 151 146 152 void captureFloppy (int id); 147 153 void captureDVD (int id); 154 void activateNetworkMenu (int); 148 155 void switchUSB (int id); 149 156 void activateSFMenu(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r2458 r2492 168 168 169 169 CMachine mMachine; 170 }; 171 172 /** class StatusTipEvent 173 * 174 * The StatusTipEvent class is an auxiliary QEvent class 175 * for carrying statusTip text of non-QAction menu item's. 176 * This event is posted then the menu item is highlighted but 177 * processed later in VBoxConsoleWnd::event() handler to 178 * avoid statusBar messaging collisions. 179 */ 180 class StatusTipEvent : public QEvent 181 { 182 public: 183 enum { Type = QEvent::User + 10 }; 184 StatusTipEvent (const QString &aTip) 185 : QEvent ((QEvent::Type) Type), mTip (aTip) {} 186 187 QString mTip; 170 188 }; 171 189 … … 547 565 connect (devicesNetworkMenu, SIGNAL(activated(int)), this, SLOT(activateNetworkMenu(int))); 548 566 567 connect (devicesMountFloppyMenu, SIGNAL(highlighted(int)), this, SLOT(highlightFloppy(int))); 568 connect (devicesMountDVDMenu, SIGNAL(highlighted(int)), this, SLOT(highlightDVD(int))); 569 connect (devicesNetworkMenu, SIGNAL(highlighted(int)), this, SLOT(highlightNetworkMenu(int))); 570 571 connect (devicesMountFloppyMenu, SIGNAL(aboutToHide()), this, SLOT(hideFloppyMenu())); 572 connect (devicesMountDVDMenu, SIGNAL(aboutToHide()), this, SLOT(hideDVDMenu())); 573 connect (devicesNetworkMenu, SIGNAL(aboutToHide()), this, SLOT(hideNetworkMenu())); 574 549 575 connect (helpWebAction, SIGNAL (activated()), 550 576 &vboxProblem(), SLOT (showHelpWebDialog())); … … 1016 1042 #endif 1017 1043 } 1044 break; 1045 } 1046 case StatusTipEvent::Type: 1047 { 1048 StatusTipEvent *ev = (StatusTipEvent*) e; 1049 ((QMainWindow*)this)->statusBar()->message (ev->mTip); 1018 1050 break; 1019 1051 } … … 2163 2195 2164 2196 /** 2197 * Sets the statusTip text for the highlighted host floppy drive 2198 */ 2199 void VBoxConsoleWnd::highlightFloppy (int aId) 2200 { 2201 QString tip = hostFloppyMap.find (aId) != hostFloppyMap.end() ? 2202 tr ("Mount the physical drive of the host PC") : 2203 QString::null; 2204 if (!tip.isNull()) 2205 { 2206 StatusTipEvent *ev = new StatusTipEvent (tip); 2207 QApplication::postEvent (this, ev); 2208 } 2209 } 2210 2211 /** 2212 * Sets the statusTip text for the highlighted host cd/dvd drive 2213 */ 2214 void VBoxConsoleWnd::highlightDVD (int aId) 2215 { 2216 QString tip = hostDVDMap.find (aId) != hostDVDMap.end() ? 2217 tr ("Mount the physical drive of the host PC") : 2218 QString::null; 2219 if (!tip.isNull()) 2220 { 2221 StatusTipEvent *ev = new StatusTipEvent (tip); 2222 QApplication::postEvent (this, ev); 2223 } 2224 } 2225 2226 /** 2227 * Sets the statusTip text for the highlighted adaptor 2228 */ 2229 void VBoxConsoleWnd::highlightNetworkMenu (int aId) 2230 { 2231 QString tip = !devicesNetworkMenu->isItemEnabled (aId) ? 2232 tr ("This adaptor is not enabled") : 2233 devicesNetworkMenu->isItemChecked (aId) ? 2234 tr ("Disconnect the cable from the virtual network adapter") : 2235 tr ("Connect the cable to the virtual network adapter"); 2236 StatusTipEvent *ev = new StatusTipEvent (tip); 2237 QApplication::postEvent (this, ev); 2238 } 2239 2240 /** 2241 * Clears the statusTip text for the led context floppy drive menu 2242 */ 2243 void VBoxConsoleWnd::hideFloppyMenu() 2244 { 2245 if (devicesMenu->itemParameter (devicesMountFloppyMenuId)) 2246 ((QMainWindow*)this)->statusBar()->clear(); 2247 } 2248 2249 /** 2250 * Clears the statusTip text for the led context cd/dvd drive menu 2251 */ 2252 void VBoxConsoleWnd::hideDVDMenu() 2253 { 2254 if (devicesMenu->itemParameter (devicesMountDVDMenuId)) 2255 ((QMainWindow*)this)->statusBar()->clear(); 2256 } 2257 2258 /** 2259 * Clears the statusTip text for the led context network adapters menu 2260 */ 2261 void VBoxConsoleWnd::hideNetworkMenu() 2262 { 2263 if (devicesMenu->itemParameter (devicesNetworkMenuId)) 2264 ((QMainWindow*)this)->statusBar()->clear(); 2265 } 2266 2267 /** 2165 2268 * Captures a floppy device corresponding to a given menu id. 2166 2269 */ … … 2307 2410 if (ind == net_light) 2308 2411 { 2412 devicesMenu->setItemParameter (devicesNetworkMenuId, 1); 2309 2413 devicesNetworkMenu->exec (e->globalPos()); 2414 devicesMenu->setItemParameter (devicesNetworkMenuId, 0); 2310 2415 } 2311 2416 }
Note:
See TracChangeset
for help on using the changeset viewer.