From b6a30503fb36c4384ef5ea7c99cefc45b8f4860c Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Wed, 19 Aug 2015 11:56:38 +0900 Subject: [PATCH] menu: get drive/swap image path from emul_state Change-Id: I5365501c148a0f0fda26ecc3d4244673be4786f0 Signed-off-by: GiWoong Kim --- tizen/src/ui/menu/detailedinfodialog.cpp | 58 ++++++++++-------------- tizen/src/ui/menu/detailedinfodialog.h | 4 +- tizen/src/ui/resource/ui_strings.h | 5 +- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/tizen/src/ui/menu/detailedinfodialog.cpp b/tizen/src/ui/menu/detailedinfodialog.cpp index bf7e81f60f..5ded7ab252 100644 --- a/tizen/src/ui/menu/detailedinfodialog.cpp +++ b/tizen/src/ui/menu/detailedinfodialog.cpp @@ -36,9 +36,6 @@ extern "C" { int get_display_pixel_density(void); } -extern int _qemu_argc; -extern char **_qemu_argv; - #define TABLE_BORDER_SIZE 2 #define TAB_BORDER_SIZE 4 #define DIALOG_HORIZ_SPACE 20 @@ -142,20 +139,29 @@ QTableWidget *DetailedInfoDialog::createVmInfoTable() (is_gpu_accel_enabled()) ? QString(GENERIC_TEXT_ENABLED) : QString(GENERIC_TEXT_DISABLED)); - QStringList imagePathList = getImagePathList(); - for (int i = 0; i < imagePathList.size(); i++) { - insertTableRow(vmInfoTable, QString(DETAILED_INFO_IMAGE_PATH) + - " " + QString::number(i + 1), QString(imagePathList[i]), - QString(imagePathList[i])); + QString drive_image_file(get_drive_image_file()); + if (drive_image_file.isEmpty() == false) { + insertTableRow(vmInfoTable, QString(DETAILED_INFO_DRIVE_IMAGE_FILE), + drive_image_file, drive_image_file); + } + + QString swap_image_file(get_swap_image_file()); + if (swap_image_file.isEmpty() == false) { + insertTableRow(vmInfoTable, QString(DETAILED_INFO_SWAP_IMAGE_FILE), + swap_image_file, swap_image_file); } QString log_redirect_file(get_log_redirect_file()); - insertTableRow(vmInfoTable, QString(DETAILED_INFO_LOG_FILE), - log_redirect_file, log_redirect_file); + if (log_redirect_file.isEmpty() == false) { + insertTableRow(vmInfoTable, QString(DETAILED_INFO_EMUL_LOG_FILE), + log_redirect_file, log_redirect_file); + } QString kernel_log_redirect_file(get_kernel_log_redirect_file()); - insertTableRow(vmInfoTable, QString(DETAILED_INFO_KERNEL_LOG_FILE), - kernel_log_redirect_file, kernel_log_redirect_file); + if (kernel_log_redirect_file.isEmpty() == false) { + insertTableRow(vmInfoTable, QString(DETAILED_INFO_KERNEL_LOG_FILE), + kernel_log_redirect_file, kernel_log_redirect_file); + } #if 0 insertTableRow(vmInfoTable, DETAILED_INFO_TELNET_PORT, @@ -306,11 +312,12 @@ void DetailedInfoDialog::resizeTableToContents(QTableWidget *table) void DetailedInfoDialog::insertTableRow(QTableWidget *table, const QString& key, const QString& value, const QString& tooltip) { - int row = table->rowCount(); + const int row = table->rowCount(); table->insertRow(row); table->setItem(row, 0, new QTableWidgetItem(key)); - QTableWidgetItem* item = new QTableWidgetItem(value); + QTableWidgetItem *item = new QTableWidgetItem(value); table->setItem(row, 1, item); + if (!tooltip.isNull() && !tooltip.isEmpty()) { item->setToolTip(tooltip); } @@ -330,22 +337,6 @@ void DetailedInfoDialog::removeTableRows( } } -QStringList DetailedInfoDialog::getImagePathList() -{ - QStringList imagePathList; - for (int i = 0; i <_qemu_argc; i++) { - if (QString(_qemu_argv[i]).compare("-drive") == 0) { - i += 1; - QStringList splitString = QString(_qemu_argv[i]).split(","); - QStringList splitString2 = splitString[0].split("="); - QString drivePath = splitString2[splitString2.length() -1]; - imagePathList << drivePath; - } - } - qDebug() << imagePathList; - return imagePathList; -} - void DetailedInfoDialog::slotCellOpen(int nRow, int nCol) { if (nCol <= 0 || nRow >= vmInfoTable->rowCount()) { @@ -356,9 +347,10 @@ void DetailedInfoDialog::slotCellOpen(int nRow, int nCol) qDebug() << item->text() << "item was double clicked"; if (item->text().compare(DETAILED_INFO_HDS_PATH) == 0 || - item->text().compare(DETAILED_INFO_LOG_FILE) == 0 || + item->text().compare(DETAILED_INFO_EMUL_LOG_FILE) == 0 || item->text().compare(DETAILED_INFO_KERNEL_LOG_FILE) == 0 || - item->text().startsWith(DETAILED_INFO_IMAGE_PATH) == true) { + item->text().compare(DETAILED_INFO_DRIVE_IMAGE_FILE) == 0 || + item->text().compare(DETAILED_INFO_SWAP_IMAGE_FILE) == 0) { /* get path item */ item = vmInfoTable->item(nRow, nCol); @@ -384,8 +376,6 @@ void DetailedInfoDialog::slotCellOpen(int nRow, int nCol) } else { qWarning() << "invalid path info:" << item->text(); } - - return; } DetailedInfoDialog::~DetailedInfoDialog() diff --git a/tizen/src/ui/menu/detailedinfodialog.h b/tizen/src/ui/menu/detailedinfodialog.h index 0191752e91..fb0946ec22 100644 --- a/tizen/src/ui/menu/detailedinfodialog.h +++ b/tizen/src/ui/menu/detailedinfodialog.h @@ -67,8 +67,6 @@ private: QTableWidget *createShortcutInfoTable(); void resizeTableToContents(QTableWidget *table); - QStringList getImagePathList(); // TODO: - MainWindow *win; QVBoxLayout *baseLayout; QHBoxLayout *upsideLayout; @@ -77,7 +75,7 @@ private: QTabWidget *tabWidget; QTableWidget *vmInfoTable; QTableWidget *shortcutInfoTable; - KeyboardShortcut* keyboardShortcut; + KeyboardShortcut *keyboardShortcut; }; #endif // DETAILEDINFO_DIALOG_H diff --git a/tizen/src/ui/resource/ui_strings.h b/tizen/src/ui/resource/ui_strings.h index 9c20669f83..a2d2ddb8e6 100644 --- a/tizen/src/ui/resource/ui_strings.h +++ b/tizen/src/ui/resource/ui_strings.h @@ -95,8 +95,9 @@ #define DETAILED_INFO_HDS_PATH "File Sharing Path" #define DETAILED_INFO_CPU_VT "CPU Virtualization" #define DETAILED_INFO_GPU_VT "GPU Virtualization" -#define DETAILED_INFO_IMAGE_PATH "Image Path" -#define DETAILED_INFO_LOG_FILE "Emulator Log File" +#define DETAILED_INFO_DRIVE_IMAGE_FILE "Target Image File" +#define DETAILED_INFO_SWAP_IMAGE_FILE "Swap Image File" +#define DETAILED_INFO_EMUL_LOG_FILE "Emulator Log File" #define DETAILED_INFO_KERNEL_LOG_FILE "Kernel Log File" #define DETAILED_INFO_TELNET_PORT "Logging Telnet Port" -- 2.34.1