menu: no need to delete child widgets manually at Detailed Info dialog
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 19 Aug 2015 06:09:08 +0000 (15:09 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 20 Aug 2015 01:50:56 +0000 (10:50 +0900)
Change-Id: I01cb9195c21fe3706d7afc3f0f1e2f8b0cd88829
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/menu/detailedinfodialog.cpp

index 5ded7ab2522800c678dc9292b179d870498f487d..8ca07ea6a4744bf148a21e3feab99ebaf0da3b6e 100644 (file)
@@ -68,12 +68,12 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) :
     tabWidget = new QTabWidget(this);
 
     /* VM information table */
-    QTableWidget *vmInfo = createVmInfoTable();
-    tabWidget->addTab(vmInfo, tr(DETAILED_INFO_VMTAB_TITLE));
+    vmInfoTable = createVmInfoTable();
+    tabWidget->addTab(vmInfoTable, tr(DETAILED_INFO_VMTAB_TITLE));
 
     /* shortcut info table */
-    QTableWidget *shortcutInfo = createShortcutInfoTable();
-    tabWidget->addTab(shortcutInfo, tr(DETAILED_INFO_SHORTCUTTAB_TITLE));
+    shortcutInfoTable = createShortcutInfoTable();
+    tabWidget->addTab(shortcutInfoTable, tr(DETAILED_INFO_SHORTCUTTAB_TITLE));
     upsideLayout->addWidget(tabWidget);
 
     baseLayout->addLayout(upsideLayout);
@@ -94,104 +94,104 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) :
 
 QTableWidget *DetailedInfoDialog::createVmInfoTable()
 {
-    vmInfoTable = new QTableWidget();
+    QTableWidget *vmInfo = new QTableWidget();
 
     /* horizontal headers */
     QStringList headers;
     headers << DETAILED_INFO_VMTAB_HEADER1 << DETAILED_INFO_VMTAB_HEADER2;
 
-    vmInfoTable->setColumnCount(headers.count());
-    vmInfoTable->setHorizontalHeaderLabels(headers);
-    vmInfoTable->horizontalHeader()->setStretchLastSection(true);
-    vmInfoTable->verticalHeader()->hide();
+    vmInfo->setColumnCount(headers.count());
+    vmInfo->setHorizontalHeaderLabels(headers);
+    vmInfo->horizontalHeader()->setStretchLastSection(true);
+    vmInfo->verticalHeader()->hide();
 
-    vmInfoTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
-    vmInfoTable->setAlternatingRowColors(true);
+    vmInfo->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    vmInfo->setAlternatingRowColors(true);
 
     /* insert table items */
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_VM_NAME),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_VM_NAME),
         win->uiInfo->vmName);
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_SKIN_NAME),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_SKIN_NAME),
         win->uiInfo->skinName);
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_CPU), "x86");
+    insertTableRow(vmInfo, QString(DETAILED_INFO_CPU), "x86");
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_RAM_SIZE),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_RAM_SIZE),
         QString::number(get_ram_size() >> 20) + " MiB");
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_DPY_RESOLUTION),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_DPY_RESOLUTION),
         QString::number(win->uiInfo->resolution.width()) + "x" +
         QString::number(win->uiInfo->resolution.height()));
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_DPY_DENSITY),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_DPY_DENSITY),
         QString::number(get_display_pixel_density()));
 
     QString sharingPath(get_host_directory_sharing_path());
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_HDS_PATH),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_HDS_PATH),
         (sharingPath.isEmpty()) ? QString(GENERIC_TEXT_NONE) : sharingPath);
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_CPU_VT),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_CPU_VT),
         (get_emul_cpu_accel()) ?
         QString(GENERIC_TEXT_ENABLED) : QString(GENERIC_TEXT_DISABLED));
 
-    insertTableRow(vmInfoTable, QString(DETAILED_INFO_GPU_VT),
+    insertTableRow(vmInfo, QString(DETAILED_INFO_GPU_VT),
         (is_gpu_accel_enabled()) ?
         QString(GENERIC_TEXT_ENABLED) : QString(GENERIC_TEXT_DISABLED));
 
     QString drive_image_file(get_drive_image_file());
     if (drive_image_file.isEmpty() == false) {
-        insertTableRow(vmInfoTable, QString(DETAILED_INFO_DRIVE_IMAGE_FILE),
+        insertTableRow(vmInfo, 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),
+        insertTableRow(vmInfo, QString(DETAILED_INFO_SWAP_IMAGE_FILE),
             swap_image_file, swap_image_file);
     }
 
     QString log_redirect_file(get_log_redirect_file());
     if (log_redirect_file.isEmpty() == false) {
-        insertTableRow(vmInfoTable, QString(DETAILED_INFO_EMUL_LOG_FILE),
+        insertTableRow(vmInfo, QString(DETAILED_INFO_EMUL_LOG_FILE),
             log_redirect_file, log_redirect_file);
     }
 
     QString kernel_log_redirect_file(get_kernel_log_redirect_file());
     if (kernel_log_redirect_file.isEmpty() == false) {
-        insertTableRow(vmInfoTable, QString(DETAILED_INFO_KERNEL_LOG_FILE),
+        insertTableRow(vmInfo, QString(DETAILED_INFO_KERNEL_LOG_FILE),
             kernel_log_redirect_file, kernel_log_redirect_file);
     }
 
 #if 0
-    insertTableRow(vmInfoTable, DETAILED_INFO_TELNET_PORT,
-        QString::number(get_emul_serial_port()), index++);
+    insertTableRow(vmInfo, DETAILED_INFO_TELNET_PORT,
+        QString::number(get_emul_serial_port()));
 #endif
 
     /* add double click event listener */
-    connect(vmInfoTable, SIGNAL(cellDoubleClicked(int, int)),
+    connect(vmInfo, SIGNAL(cellDoubleClicked(int, int)),
         this, SLOT(slotCellOpen(int, int)));
 
-    return vmInfoTable;
+    return vmInfo;
 }
 
 QTableWidget *DetailedInfoDialog::createShortcutInfoTable()
 {
-    shortcutInfoTable = new QTableWidget();
+    QTableWidget *shortcutInfo = new QTableWidget();
 
     /* horizontal headers */
     QStringList headers;
     headers << DETAILED_INFO_SHORTCUTTAB_HEADER1 << DETAILED_INFO_SHORTCUTTAB_HEADER2;
 
-    shortcutInfoTable->setColumnCount(headers.count());
-    shortcutInfoTable->setHorizontalHeaderLabels(headers);
-    shortcutInfoTable->horizontalHeader()->setStretchLastSection(true);
-    shortcutInfoTable->verticalHeader()->hide();
+    shortcutInfo->setColumnCount(headers.count());
+    shortcutInfo->setHorizontalHeaderLabels(headers);
+    shortcutInfo->horizontalHeader()->setStretchLastSection(true);
+    shortcutInfo->verticalHeader()->hide();
 
-    shortcutInfoTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
-    shortcutInfoTable->setAlternatingRowColors(true);
+    shortcutInfo->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    shortcutInfo->setAlternatingRowColors(true);
 
-    return shortcutInfoTable;
+    return shortcutInfo;
 }
 
 void DetailedInfoDialog::updateShortcutTableItems()
@@ -381,21 +381,4 @@ void DetailedInfoDialog::slotCellOpen(int nRow, int nCol)
 DetailedInfoDialog::~DetailedInfoDialog()
 {
     qDebug("destroy detailed info dialog");
-
-    if (vmInfoTable) {
-        delete vmInfoTable;
-        vmInfoTable = NULL;
-    }
-    if (upsideLayout) {
-        delete upsideLayout;
-        upsideLayout = NULL;
-    }
-    if (downsideLayout) {
-        delete downsideLayout;
-        downsideLayout = NULL;
-    }
-    if (baseLayout) {
-        delete baseLayout;
-        baseLayout = NULL;
-    }
 }