- install: support one wgt/tpk/rpm file.
- push: support multiple files/directories.
- rename "shellopener" to "sdbhelper" and
add more sdb specific job.
- Limitation:
We use sdb client to push/install, but it has
some issues related with exit code and error message.
it will be fixed soon by sdb developers.
Change-Id: I5e6f06b36f8a354e79a9c42386042c3ca7b3c89a
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
#include "displaybase.h"
#include "mainwindow.h"
#include "resource/ui_strings.h"
+#include "menu/sdbhelper.h"
extern "C" {
#include "util/ui_operations.h"
this->movingMode = false;
this->grabPos = SKINVIEW_NULLITY_POSITION;
this->grabWinPos = win->pos();
+ this->dropping = false;
+ this->sdbHelper = new SdbHelper((MainWindow *)widget->parentWidget(), this);
this->isTsEnabled = is_touchscreen_enabled();
if (isTsEnabled == true) {
maskImage.width() * scaleFactor,
maskImage.height() * scaleFactor).mask());
}
+
+ /* update widget position */
+ sdbHelper->updateGeometry(rect);
}
QPoint DisplayBase::getGuestPos(QPoint hostPos)
void DisplayBase::handleDragEnterEvent(QDragEnterEvent *event)
{
- if (event->mimeData()->hasUrls()) {
+ if (!event->mimeData()->hasUrls()) {
+ qDebug() << "ignore action";
+ event->setDropAction(Qt::IgnoreAction);
+ }
+ /* check if sdb is ready */
+ if (!sdbHelper->isSdbReady()) {
+ event->setDropAction(Qt::IgnoreAction);
+ return;
+ }
+
+ foreach (const QUrl &url, event->mimeData()->urls()) {
+ QString fileName = url.toLocalFile();
+ if (fileName.isEmpty()) {
+ qDebug() << "empty file";
+ event->setDropAction(Qt::IgnoreAction);
+ return;
+ }
+ }
+
+ if (dropping == false && sdbHelper->isProgressing() == false) {
event->acceptProposedAction();
+ event->setDropAction(Qt::CopyAction);
+ } else {
+ event->setDropAction(Qt::IgnoreAction);
}
}
void DisplayBase::handleDropEvent(QDropEvent *event)
{
- foreach (const QUrl &url, event->mimeData()->urls()) {
+ dropping = true;
+ QList<QUrl> urls = event->mimeData()->urls();
+ QList<QString> fileNameList;
+ int result;
+ foreach (const QUrl &url, urls) {
QString fileName = url.toLocalFile();
- qDebug() << "Dropped file:" << fileName;
+ if (!fileName.isEmpty()) {
+ fileNameList << fileName;
+ }
+ }
+
+ if (fileNameList.isEmpty()) {
+ qDebug("There is nothing to drop.");
+ return;
}
+ qDebug() << "fileNameList: " << fileNameList;
+
+ //TODO: support user selected path
+ QString path = SDB_PUSH_DEFAULT_PATH;
+ /* Installation is supported if dropping item is only one packaging file.*/
+ if (fileNameList.size() == 1) {
+ QString installFileName = fileNameList.at(0);
+ QFileInfo fi(installFileName);
+ QString extension = fi.suffix();
+ if (QString::compare(extension, FILE_EXTENSION_WGT, Qt::CaseInsensitive) == 0 ||
+ QString::compare(extension, FILE_EXTENSION_TPK, Qt::CaseInsensitive) == 0 ||
+ QString::compare(extension, FILE_EXTENSION_RPM, Qt::CaseInsensitive) == 0) {
+ result = QMessageBox::question(win, EMULATOR_TITLE,
+ MSG_INSTALL_POPUP + installFileName, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default);
+ if (result == QMessageBox::Yes) {
+ sdbHelper->install(fi);
+ }
+ dropping = false;
+ return;
+ }
+ }
+
+ /* multiple files */
+ result = QMessageBox::question(win, EMULATOR_TITLE,
+ MSG_PUSH_POPUP + path, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default);
+ if (result == QMessageBox::Yes) {
+ sdbHelper->push(fileNameList, path);
+ }
+ dropping = false;
}
bool DisplayBase::isMovingMode()
if (mouseHelper != NULL) {
delete mouseHelper;
}
+ if (sdbHelper != NULL) {
+ delete sdbHelper;
+ }
}
#include "input/mousehelper.h"
class MainWindow;
+class SdbHelper;
class DisplayBase
{
public:
+ SdbHelper *sdbHelper;
void switchForm(DisplayType *displayForm);
void scaleForm(qreal scaleFactor);
void update();
void updateGeometry();
+ QWidget *getWidget();
const QRect &getGeometry();
QRegion getMask();
TouchScreenHelper *tsHelper;
MouseHelper *mouseHelper;
+ bool dropping;
QLabel *offGuide;
QPixmap offGuideImg;
bool offGuideShown;
obj-$(CONFIG_QT) += advancedmenuitem.o
obj-$(CONFIG_QT) += scalemenuitem.o
obj-$(CONFIG_QT) += screenshotview.o
-obj-$(CONFIG_QT) += shellopener.o
+obj-$(CONFIG_QT) += sdbhelper.o moc_sdbhelper.o
+obj-$(CONFIG_QT) += sdbhelperthread.o moc_sdbhelperthread.o
+
$(obj)/moc_detailedinfodialog.cpp: $(obj)/detailedinfodialog.h
moc $< -o $@
moc $< -o $@
$(obj)/moc_screenshotdialog.cpp: $(obj)/screenshotdialog.h
moc $< -o $@
+$(obj)/moc_sdbhelper.cpp: $(obj)/sdbhelper.h
+ moc $< -o $@
+$(obj)/moc_sdbhelperthread.cpp: $(obj)/sdbhelperthread.h
+ moc $< -o $@
# product extension
ifdef CONFIG_EXTENSION_PATH
+ QString::number(get_vm_device_serial_number());
/* for SDB shell */
- shellOpener = new ShellOpener();
+ sdbHelper = new SdbHelper(this->parent, this->parent->getDisplay());
/* for close */
longPressTimer = new QTimer(this);
{
qDebug("SDB shell");
- const QString sdbPath = shellOpener->getSdbPath();
+ const QString sdbPath = sdbHelper->getSdbPath();
QFileInfo sdbFileInfo(sdbPath);
if (sdbFileInfo.exists() == false) {
}
/* start command in a new process */
- shellOpener->openShell(vmName);
+ sdbHelper->openShell(vmName);
}
void ContextMenu::slotControlPanel()
infoDialog = NULL;
}
- delete shellOpener;
+ delete sdbHelper;
longPressTimer->stop();
#include "aboutdialog.h"
#include "screenshotdialog.h"
#include "menu/menuitem.h"
-#include "menu/shellopener.h"
+#include "menu/sdbhelper.h"
#include "input/keyboardshortcut.h"
class MainWindow;
QSignalMapper *scaleMapper;
QSignalMapper *controllerMapper;
- ShellOpener *shellOpener;
+ SdbHelper *sdbHelper;
QTimer *longPressTimer;
QTimer *rebootTimer;
};
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "config-host.h"
+#include "mainwindow.h"
+#include "sdbhelper.h"
+#include "sdbhelperthread.h"
+#include "resource/ui_strings.h"
+
+extern "C" {
+#include "emul_state.h"
+#include "util/net_helper.h"
+}
+
+SdbHelper::SdbHelper(MainWindow *parent, DisplayBase *displaybase)
+{
+ QString tmpSdbPath = QCoreApplication::applicationDirPath();
+#ifdef CONFIG_WIN32
+ QString tmpAnsiconPath = QCoreApplication::applicationDirPath();
+ tmpAnsiconPath += "\\..\\..\\..\\..\\..\\tools\\ansicon.exe";
+ ansiconPath = QDir::toNativeSeparators(tmpAnsiconPath);
+
+ sdbPath = QDir::toNativeSeparators(tmpSdbPath);
+ tmpSdbPath += "\\..\\..\\..\\..\\..\\tools\\sdb.exe";
+#else
+ tmpSdbPath += "/../../../../../tools/sdb";
+#endif
+ sdbPath = QDir::toNativeSeparators(tmpSdbPath);
+ this->mainWindow = parent;
+ this->displaybase = displaybase;
+ this->progressing = false;
+
+ connect(this, SIGNAL(geometryChanged(QRect)), this, SLOT(handleGeometryChanged(QRect)));
+}
+
+bool SdbHelper::isSdbReady()
+{
+ QFileInfo sdbFileInfo(sdbPath);
+ if (sdbFileInfo.exists() == false) {
+ qDebug(MSG_SDB_NOT_EXIST);
+ return false;
+ }
+
+ if (!is_sdb_daemon_initialized()) {
+ qDebug(MSG_SDB_NOT_READY);
+ return false;
+ }
+ return true;
+}
+
+QString SdbHelper::getSdbPath()
+{
+ return sdbPath;
+}
+
+MainWindow *SdbHelper::getMainWindow()
+{
+ return mainWindow;
+}
+
+DisplayBase *SdbHelper::getDisplayBase()
+{
+ return displaybase;
+}
+
+void SdbHelper::updateGeometry(QRect rect)
+{
+ emit geometryChanged(rect);
+}
+
+void SdbHelper::push(QList<QString> srcList, const QString &dest)
+{
+ QString program;
+ QStringList arguments;
+ QList<QStringList> argList;
+
+ QString sdbSerialName = getSerialName();
+ program = sdbPath;
+ foreach ( const QString &src, srcList) {
+ arguments << "-s" << sdbSerialName << "push" << src << dest + g_path_get_basename(src.toLocal8Bit().data());
+ argList << arguments;
+ }
+
+ SdbHelperThread *thread = new SdbHelperThread(this);
+ thread->setArguments(SDB_PUSH_COMMNAD , program, argList);
+ connect(thread, SIGNAL(started()), this, SLOT(handleThreadStarted()));
+ connect(thread, SIGNAL(finished()), this, SLOT(handleThreadFinished()));
+ connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
+ thread->start();
+}
+
+void SdbHelper::install(QFileInfo fi)
+{
+ if (QString::compare(fi.suffix(), FILE_EXTENSION_RPM, Qt::CaseInsensitive) == 0) {
+ installRpm(fi);
+ return;
+ }
+ QString program;
+ QStringList arguments;
+ QList<QStringList> argList;
+
+ QString sdbSerialName = getSerialName();
+ program = sdbPath;
+ arguments << "-s" << sdbSerialName << "install" << fi.absoluteFilePath();
+ argList << arguments;
+ qDebug() << program << arguments;
+
+ SdbHelperThread *thread = new SdbHelperThread(this);
+ thread->setArguments(SDB_INSTALL_COMMAND, program, argList);
+ connect(thread, SIGNAL(started()), this, SLOT(handleThreadStarted()));
+ connect(thread, SIGNAL(finished()), this, SLOT(handleThreadFinished()));
+ connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
+ thread->start();
+}
+
+void SdbHelper::installRpm(QFileInfo fi)
+{
+ QString program;
+ QStringList argRootOn;
+ QStringList argPush;
+ QStringList argInstall;
+ QStringList argRemove;
+ QStringList argRootOff;
+ QList<QStringList> argList;
+ QString baseName = fi.fileName();
+ QString destFileName = QString(GUEST_TMP_PATH + baseName);
+ QString sdbSerialName = getSerialName();
+ program = sdbPath;
+ /* to install rpm package, need sudo permission. */
+ argRootOn << "root" << "on";
+ argList << argRootOn;
+
+ argPush << "-s" << sdbSerialName << "push" << fi.absoluteFilePath() << GUEST_TMP_PATH;
+ argList << argPush;
+
+ argInstall << "-s" << sdbSerialName << "shell" << "rpm" << "-Uvh" << destFileName << "--force" << "--nodeps";
+ argList << argInstall;
+
+ argRemove << "-s" << sdbSerialName << "shell" << "rm" << "-f" << destFileName;
+ argList << argRemove;
+
+ argRootOff << "root" << "off";
+ argList << argRootOff;
+
+ qDebug() << program << argList;
+
+ SdbHelperThread *thread = new SdbHelperThread(this);
+ thread->setArguments(SDB_INSTALL_COMMAND, program, argList);
+ connect(thread, SIGNAL(started()), this, SLOT(handleThreadStarted()));
+ connect(thread, SIGNAL(finished()), this, SLOT(handleThreadFinished()));
+ connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
+ thread->start();
+}
+
+void SdbHelper::handleThreadStarted()
+{
+ progressBar = new QProgressBar((QWidget *)mainWindow);
+ progressBar->setAlignment(Qt::AlignCenter);
+ progressBar->setMinimum(0);
+ progressBar->setMaximum(0);
+ progressBar->setValue(0);
+ progressBar->setTextVisible(false);
+ progressBar->setAttribute(Qt::WA_DeleteOnClose);
+ progressBar->setWindowModality(Qt::NonModal);
+ QRect rect = getDisplayBase()->getGeometry();
+ int x = rect.x() + (rect.width() - progressBar->width()) / 2;
+ int y = rect.y() + (rect.height() - progressBar->height()) / 2;
+ progressBar->move(x,y);
+ progressBar->resize(PROGRESSBAR_DEFAULT_WITDH, PROGRESSBAR_DEFAULT_HEIGHT);
+ setProgressing(true);
+ progressBar->show();
+}
+
+void SdbHelper::handleThreadFinished()
+{
+ progressBar->close();
+ setProgressing(false);
+}
+
+void SdbHelper::handleGeometryChanged(QRect newRect)
+{
+ //XXX: need to support rotation?
+ qDebug() << "handleGeometryChanged: " << newRect;
+ if (isProgressing()) {
+ QRect rect = getDisplayBase()->getGeometry();
+ int x = rect.x() + (rect.width() - progressBar->width()) / 2;
+ int y = rect.y() + (rect.height() - progressBar->height()) / 2;
+ qDebug() << " x: " << x << " ,y: " << y;
+ progressBar->move(x,y);
+ progressBar->update();
+ }
+}
+
+void SdbHelper::setProgressing(bool isProgressing)
+{
+ this->progressing = isProgressing;
+}
+
+bool SdbHelper::isProgressing()
+{
+ return this->progressing;
+}
+
+QString SdbHelper::getSerialName()
+{
+ QString sdbPort = QString::number(get_vm_device_serial_number());
+ QString sdbSerialName;
+ if (is_netclient_tap_attached()) {
+ sdbSerialName = QString(get_guest_ip());
+ } else {
+ sdbSerialName = "emulator-" + sdbPort;
+ }
+ return sdbSerialName;
+}
+
+void SdbHelper::openShell(QString title)
+{
+ qDebug() << "open the shell";
+
+ QString command;
+ QStringList arguments;
+
+ QString sdbSerialName = getSerialName();
+#ifdef CONFIG_WIN32
+ command = ansiconPath;
+ arguments << "sdb" << "-s" << sdbSerialName << "shell";
+#elif defined CONFIG_DARWIN
+ command = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/sdbscript");
+ arguments << sdbPath << sdbSerialName;
+#else
+ command = "/usr/bin/gnome-terminal";
+ const QString titleOption = "--title=" + title;
+ arguments << titleOption << "-x" << sdbPath << "-s" << sdbSerialName << "shell";
+#endif
+
+ qDebug() << command << arguments;
+
+ QProcess::startDetached(command, arguments);
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef SDBHELPER_H
+#define SDBHELPER_H
+
+#include <QtWidgets>
+
+class MainWindow;
+class DisplayBase;
+
+class SdbHelper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit SdbHelper(MainWindow *parent, DisplayBase *displaybase);
+
+ QString getSdbPath();
+ QString getSerialName();
+ void install(QFileInfo fi);
+ void push(QList<QString> src, const QString &dest);
+ void openShell(QString title);
+ bool isProgressing();
+ DisplayBase *getDisplayBase();
+ MainWindow *getMainWindow();
+ void updateGeometry(QRect rect);
+ bool isSdbReady();
+
+signals:
+ void geometryChanged(QRect rect);
+
+private:
+ QString sdbPath;
+#ifdef CONFIG_WIN32
+ QString ansiconPath;
+#endif
+ bool progressing;
+ MainWindow *mainWindow;
+ QProgressBar *progressBar;
+ QProcess *process;
+ DisplayBase *displaybase;
+ void setProgressing(bool isProgressing);
+ void installRpm(QFileInfo fi);
+
+public slots:
+ void handleThreadStarted();
+ void handleThreadFinished();
+ void handleGeometryChanged(QRect rect);
+};
+
+#endif // SDBHELPER_H
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * seokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "sdbhelperthread.h"
+#include "sdbhelper.h"
+#include "displaybase.h"
+#include "resource/ui_strings.h"
+
+extern "C" {
+#include "emul_state.h"
+}
+
+SdbHelperThread::SdbHelperThread(SdbHelper *parent)
+{
+ this->parent = parent;
+ connect(this, SIGNAL(errorOccured(QString, int)), this, SLOT(handleErrorOccured(QString, int)));
+}
+
+void SdbHelperThread::setArguments(int command, QString &program, QList<QStringList> &args)
+{
+ this->command = command;
+ this->program = program;
+ this->arguments = args;
+}
+
+void SdbHelperThread::run()
+{
+ if (program.isEmpty() || arguments.isEmpty())
+ return;
+
+ for (int i = 0; i < arguments.size(); ++i) {
+ qDebug() << "program: " << program << arguments.at(i);
+ process = new QProcess();
+ process->deleteLater();
+ process->start(program, arguments.at(i));
+ process->waitForFinished();
+ outMsg = QString::fromLocal8Bit(process->readAllStandardOutput());
+ //FIXME: (sdb) geneal pushing log may redirect to stderr
+ errorMsg = QString::fromLocal8Bit(process->readAllStandardError());
+ qDebug() << "errorMsg" << errorMsg;
+ qDebug() << "outMsg" << outMsg;
+ //FIXME: (sdb) general sdb installation failure message is printed with stdout */
+ if (command == SDB_INSTALL_COMMAND && outMsg.contains(SDB_INSTALL_FAILURE)) {
+ emit errorOccured(outMsg, process->exitCode());
+ return;
+ }
+ if (process->exitCode() || process->exitStatus()) {
+ emit errorOccured(errorMsg, process->exitCode());
+ return;
+ }
+ process->close();
+ }
+}
+
+void SdbHelperThread::handleErrorOccured(QString errString, int exitCode)
+{
+ qDebug() << "exitcode: " << exitCode;
+ //FIXME: (sdb) cannot returns exit code like "no space left"
+ showMsgBox(QMessageBox::Warning, MSG_SDB_FAILED_PROCESSING + errString);
+ if (process) {
+ process->close();
+ }
+}
+
+QMessageBox *SdbHelperThread::showMsgBox(
+ QMessageBox::Icon iconType, const QString &text,
+ QMessageBox::StandardButtons buttons,
+ QMessageBox::StandardButton defaultButton)
+{
+ qWarning() << text;
+
+ QMessageBox *msgBox = new QMessageBox(iconType,
+ EMULATOR_TITLE, text, buttons, (QWidget *)parent->getMainWindow());
+ if (defaultButton != QMessageBox::NoButton) {
+ msgBox->setDefaultButton(defaultButton);
+ }
+ msgBox->setAttribute(Qt::WA_DeleteOnClose);
+ msgBox->setModal(false);
+ msgBox->show(); /* non-blocking */
+
+ return msgBox;
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * seokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef SDBHELPERTHREAD_H
+#define SDBHELPERTHREAD_H
+
+#include <QtWidgets>
+#include <QProcess>
+#include <QThread>
+#include <QDebug>
+
+class SdbHelper;
+
+class SdbHelperThread : public QThread
+{
+ Q_OBJECT
+public:
+ explicit SdbHelperThread(SdbHelper *parent);
+ void setArguments(int command, QString& program, QList<QStringList>& args);
+private:
+ void run();
+ SdbHelper *parent;
+ QProcess *process;
+ QString program;
+ QList<QStringList> arguments;
+ int command;
+ QString errorMsg;
+ QString outMsg;
+ QMessageBox *showMsgBox(QMessageBox::Icon iconType, const QString &text,
+ QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
+ QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
+signals:
+ void errorOccured(QString errString, int exitCode);
+public slots:
+ void handleErrorOccured(QString errString, int exitCode);
+};
+#endif // SDBHELPERTHREAD_H
+++ /dev/null
-/*
- * Qt UI
- *
- * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "config-host.h"
-#include "shellopener.h"
-
-extern "C" {
-#include "emul_state.h"
-}
-
-ShellOpener::ShellOpener()
-{
- QString tmpSdbPath = QCoreApplication::applicationDirPath();
-#ifdef CONFIG_WIN32
- tmpSdbPath += "\\..\\..\\..\\..\\..\\tools\\ansicon.exe";
-#else
- tmpSdbPath += "/../../../../../tools/sdb";
-#endif
- sdbPath = QDir::toNativeSeparators(tmpSdbPath);
-}
-
-QString ShellOpener::getSdbPath()
-{
- return sdbPath;
-}
-
-void ShellOpener::openShell(QString title)
-{
- qDebug() << "open the shell";
-
- QString command;
- QStringList arguments;
-
- QString sdbPort = QString::number(get_vm_device_serial_number());
- QString sdbSerialName;
- if (is_netclient_tap_attached()) {
- sdbSerialName = QString(get_guest_ip());
- } else {
- sdbSerialName = "emulator-" + sdbPort;
- }
-
-#ifdef CONFIG_WIN32
- command = sdbPath;
- arguments << "sdb" << "-s" << sdbSerialName << "shell";
-#elif defined CONFIG_DARWIN
- command = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/sdbscript");
- arguments << sdbPath << sdbSerialName;
-#else
- command = "/usr/bin/gnome-terminal";
- const QString titleOption = "--title=" + title;
- arguments << titleOption << "-x" << sdbPath << "-s" << sdbSerialName << "shell";
-#endif
-
- qDebug() << command << arguments;
-
- QProcess::startDetached(command, arguments);
-}
-
-ShellOpener::~ShellOpener()
-{
- /* do nothing */
-}
+++ /dev/null
-/*
- * Qt UI
- *
- * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef SHELLOPENER_H
-#define SHELLOPENER_H
-
-#include <QtWidgets>
-
-
-class ShellOpener
-{
-public:
- ShellOpener();
- ~ShellOpener();
-
- QString getSdbPath();
- void openShell(QString title);
-
-private:
- QString sdbPath;
-};
-
-#endif // SHELLOPENER_H
#define ABOUT_BUILD_DATE_TEXT "Build Date"
#define ABOUT_VISIT_TEXT "Visit"
+/* SDB related */
+#define FILE_EXTENSION_WGT "wgt"
+#define FILE_EXTENSION_TPK "tpk"
+#define FILE_EXTENSION_RPM "rpm"
+#define SDB_PUSH_DEFAULT_PATH "/home/developer/"
+#define GUEST_TMP_PATH "/tmp/"
+#define SDB_INSTALL_FAILURE "val[fail]"
+#define SDB_PUSH_COMMNAD 1
+#define SDB_INSTALL_COMMAND 2
+#define PROGRESSBAR_DEFAULT_WITDH 100
+#define PROGRESSBAR_DEFAULT_HEIGHT 20
+
/* style sheet*/
#define STYLE_TOOLTIP "QToolTip {"\
"color: black; background-color: white; border: 1px solid black; }"
#define MSG_FORCE_CLOSE_POPUP "If you force stop an emulator, it may cause some problems.\n"\
"Are you sure you want to continue?"
#define MSG_CLOSE_POPUP "Do you really want to quit this program?"
+#define MSG_PUSH_POPUP "Are you sure you want to push files or directories\ninto the following path of the emulator?\n"
+#define MSG_INSTALL_POPUP "Are you sure you want to install the following package file?\n"
+#define MSG_SDB_FAILED_PROCESSING "Failed while processing.\n\nError Message:\n"
/* qFatal messages */
#define MSG_INTERNAL_ERR "An internal error occurred : \n\n"