Changeset 85571 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 31, 2020 7:22:55 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139640
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r85434 r85571 2248 2248 setStatusTip(QApplication::translate("UIActionPool", "Show the properties of currently selected file object(s)")); 2249 2249 setToolTip( QApplication::translate("UIActionPool", "Show Properties of Current Object(s)") 2250 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2251 } 2252 }; 2253 2254 2255 /** Menu action extension, used as 'Performance' menu class. */ 2256 class UIActionMenuSelectorPerformance : public UIActionMenu 2257 { 2258 Q_OBJECT; 2259 2260 public: 2261 2262 /** Constructs action passing @a pParent to the base-class. */ 2263 UIActionMenuSelectorPerformance(UIActionPool *pParent) 2264 : UIActionMenu(pParent) 2265 {} 2266 2267 protected: 2268 2269 /** Returns shortcut extra-data ID. */ 2270 virtual QString shortcutExtraDataID() const /* override */ 2271 { 2272 return QString("PerformanceMenu"); 2273 } 2274 2275 /** Handles translation event. */ 2276 virtual void retranslateUi() /* override */ 2277 { 2278 setName(QApplication::translate("UIActionPool", "&Performance")); 2279 } 2280 }; 2281 2282 /** Simple action extension, used as 'Export' action class. */ 2283 class UIActionMenuSelectorPerformanceExport : public UIActionSimple 2284 { 2285 Q_OBJECT; 2286 2287 public: 2288 2289 /** Constructs action passing @a pParent to the base-class. */ 2290 UIActionMenuSelectorPerformanceExport(UIActionPool *pParent) 2291 : UIActionSimple(pParent, 2292 ":/log_viewer_save_32px.png", ":/log_viewer_save_16px.png", 2293 ":/log_viewer_save_disabled_32px.png", ":/log_viewer_save_disabled_16px.png") 2294 { 2295 setShortcutContext(Qt::WidgetWithChildrenShortcut); 2296 } 2297 2298 protected: 2299 2300 /** Returns shortcut extra-data ID. */ 2301 virtual QString shortcutExtraDataID() const /* override */ 2302 { 2303 return QString("ExportCharts"); 2304 } 2305 2306 /** Handles translation event. */ 2307 virtual void retranslateUi() /* override */ 2308 { 2309 setName(QApplication::translate("UIActionPool", "&Export...")); 2310 setShortcutScope(QApplication::translate("UIActionPool", "Performance Monitor")); 2311 setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file")); 2312 setToolTip( QApplication::translate("UIActionPool", "Export Data to File") 2250 2313 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2251 2314 } … … 2501 2564 m_pool[UIActionIndex_M_FileManager_S_Guest_ShowProperties] = new UIActionMenuFileManagerShowProperties(this); 2502 2565 2566 /* Performance Monitor actions: */ 2567 m_pool[UIActionIndex_M_Performance] = new UIActionMenuSelectorPerformance(this); 2568 m_pool[UIActionIndex_M_Performance_S_Export] = new UIActionMenuSelectorPerformanceExport(this); 2569 2503 2570 /* Prepare update-handlers for known menus: */ 2504 2571 #ifdef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r85434 r85571 136 136 UIActionIndex_M_FileManager_S_Guest_ShowProperties, 137 137 138 /* Performance Monitor actions: */ 139 UIActionIndex_M_Performance, 140 UIActionIndex_M_Performance_S_Export, 141 138 142 /* Maximum index: */ 139 143 UIActionIndex_Max -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r85547 r85571 2145 2145 setStatusTip(QApplication::translate("UIActionPool", "Clone selected virtual machine")); 2146 2146 setToolTip( QApplication::translate("UIActionPool", "Clone Virtual Machine") 2147 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));2148 }2149 };2150 2151 2152 /** Menu action extension, used as 'Performance' menu class. */2153 class UIActionMenuSelectorPerformance : public UIActionMenu2154 {2155 Q_OBJECT;2156 2157 public:2158 2159 /** Constructs action passing @a pParent to the base-class. */2160 UIActionMenuSelectorPerformance(UIActionPool *pParent)2161 : UIActionMenu(pParent)2162 {}2163 2164 protected:2165 2166 /** Returns shortcut extra-data ID. */2167 virtual QString shortcutExtraDataID() const /* override */2168 {2169 return QString("PerformanceMenu");2170 }2171 2172 /** Handles translation event. */2173 virtual void retranslateUi() /* override */2174 {2175 setName(QApplication::translate("UIActionPool", "&Performance"));2176 }2177 };2178 2179 /** Simple action extension, used as 'Export' action class. */2180 class UIActionMenuSelectorPerformanceExport : public UIActionSimple2181 {2182 Q_OBJECT;2183 2184 public:2185 2186 /** Constructs action passing @a pParent to the base-class. */2187 UIActionMenuSelectorPerformanceExport(UIActionPool *pParent)2188 : UIActionSimple(pParent,2189 ":/log_viewer_save_32px.png", ":/log_viewer_save_16px.png",2190 ":/log_viewer_save_disabled_32px.png", ":/log_viewer_save_disabled_16px.png")2191 {2192 setShortcutContext(Qt::WidgetWithChildrenShortcut);2193 }2194 2195 protected:2196 2197 /** Returns shortcut extra-data ID. */2198 virtual QString shortcutExtraDataID() const /* override */2199 {2200 return QString("ExportCharts");2201 }2202 2203 /** Handles translation event. */2204 virtual void retranslateUi() /* override */2205 {2206 setName(QApplication::translate("UIActionPool", "&Export..."));2207 setShortcutScope(QApplication::translate("UIActionPool", "Performance Monitor"));2208 setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file"));2209 setToolTip( QApplication::translate("UIActionPool", "Export Data to File")2210 2147 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2211 2148 } … … 3538 3475 m_pool[UIActionIndexST_M_Snapshot_T_Properties] = new UIActionMenuSelectorSnapshotToggleProperties(this); 3539 3476 m_pool[UIActionIndexST_M_Snapshot_S_Clone] = new UIActionMenuSelectorSnapshotPerformClone(this); 3540 3541 /* Performance Monitor actions: */3542 m_pool[UIActionIndex_M_Performance] = new UIActionMenuSelectorPerformance(this);3543 m_pool[UIActionIndex_M_Performance_S_Export] = new UIActionMenuSelectorPerformanceExport(this);3544 3477 3545 3478 /* Virtual Medium Manager actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
r85547 r85571 149 149 UIActionIndexST_M_Snapshot_S_Clone, 150 150 151 /* Performance Monitor actions: */152 UIActionIndex_M_Performance,153 UIActionIndex_M_Performance_S_Export,154 155 151 /* Virtual Media Manager actions: */ 156 152 UIActionIndexST_M_MediumWindow, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r85406 r85571 193 193 case UIToolType_Performance: 194 194 { 195 m_pPanePerformanceMonitor = new UIPerformanceMonitor(EmbedTo_Stack, 0, m_comMachine, false /* Show toolbar */); 195 m_pPanePerformanceMonitor = new UIPerformanceMonitor(EmbedTo_Stack, 0, 196 m_comMachine, m_pActionPool, false /* Show toolbar */); 196 197 AssertPtrReturnVoid(m_pPanePerformanceMonitor); 197 198 #ifndef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.cpp
r85568 r85571 29 29 /* GUI includes: */ 30 30 #include "QIFileDialog.h" 31 #include "UIActionPool.h" 31 32 #include "UICommon.h" 32 33 #include "UIPerformanceMonitor.h" … … 722 723 } 723 724 724 void UIMetric::toFile(QFile &file) const 725 { 726 QTextStream stream(&file); 727 stream << m_strName << "\n"; 725 void UIMetric::toFile(QTextStream &stream) const 726 { 727 stream << "Metric Name: " << m_strName << "\n"; 728 stream << "Unit: " << m_strUnit << "\n"; 729 stream << "Maximum: " << m_iMaximum << "\n"; 728 730 foreach (const quint64& data, m_data[0]) 729 stream << data; 731 stream << data << " "; 732 stream << "\n"; 733 foreach (const quint64& data, m_data[1]) 734 stream << data << " "; 735 stream << "\n\n"; 730 736 } 731 737 … … 735 741 736 742 UIPerformanceMonitor::UIPerformanceMonitor(EmbedTo enmEmbedding, QWidget *pParent, 737 const CMachine &machine, bool fShowToolbar /* = false */)743 const CMachine &machine, UIActionPool *pActionPool, bool fShowToolbar /* = false */) 738 744 : QIWithRetranslateUI<QWidget>(pParent) 739 745 , m_fGuestAdditionsAvailable(false) … … 750 756 , m_enmEmbedding(enmEmbedding) 751 757 , m_fShowToolbar(fShowToolbar) 758 , m_pActionPool(pActionPool) 752 759 { 753 760 prepareMetrics(); … … 755 762 if (fShowToolbar) 756 763 prepareToolBar(); 764 prepareActions(); 757 765 retranslateUi(); 758 766 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange, this, &UIPerformanceMonitor::sltMachineStateChange); … … 991 999 QString strFileName = QIFileDialog::getSaveFileName("","",this, ""); 992 1000 993 QFile data (strFileName);994 if (data .open(QFile::WriteOnly | QFile::Truncate)) {995 1001 QFile dataFile(strFileName); 1002 if (dataFile.open(QFile::WriteOnly | QFile::Truncate)) { 1003 QTextStream stream(&dataFile); 996 1004 for (QMap<QString, UIMetric>::const_iterator iterator = m_metrics.begin(); 997 1005 iterator != m_metrics.end(); ++iterator) 998 1006 { 999 iterator.value().toFile( data);1007 iterator.value().toFile(stream); 1000 1008 } 1001 data.close(); 1002 1003 // QTextStream out(&data); 1004 // out << "Result: " << qSetFieldWidth(10) << left << 3.14 << 2.7; 1005 // writes "Result: 3.14 2.7 " 1009 dataFile.close(); 1006 1010 } 1007 1008 1009 1011 } 1010 1012 … … 1088 1090 #endif 1089 1091 } 1090 // QAction *pAction = 1091 // actionPool()->action(UIActionIndex_M_Performance_S_Export); 1092 // if (pAction) 1093 // connect(pAction, &QAction::triggered, this, &UIPerformanceMonitor::sltExportMetricsToFile); 1092 } 1093 1094 void UIPerformanceMonitor::prepareActions() 1095 { 1096 QAction *pAction = 1097 m_pActionPool->action(UIActionIndex_M_Performance_S_Export); 1098 if (pAction) 1099 connect(pAction, &QAction::triggered, this, &UIPerformanceMonitor::sltExportMetricsToFile); 1094 1100 } 1095 1101 -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.h
r85568 r85571 45 45 class QVBoxLayout; 46 46 class QLabel; 47 class UIActionPool; 47 48 class UIChart; 48 49 class UISession; … … 82 83 void reset(); 83 84 84 void toFile(Q File &file) const;85 void toFile(QTextStream &stream) const; 85 86 86 87 private: … … 115 116 /** Constructs information-tab passing @a pParent to the QWidget base-class constructor. 116 117 * @param machine is machine reference. */ 117 UIPerformanceMonitor(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine, bool fShowToolbar = false); 118 UIPerformanceMonitor(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine, 119 UIActionPool *pActionPool,bool fShowToolbar = false); 118 120 ~UIPerformanceMonitor(); 119 121 void setMachine(const CMachine &machine); … … 147 149 void prepareMetrics(); 148 150 void prepareToolBar(); 151 void prepareActions(); 149 152 bool guestAdditionsAvailable(int iMinimumMajorVersion); 150 153 void enableDisableGuestAdditionDependedWidgets(bool fEnable); … … 239 242 EmbedTo m_enmEmbedding; 240 243 bool m_fShowToolbar; 244 UIActionPool *m_pActionPool; 241 245 }; 242 246 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r85406 r85571 200 200 /* Create Performance Monitor tab: */ 201 201 UIPerformanceMonitor *pPerformanceMonitorWidget = 202 new UIPerformanceMonitor(EmbedTo_Dialog, this, m_pMachineWindow->machine()); 202 new UIPerformanceMonitor(EmbedTo_Dialog, this, m_pMachineWindow->machine(), 203 m_pMachineWindow->uisession()->actionPool()); 203 204 if (pPerformanceMonitorWidget) 204 205 {
Note:
See TracChangeset
for help on using the changeset viewer.