menu: get drive/swap image path from emul_state
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 19 Aug 2015 02:56:38 +0000 (11:56 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 19 Aug 2015 04:33:43 +0000 (13:33 +0900)
Change-Id: I5365501c148a0f0fda26ecc3d4244673be4786f0
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/menu/detailedinfodialog.cpp
tizen/src/ui/menu/detailedinfodialog.h
tizen/src/ui/resource/ui_strings.h

index bf7e81f60ff70b66e06bce62684cba5ed7e5db23..5ded7ab2522800c678dc9292b179d870498f487d 100644 (file)
@@ -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));
-    QTableWidgetItemitem = 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()
index 0191752e919bd280f3c91c7a4c88d5af4488deda..fb0946ec222e483dad409a19a068658dfb482f45 100644 (file)
@@ -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;
-    KeyboardShortcutkeyboardShortcut;
+    KeyboardShortcut *keyboardShortcut;
 };
 
 #endif // DETAILEDINFO_DIALOG_H
index 9c20669f8310c136cd87094287be56bfb02c73f1..a2d2ddb8e6b745d9333e8cb42dbb2a4d6339a5a1 100644 (file)
@@ -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"