g_ascii_strtoull(splitted[1], NULL, 0));
}
g_strfreev(splitted);
- }
+}
#endif
void set_initial_display_resolution(int width, int height)
{
+ LOG_INFO("initial display resolution: %dx%d\n", width, height);
+
initial_resolution_width = width;
initial_resolution_height = height;
}
#include "resource/ui_strings.h"
#include "build_info.h"
-#define SDK_NAME "Tizen SDK"
-#define SDK_VERSION_FILE_KEY "TIZEN_SDK_VERSION"
-#define URL_TIZEN_ORG "<a href=\"https://developer.tizen.org\">https://developer.tizen.org</a>";
-
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
{
upsideLayout->setSpacing(0);
QLabel *imageLabel = new QLabel(this);
- imageLabel->setPixmap(QPixmap(
- QString(SDK_EMULATOR_IMAGES_PATH) + QString(SDK_ABOUT_IMAGE_FILE)));
+ QString sdkImagePath = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_EMULATOR_IMAGES_PATH + SDK_ABOUT_IMAGE_FILE).absolutePath();
+ QPixmap sdkImage(sdkImagePath);
+ if (sdkImage.isNull() == false) {
+ imageLabel->setPixmap(sdkImage);
+ } else {
+ qWarning() << "failed to load image from" << sdkImagePath;
+ }
upsideLayout->addWidget(imageLabel);
- QSettings sdkVersion(
- QString(SDK_ROOT_PATH) + QString(SDK_VERSION_FILE), QSettings::IniFormat);
- QString version = sdkVersion.value(SDK_VERSION_FILE_KEY).toString();
+ QString versionFilePath = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_ROOT_PATH + SDK_VERSION_FILE).absolutePath();
+ QSettings versionFile(versionFilePath, QSettings::IniFormat);
+ QString version = versionFile.value(SDK_VERSION_FILE_KEY).toString();
if (version.isEmpty() == true) {
- qWarning("failed to load SDK version");
+ qWarning() << "failed to load SDK version file from" << versionFilePath;
version = "Undefined";
}
}
*/
- QString aboutText = QString(SDK_NAME) + "<p>"
- + ABOUT_VERSION_TEXT + " : " + version + "<br>"
- /* + "Snapshot : " + SnapshotName + "<br>" */
- + ABOUT_BUILD_DATE_TEXT + " : " + QString(build_date) + "<p><br>"
- + ABOUT_VISIT_TEXT + " " + URL_TIZEN_ORG;
+ QString aboutText = QString(SDK_OFFICIAL_NAME) + "<p>" +
+ ABOUT_VERSION_TEXT + " : " + version + "<br>" +
+ /* "Snapshot : " + SnapshotName + "<br>" + */
+ ABOUT_BUILD_DATE_TEXT + " : " + QString(build_date) + "<p><br>" +
+ ABOUT_VISIT_TEXT + " <a href=\"" + SDK_OFFICIAL_URL + "\">" +
+ SDK_OFFICIAL_URL + "</a>";
QLabel *textLabel = new QLabel(this);
textLabel->setStyleSheet("background-color: white");
{
qDebug("Control Panel");
- QString basePortOpt = "base.port=" + QString::number(parent->uiInfo->basePort);
- QString vmNameOpt = "vmname=" + parent->uiInfo->vmName;
- QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name());
-
- QString ecpPath = QCoreApplication::applicationDirPath();
-#ifdef CONFIG_WIN32
- ecpPath += "\\..\\..\\..\\common\\emulator\\bin\\emulator-control-panel.jar";
-#else
- ecpPath += "/../../../common/emulator/bin/emulator-control-panel.jar";
-#endif
+ QString ecpPath = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_EMULATOR_BIN_PATH + SDK_ECP_FILE).absolutePath();
QFileInfo ecpFileInfo(ecpPath);
if (!ecpFileInfo.exists()) {
return;
}
+ QString basePortOpt = "base.port=" + QString::number(parent->uiInfo->basePort);
+ QString vmNameOpt = "vmname=" + parent->uiInfo->vmName;
+ QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name());
+
QString command;
QStringList arguments;
#ifdef CONFIG_WIN32
- char* path = (char*)malloc(JAVA_MAX_COMMAND_LENGTH);
+ char *path = (char *)malloc(JAVA_MAX_COMMAND_LENGTH);
memset(path, 0, sizeof(char) * JAVA_MAX_COMMAND_LENGTH);
if (is_wow64()) {
}
switch(msgBox->standardButton(button)) {
- case QMessageBox::Ok:
+ case QMessageBox::Yes:
qDebug() << "exit!";
qemu_system_graceful_shutdown_request(3);
break;
- case QMessageBox::Cancel:
+ case QMessageBox::No:
qDebug() << "cancel";
break;
default:
/* do nothing */
+ qWarning() << "invalid return value";
break;
}
}
QString sharingPath(get_emul_file_sharing_path());
setDataTable(vmInfoTable, DETAILED_INFO_HDS_PATH,
- (sharingPath.isEmpty()) ? "None" : sharingPath, index++);
+ (sharingPath.isEmpty()) ? GENERIC_TEXT_NONE : sharingPath, index++);
setDataTable(vmInfoTable, DETAILED_INFO_CPU_VT,
- (get_emul_cpu_accel()) ? "Enabled" : "Disabled", index++);
+ (get_emul_cpu_accel()) ? GENERIC_TEXT_ENABLED : GENERIC_TEXT_DISABLED, index++);
setDataTable(vmInfoTable, DETAILED_INFO_GPU_VT,
- (is_gpu_accel_enabled()) ? "Enabled" : "Disabled", index++);
+ (is_gpu_accel_enabled()) ? GENERIC_TEXT_ENABLED : GENERIC_TEXT_DISABLED, index++);
for (int i = 0; i < imagePathList.size(); i++) {
setDataTable(vmInfoTable, QString(DETAILED_INFO_IMAGE_PATH) + " " +
#include "emul_state.h"
#include "qt5_supplement.h"
#include "hw/pci/maru_brightness.h"
+#include "resource/ui_strings.h"
+
#ifdef CONFIG_DARWIN
#include "ns_event.h"
#endif
-
#include "util/new_debug_ch.h"
DECLARE_DEBUG_CHANNEL(qt5_console);
ns_run_in_event_loop_with_bool(&qt5_early_prepare, isOnscreen);
/* set emulator icon */
-#define ICON_RESOURCE_PATH "../icons/"
-#define ICON_FILE_NAME "emulator_icon.ico"
const int path_len = strlen(get_bin_path()) +
- strlen(ICON_RESOURCE_PATH) + strlen(ICON_FILE_NAME) + 1;
+ strlen(SDK_EMULATOR_ICONS_PATH) + strlen(EMULATOR_ICON_FILE) + 1;
char *icon_path = g_malloc0(sizeof(char) * path_len);
snprintf(icon_path, path_len, "%s%s%s",
- get_bin_path(), ICON_RESOURCE_PATH, ICON_FILE_NAME);
- fprintf(stdout, "application icon path : %s\n", icon_path);
+ get_bin_path(), SDK_EMULATOR_ICONS_PATH, EMULATOR_ICON_FILE);
+ fprintf(stdout, "application icon path: %s\n", icon_path);
set_application_icon(icon_path);
g_free(icon_path);
#else
qt5_early_prepare(isOnscreen);
#endif
+
if (isOnscreen) {
LOG_INFO("Display Type: QT5 Onscreen\n");
} else {
static MainWindow *mainwindow;
static UIInformation *uiInfo;
-#define GUI_PROPERTIES_FILE_NAME "gui.property"
-#define SKIN_INFO_FILE_NAME "info.ini"
-#define FORM_FILE_NAME "layout.xml"
-#define CON_FORM_SUBPATH "controller"
-
class ConFile {
public:
QFile *formFile;
void qt5_gui_init(void)
{
- QCoreApplication::setApplicationName("Tizen Emulator");
+ QCoreApplication::setApplicationName(EMULATOR_TITLE);
- qDebug() << "* Qt version :" << QT_VERSION_STR;
- qDebug() << "* working path :" << QDir::currentPath();
- qDebug() << "* binary path :" << QCoreApplication::applicationDirPath();
+ qDebug() << "* Qt version (compile time):" << QT_VERSION_STR;
+ qDebug() << "* Qt version (runtime):" << qVersion();
+ qDebug() << "* working path:" << QDir::currentPath();
+ qDebug() << "* binary path:" << QCoreApplication::applicationDirPath();
uiInfo = new UIInformation();
// TODO:
uiInfo->vmName = QString(get_vm_name()).trimmed();
- qDebug() << "VM name :" << uiInfo->vmName;
+ qDebug() << "VM name:" << uiInfo->vmName;
uiInfo->resolution.setWidth(get_display_resolution_width());
uiInfo->resolution.setHeight(get_display_resolution_height());
if (uiInfo->vmDataPath.endsWith(QDir::separator()) == false) {
uiInfo->vmDataPath += QDir::separator();
}
- qDebug() << "VM path :" << uiInfo->vmDataPath;
+ qDebug() << "VM path:" << uiInfo->vmDataPath;
uiInfo->skinPath = QDir(get_emul_skin_path()).canonicalPath();
if (uiInfo->skinPath.endsWith(QDir::separator()) == false) {
uiInfo->skinPath += QDir::separator();
}
- qDebug() << "skin path :" << uiInfo->skinPath;
+ qDebug() << "skin path:" << uiInfo->skinPath;
/* read skin information */
- QSettings skinInfo(uiInfo->skinPath + SKIN_INFO_FILE_NAME,
+ QSettings skinInfo(uiInfo->skinPath + LAYOUT_SKIN_INFO_FILE,
QSettings::IniFormat);
QString skinName = skinInfo.value(SKIN_PROPERTY_NAME).toString();
if (skinName.isEmpty() == true) {
uiInfo->skinName = skinName;
/* open most recently used data information file */
- QFile::remove(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME + ".lock");
+ QFile::remove(uiInfo->vmDataPath + GUI_PROPERTIES_FILE + ".lock");
const QSettings mruInfo(
- uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME, QSettings::IniFormat);
+ uiInfo->vmDataPath + GUI_PROPERTIES_FILE, QSettings::IniFormat);
/* XML layout */
- QFile mainXMLFile(uiInfo->skinPath + FORM_FILE_NAME);
+ QFile mainXMLFile(uiInfo->skinPath + LAYOUT_FORM_FILE_NAME);
/* load main form */
loadMainFormFromXML(&mainXMLFile, uiInfo);
- QDir skinDir(uiInfo->skinPath + CON_FORM_SUBPATH);
+ QDir skinDir(uiInfo->skinPath + LAYOUT_CON_FORM_SUBPATH);
/* load controller forms */
QFileInfoList entries = skinDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
ConFile *conFile = new ConFile();
QString conPath = entries.at(i).filePath() + QDir::separator();
- conFile->formFile = new QFile(conPath + FORM_FILE_NAME);
- QSettings conInfo(conPath + SKIN_INFO_FILE_NAME, QSettings::IniFormat);
+ conFile->formFile = new QFile(conPath + LAYOUT_FORM_FILE_NAME);
+ QSettings conInfo(conPath + LAYOUT_SKIN_INFO_FILE, QSettings::IniFormat);
conFile->priority = conInfo.value("priority").toInt();
int j = 0;
qDebug("qt5 destroy");
/* write most recently used data information */
- QString path(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME);
+ QString path(uiInfo->vmDataPath + GUI_PROPERTIES_FILE);
qDebug() << "save MRU data:" << path;
QSettings mruInfo(path, QSettings::IniFormat);
#ifndef UI_STRINGS_H
#define UI_STRINGS_H
-#define EMULATOR_TITLE "Emulator"
+#define EMULATOR_TITLE "Tizen Emulator"
+
+#define SDK_OFFICIAL_NAME "Tizen SDK"
+#define SDK_OFFICIAL_URL "https://developer.tizen.org"
/* SDK path */
#define SDK_ROOT_PATH "../../../../../"
+#define SDK_EMULATOR_BIN_PATH "../../../common/emulator/bin/"
#define SDK_EMULATOR_IMAGES_PATH "../images/"
+#define SDK_EMULATOR_ICONS_PATH "../icons/"
+
+#define SDK_ECP_FILE "emulator-control-panel.jar"
/* resource file name */
#define SDK_ABOUT_IMAGE_FILE "tizen_sdk.png"
#define SDK_VERSION_FILE "sdk.version"
+#define SDK_VERSION_FILE_KEY "TIZEN_SDK_VERSION"
+#define EMULATOR_ICON_FILE "emulator_icon.ico"
+#define GUI_PROPERTIES_FILE "gui.property"
+#define LAYOUT_SKIN_INFO_FILE "info.ini"
+#define LAYOUT_FORM_FILE_NAME "layout.xml"
+#define LAYOUT_CON_FORM_SUBPATH "controller/"
#define DISPLAY_OFF_GUIDE_IMAGE_FILE "display_off_guide.png"
+/* generic text */
+#define GENERIC_TEXT_NONE "None"
+#define GENERIC_TEXT_ENABLED "Enabled"
+#define GENERIC_TEXT_DISABLED "Disabled"
+
/* context menu */
#define MENU_ONTOP_ITEM_TEXT "Always on Top"
#define MENU_SWITCH_ITEM_TEXT "Switch"
// Resolution should be formed "640x480" or "640*480".
int width = (int)g_ascii_strtoll(opts, &endptr, 10);
int height = (int)g_ascii_strtoll(++endptr, &endptr, 10);
- if (width == 0 || height == 0) {
+ if (width <= 0 || height <= 0) {
goto invalid_maru_qt_args;
}
set_initial_display_resolution(width, height);
opts = nextopt;
char *endptr = NULL;
int dpi = (int)g_ascii_strtoll(opts, &endptr, 10);
- if (dpi == 0) {
+ if (dpi <= 0) {
goto invalid_maru_qt_args;
}
set_display_pixel_density(dpi);