#include "layout/hardwarekey.h"
#include "xmllayoutparser.h"
#include "uiutil.h"
+#include "displaybase.h"
extern "C" {
#include "emul_state.h"
+bool is_display_off(void);
}
//using namespace std;
static int argc = 0;
static char *argv[0];
+#define MAX_BLANK_FRAME_CNT 10
+static unsigned int blank_cnt;
+
static void *captureRequestListener;
static void (*captureRequestHandler)(void *);
void qt5_refresh_internal(void)
{
qt5App->processEvents();
+
+ DisplayBase *db = mainwindow->getDisplay();
+ if (db) {
+ if (db->getIsGimgReady()) {
+ if (is_display_off()) {
+ if (db->getGimgState() == false) {
+ if (blank_cnt > MAX_BLANK_FRAME_CNT) {
+ db->startGuideImg();
+ blank_cnt = 0;
+ } else {
+ blank_cnt++;
+ }
+ }
+ } else {
+ if (db->getGimgState() == true) {
+ db->stopGuideImg();
+ }
+
+ blank_cnt = 0;
+ }
+ }
+ } else {
+ qDebug() << "Display is not ready.";
+ }
}
void qt5_register_capture_request_listener(void *listener, void (*handler)(void *))
#include "displaybase.h"
#include "mainwindow.h"
+#define BLANK_GUIDE_IMAGE_PATH "../images/"
+#define BLANK_GUIDE_IMAGE_NAME "blank-guide.png"
+
uint32_t qt5_window_width = 0;
uint32_t qt5_window_height = 0;
int qt5_window_angle = 0;
this->rotateAngle = displayForm->getAngle();
this->scaleFactor = scaleFactor;
this->isDragging = false;
+ this->gImgState = false;
this->tsHelper = new TouchScreenHelper(this);
+ this->gImg = new QImage();
+ this->gPxmImg = new QPixmap();
+
+ loadGuideImg();
+
MainWindow *win = (MainWindow *)widget->parentWidget();
win->getSkinView()->getKbdHelper()->setMtTracker(tsHelper->getMtTracker());
updateGeometry();
}
+void DisplayBase::loadGuideImg()
+{
+ QString guide_img_path(BLANK_GUIDE_IMAGE_PATH);
+ guide_img_path.append(BLANK_GUIDE_IMAGE_NAME);
+
+ bool ret = gImg->load(guide_img_path);
+ if (ret == false) {
+ qDebug() << guide_img_path << ": No such file";
+ isGimgReady = false;
+ } else {
+ isGimgReady = true;
+ }
+}
+
+void DisplayBase::startGuideImg()
+{
+ MainWindow *win = (MainWindow *)widget->parentWidget();
+ int rWidth = rect.width() * scaleFactor;
+ int rHeight = rect.height() * scaleFactor;
+ int x = rect.x() * scaleFactor;
+ int y = rect.y() * scaleFactor;
+
+ gLabel = new QLabel(win);
+ gLabel->setAttribute(Qt::WA_DeleteOnClose);
+
+ *gPxmImg = QPixmap::fromImage(*gImg);
+ *gPxmImg = gPxmImg->scaled(rWidth, rHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+ gLabel->setPixmap(*gPxmImg);
+ gLabel->setGeometry(x, y, rWidth, rHeight);
+ gLabel->setAlignment(Qt::AlignCenter);
+ gLabel->show();
+
+ gImgState = true;
+}
+
+void DisplayBase::stopGuideImg()
+{
+ gLabel->close();
+ gImgState = false;
+}
+
+bool DisplayBase::getIsGimgReady()
+{
+ return isGimgReady;
+}
+
+bool DisplayBase::getGimgState()
+{
+ return gImgState;
+}
+
void DisplayBase::switchForm(DisplayType *displayForm)
{
qDebug() << "display switch angle :" << displayForm->getAngle();
parent->switchForm(index);
+ DisplayBase *db = parent->getDisplay();
+ if (db) {
+ if (db->getGimgState() == true) {
+ db->stopGuideImg();
+ }
+ } else {
+ qDebug() << "Display is not ready.";
+ }
+
/* reset HwKey shortcut */
KeyboardShortcut *keyboardShortcut = parent->getKeyboardShortcut();
keyboardShortcut->removeHwKeyShortcut();
qDebug("scale : %d", scale);
parent->scaleForm(scale);
+
+ DisplayBase *db = parent->getDisplay();
+ if (db) {
+ if (db->getGimgState() == true) {
+ db->stopGuideImg();
+ }
+ } else {
+ qDebug() << "Display is not ready.";
+ }
}
void ContextMenu::slotController(int index)