/* Control Panel menu */
action = addAction("Control Panel");
action->setIcon(QIcon(QPixmap(":/icons/control_panel.png")));
+ connect(action, SIGNAL(triggered()), this, SLOT(slotControlPanel()));
addSeparator();
{
qDebug("SDB shell");
- // TODO: path
- QString command = "/usr/bin/gnome-terminal";
+ if (is_sdbd_initialized == 0) {
+ QString msg = "SDB is not ready.\nPlease wait until the emulator is completely boot up.";
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Info");
+ msgBox.setText(msg);
+ msgBox.exec();
+ qDebug() << msg;
+ return;
+ }
+
+ qint32 basePort = get_emul_vm_base_port();
+ QString sdbPort = QString::number(basePort + 1);
+ QString sdbSerial = "emulator-" + sdbPort;
+
+ QString vmName = get_emul_vm_name();
+ QString sdbPath;
+#ifdef __WIN32
+ sdbPath = "..\\..\\ansicon.exe";
+#else
+ sdbPath = "../../sdb";
+#endif
+
+ QFileInfo fileInfo(sdbPath);
+ if (!fileInfo.exists()) {
+ QString msg = "SDB file does not exist : " + fileInfo.absoluteFilePath();
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error");
+ msgBox.setText(msg);
+ msgBox.exec();
+ qWarning() << msg;
+ return;
+ }
+
+ QString command;
QStringList arguments;
- QString sdbPath = "~/tizen-sdk/tools/sdb";
- arguments << "-x" << sdbPath << "shell";
+#ifdef CONFIG_WIN32
+ command = "cmd.exe";
+ arguments << "/c start" << sdbPath << "-s" << sdbSerial << "shell";
+#elif defined CONFIG_DARWIN
+ QString binPath = get_bin_path();
+ command = binPath + "/sdbscript";
+ arguments << sdbSerial;
+#else
+ QString title = "--title=" + vmName;
+ command = "/usr/bin/gnome-terminal";
+ arguments << title << "-x" << sdbPath << "-s" << sdbSerial << "shell";
+#endif
+
+ try {
+ QProcess *terminal = new QProcess(this);
+ terminal->start(command, arguments);
+ } catch (QString error) {
+ QString msg = "Fail to open Shell : " + error;
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Fail");
+ msgBox.setText(msg);
+ msgBox.exec();
+ qDebug() << msg;
+ return;
+ }
+}
+
+void ContextMenu::slotControlPanel()
+{
+ qDebug("Control Panel");
+
+ QString basePortOpt = "base.port=" + QString::number(get_emul_vm_base_port());
+ QString vmNameOpt = "vmname=" + QString(get_emul_vm_name());
+ QString ecpPath;
+#ifdef __WIN32
+ ecpPath = ".\\emulator-control-panel.jar";
+#else
+ ecpPath = "./emulator-control-panel.jar";
+#endif
+
+ QFileInfo fileInfo(ecpPath);
+ if (!fileInfo.exists()) {
+ QString msg = "Control Panel file does not exist in the following path.\n" + fileInfo.absoluteFilePath();
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error");
+ msgBox.setText(msg);
+ msgBox.exec();
+ qWarning() << msg;
+ return;
+ }
+
+ QString command;
+#ifdef CONFIG_WIN32
+ command = "java.exe";
+#else
+ command = "java";
+#endif
- QProcess *terminal = new QProcess(this);
- terminal->start(command, arguments);
+ QStringList arguments;
+ arguments << "-jar" << ecpPath << vmNameOpt << basePortOpt;
+
+ try {
+ QProcess *terminal = new QProcess(this);
+ terminal->start(command, arguments);
+ } catch (QString error) {
+ QString msg = "Fail to open control panel : " + error;
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Fail");
+ msgBox.setText(msg);
+ msgBox.exec();
+ qDebug() << msg;
+ return;
+ }
}
void ContextMenu::slotAbout()
qDebug() << "exit!";
/* force close */
shutdown_qemu_gracefully();
-// MainWindow *win = (MainWindow *)this->parent();
-// win->~MainWindow();
- } else {
- qDebug() << "cancel";
- }
-
-/*
- QMessageBox::StandardButton reply;
- reply = QMessageBox::question((QWidget *)this->parent(), "Emulator",
- "If you force stop an emulator, it may cause some problems.\n"
- "Are you sure you want to continue?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
-
- if (reply == QMessageBox::Yes) {
- qDebug() << "exit!";
-
- QApplication::exit(-1);
} else {
qDebug() << "cancel";
}
-*/
}
void ContextMenu::slotPwkeyRelease()