From ddacec66c398e8d99c84982a7083c8d485018ed6 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Fri, 8 Aug 2014 15:24:22 +0900 Subject: [PATCH] menu: minor enhancements for menu add ram size to Detailed Info dialog add logging telnet port to Detailed Info dialog add SDK vesion to About dialog add build date to About dialog add snapshot name to About dialog add hyper link to About dialog & etc Change-Id: Ibf5e0d4eb751174b15921d45ad49558250868694 Signed-off-by: GiWoong Kim --- tizen/src/display/qt5_supplement.cpp | 2 +- tizen/src/emul_state.c | 11 ++++ tizen/src/emul_state.h | 3 + tizen/src/ui/mainwindow.h | 4 -- tizen/src/ui/menu/aboutdialog.cpp | 38 +++++++++-- tizen/src/ui/menu/contextmenu.cpp | 81 ++++++++++++------------ tizen/src/ui/menu/detailedinfodialog.cpp | 14 +++- vl.c | 4 ++ 8 files changed, 103 insertions(+), 54 deletions(-) diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 7f4b2337fb..07dce80336 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -75,7 +75,7 @@ void qt5_skin_init(void) uiInfo->vmName = get_emul_vm_name(); uiInfo->resolution.setWidth(get_emul_resolution_width()); uiInfo->resolution.setHeight(get_emul_resolution_height()); - uiInfo->basePort = get_emul_vm_base_port(); + uiInfo->basePort = get_emul_vm_base_port() + 1; uiInfo->skinPath = get_emul_skin_path(); if (uiInfo->skinPath.endsWith('/') == false) { diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 9711167ec4..938fde84a4 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -381,6 +381,17 @@ bool get_emul_cpu_accel(void) return false; } +/* VM ram size */ +void set_emul_ram_size(const char *size) +{ + _emul_info.vm_ram_size = size; +} + +const char* get_emul_ram_size(void) +{ + return _emul_info.vm_ram_size; +} + /* file sharing path */ void set_emul_file_sharing_path(const char *path) { diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index c9146f9d4f..5f67f70400 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -96,6 +96,7 @@ typedef struct EmulatorConfigInfo { char *skin_path; bool gpu_accel_enable; const char *file_sharing_path; + const char *vm_ram_size; /* add here */ } EmulatorConfigInfo; @@ -132,6 +133,7 @@ void set_emul_vm_name(char *vm_name); void set_emul_skin_path(char *path); void set_emul_gpu_accel(bool enable); void set_emul_file_sharing_path(const char *path); +void set_emul_ram_size(const char *size); void set_emulator_condition(int state); void set_emul_rotation(short rotation_type); @@ -155,6 +157,7 @@ char* get_emul_skin_path(void); bool get_emul_gpu_accel(void); bool get_emul_cpu_accel(void); const char* get_emul_file_sharing_path(void); +const char* get_emul_ram_size(void); int get_emulator_condition(void); short get_emul_rotation(void); diff --git a/tizen/src/ui/mainwindow.h b/tizen/src/ui/mainwindow.h index 0aa90a15d3..43906dba59 100644 --- a/tizen/src/ui/mainwindow.h +++ b/tizen/src/ui/mainwindow.h @@ -15,10 +15,6 @@ extern "C" { #include "skin/maruskin_operation.h" } -QT_BEGIN_NAMESPACE -class QLabel; -QT_END_NAMESPACE - class DisplaySwapper : public QObject { Q_OBJECT diff --git a/tizen/src/ui/menu/aboutdialog.cpp b/tizen/src/ui/menu/aboutdialog.cpp index 0eaf445172..367179e098 100644 --- a/tizen/src/ui/menu/aboutdialog.cpp +++ b/tizen/src/ui/menu/aboutdialog.cpp @@ -1,7 +1,8 @@ #include "aboutdialog.h" +#include "build_info.h" #define SDK_NAME "Tizen SDK" -#define URL_TIZEN_ORG "https://developer.tizen.org"; +#define URL_TIZEN_ORG "https://developer.tizen.org"; AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) @@ -15,7 +16,7 @@ AboutDialog::AboutDialog(QWidget *parent) : /* upside */ QHBoxLayout *upsideLayout = new QHBoxLayout(); upsideLayout->setMargin(0); - upsideLayout->setSpacing(5); + upsideLayout->setSpacing(0); QLabel *imageLabel = new QLabel(this); imageLabel->setPixmap(QPixmap(":about.png")); @@ -24,17 +25,40 @@ AboutDialog::AboutDialog(QWidget *parent) : QSettings sdkVersion("../../../sdk.version", QSettings::IniFormat); QString version = sdkVersion.value("TIZEN_SDK_VERSION").toString(); if (version.isEmpty() == true) { + qWarning("failed to load SDK version"); version = "Undefined"; } - QString aboutText = QString(SDK_NAME) + "\n\n" - + "Version : " + version + '\n' - + "Build ID : " + '\n' //TODO: - + "SDK Snapshot Name : " + '\n' //TODO: - + "\n\nVisit " + URL_TIZEN_ORG; + QString SnapshotName = "Undefined"; + QFile file("../../../install-manager/installmanager.conf"); + if (file.open(QIODevice::ReadOnly | QIODevice::Text) == true) { + QTextStream in(&file); + while (!in.atEnd()) { + QString line = in.readLine(); + if (line.startsWith("Snapshot-Path", Qt::CaseInsensitive) == true) { + QStringList snapshotPath = line.split(":", QString::SkipEmptyParts)[1].split("/"); + SnapshotName = snapshotPath.last().trimmed(); + qDebug() << "Snapshot Name :" << SnapshotName; + } + } + + file.close(); + } else { + qWarning("failed to load snapshot name"); + } + + QString aboutText = QString(SDK_NAME) + "

" + + "Version : " + version + "
" + + "Build Date : " + QString(build_date) + "
" + + "SDK Snapshot Name : " + SnapshotName + "


" + + "Visit " + URL_TIZEN_ORG; QLabel *textLabel = new QLabel(this); textLabel->setStyleSheet("background-color: white"); + textLabel->setTextFormat(Qt::RichText); + //textLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); + textLabel->setOpenExternalLinks(true); + textLabel->setMargin(10); textLabel->setText(aboutText); upsideLayout->addWidget(textLabel); diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 890e7c0503..b3ca118f89 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -23,41 +23,43 @@ ContextMenu::ContextMenu(QWidget *parent) : connect(action, SIGNAL(triggered(bool)), this, SLOT(slotTopMost(bool))); /* = Rotate menu = */ - QMenu *rotateMenu = addMenu(QIcon(QPixmap(":/icons/rotate.png")), "Rotate"); - QActionGroup *rotateGroup = new QActionGroup(this); - rotateMapper = new QSignalMapper(this); - connect(rotateMapper, SIGNAL(mapped(int)), this, SLOT(slotRotate(int))); - - action = rotateMenu->addAction("Portrait"); - action->setActionGroup(rotateGroup); - action->setCheckable(true); - rotateMapper->setMapping(action, 0); - connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - - action = rotateMenu->addAction("Landscape"); - action->setActionGroup(rotateGroup); - action->setCheckable(true); - rotateMapper->setMapping(action, 270); - connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - - action = rotateMenu->addAction("Reverse Portrait"); - action->setActionGroup(rotateGroup); - action->setCheckable(true); - rotateMapper->setMapping(action, 180); - connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - - action = rotateMenu->addAction("Reverse Landscape"); - action->setActionGroup(rotateGroup); - action->setCheckable(true); - rotateMapper->setMapping(action, 90); - connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - - action = (QAction *)rotateMapper->mapping(win->getUIState()->formAngle); - action->setChecked(true); + if (win->uiInfo->formList.count() > 1) { + QMenu *rotateMenu = addMenu(QIcon(QPixmap(":/icons/rotate.png")), "&Rotate"); + QActionGroup *rotateGroup = new QActionGroup(this); + rotateMapper = new QSignalMapper(this); + connect(rotateMapper, SIGNAL(mapped(int)), this, SLOT(slotRotate(int))); + + action = rotateMenu->addAction("Portrait"); + action->setActionGroup(rotateGroup); + action->setCheckable(true); + rotateMapper->setMapping(action, 0); + connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); + + action = rotateMenu->addAction("Landscape"); + action->setActionGroup(rotateGroup); + action->setCheckable(true); + rotateMapper->setMapping(action, 270); + connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); + + action = rotateMenu->addAction("Reverse Portrait"); + action->setActionGroup(rotateGroup); + action->setCheckable(true); + rotateMapper->setMapping(action, 180); + connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); + + action = rotateMenu->addAction("Reverse Landscape"); + action->setActionGroup(rotateGroup); + action->setCheckable(true); + rotateMapper->setMapping(action, 90); + connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); + + action = (QAction *)rotateMapper->mapping(win->getUIState()->formAngle); + action->setChecked(true); + } /* =============== */ /* = Scale menu = */ - QMenu *scaleMenu = addMenu(QIcon(QPixmap(":/icons/scale.png")), "Scale"); + QMenu *scaleMenu = addMenu(QIcon(QPixmap(":/icons/scale.png")), "&Scale"); QActionGroup *scaleGroup = new QActionGroup(this); scaleMapper = new QSignalMapper(this); connect(scaleMapper, SIGNAL(mapped(int)), this, SLOT(slotScale(int))); @@ -112,7 +114,7 @@ ContextMenu::ContextMenu(QWidget *parent) : } /* = Advanced menu = */ - QMenu *advancedMenu = addMenu(QIcon(QPixmap(":/icons/advanced.png")), "Advanced"); + QMenu *advancedMenu = addMenu(QIcon(QPixmap(":/icons/advanced.png")), "Ad&vanced"); #if 0 /* Advanced > Screen Shot menu */ @@ -125,23 +127,23 @@ ContextMenu::ContextMenu(QWidget *parent) : /* Advanced > About menu */ aboutDialog = new AboutDialog(win); - action = advancedMenu->addAction("About"); + action = advancedMenu->addAction("&About"); action->setIcon(QIcon(QPixmap(":/icons/about.png"))); connect(action, SIGNAL(triggered()), this, SLOT(slotAbout())); /* Advanced > Force Close menu */ - action = advancedMenu->addAction("Force Close"); + action = advancedMenu->addAction("&Force Close"); action->setIcon(QIcon(QPixmap(":/icons/force_close.png"))); connect(action, SIGNAL(triggered()), this, SLOT(slotForceClose())); /* ================= */ /* Shell menu */ - action = addAction("Shell"); + action = addAction("S&hell"); action->setIcon(QIcon(QPixmap(":/icons/shell.png"))); connect(action, SIGNAL(triggered()), this, SLOT(slotShell())); /* Control Panel menu */ - action = addAction("Control Panel"); + action = addAction("Control &Panel"); action->setIcon(QIcon(QPixmap(":/icons/control_panel.png"))); connect(action, SIGNAL(triggered()), this, SLOT(slotControlPanel())); @@ -214,11 +216,12 @@ void ContextMenu::slotShell() return; } - qint32 basePort = get_emul_vm_base_port(); + MainWindow *win = (MainWindow *)this->parent(); + qint32 basePort = win->uiInfo->basePort; QString sdbPort = QString::number(basePort + 1); QString sdbSerial = "emulator-" + sdbPort; - QString vmName = get_emul_vm_name(); + QString vmName = win->uiInfo->vmName; QString sdbPath; #ifdef CONFIG_WIN32 sdbPath = "..\\..\\ansicon.exe"; diff --git a/tizen/src/ui/menu/detailedinfodialog.cpp b/tizen/src/ui/menu/detailedinfodialog.cpp index 9b8c6eb1bd..d3f082374a 100644 --- a/tizen/src/ui/menu/detailedinfodialog.cpp +++ b/tizen/src/ui/menu/detailedinfodialog.cpp @@ -10,7 +10,7 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : { MainWindow *win = ((MainWindow *)this->parent()); - setWindowTitle("Detailed Info - " + win->uiInfo->vmName); + setWindowTitle("Detailed Info"); QVBoxLayout *baseLayout = new QVBoxLayout(this); baseLayout->setMargin(10); @@ -23,7 +23,7 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : /* VM information table */ QTableWidget *infoTable = new QTableWidget(this); - infoTable->setRowCount(12); + infoTable->setRowCount(11); infoTable->setColumnCount(2); infoTable->setEditTriggers(QAbstractItemView::NoEditTriggers); infoTable->setAlternatingRowColors(true); @@ -56,7 +56,7 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : item = new QTableWidgetItem("Ram Size"); infoTable->setItem(index, 0, item); - item = new QTableWidgetItem("0"); // TODO: + item = new QTableWidgetItem(get_emul_ram_size()); infoTable->setItem(index++, 1, item); item = new QTableWidgetItem("Display Resolution"); @@ -65,10 +65,12 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : + "x" + QString::number(win->uiInfo->resolution.height())); infoTable->setItem(index++, 1, item); +#if 0 item = new QTableWidgetItem("Display Density"); infoTable->setItem(index, 0, item); item = new QTableWidgetItem("0"); // TODO: infoTable->setItem(index++, 1, item); +#endif item = new QTableWidgetItem("File Sharing Path"); infoTable->setItem(index, 0, item); @@ -96,6 +98,12 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : item = new QTableWidgetItem(get_log_path()); infoTable->setItem(index++, 1, item); + /* temp */ + item = new QTableWidgetItem("Logging Telnet Port"); + infoTable->setItem(index, 0, item); + item = new QTableWidgetItem(QString::number(win->uiInfo->basePort + 4)); + infoTable->setItem(index++, 1, item); + int tableHeight = infoTable->horizontalHeader()->height(); for (int i = 0; i < infoTable->rowCount(); i++) { tableHeight += infoTable->rowHeight(i); diff --git a/vl.c b/vl.c index 289a88d886..f6a402d536 100644 --- a/vl.c +++ b/vl.c @@ -3390,6 +3390,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "qemu: ram size too large\n"); exit(1); } + +#ifdef CONFIG_MARU + set_emul_ram_size(optarg); +#endif break; } #ifdef CONFIG_TPM -- 2.34.1