diff --git a/mainwindow.cpp b/mainwindow.cpp index 0f21e82..297914f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -130,6 +130,23 @@ void MainWindow::closeEvent(QCloseEvent *event) } +void MainWindow::resizeEvent(QResizeEvent *event) +{ + int w,h; + qreal scale; + + + w=ui->EmuScreen->screen_width; + h=ui->EmuScreen->screen_height+5; + if(!h) h=80; + if(!w) w=131; + scale=((qreal)event->size().width())/w; + if((int)scale<1) scale=1.0; + if(event->size().height()*0.40size().height()*0.40/h; + ui->EmuScreen->setScale((int)scale); + + +} void MainWindow::on_EmuScreen_destroyed() { @@ -351,6 +368,8 @@ struct mousemap { { Qt::Key_Control, 62 ,0.00862069,0.161638, 0.817505,0.886406 }, { Qt::Key_Home, 63 ,0.00862069,0.118534, 0.918063,0.979516 }, +{ Qt::Key_F10, 64 ,0.872845,0.987069, 0.108007,0.163873 }, + // ADD MORE KEYS HERE { 0,0 , 0.0,0.0,0.0,0.0 } @@ -1119,9 +1138,15 @@ if(obj == ui->KeybImage) if( (relx>=ptr->left)&&(relx<=ptr->right)&&(rely>=ptr->top)&&(rely<=ptr->bot)) { // CLICKED INSIDE A KEY + if(ptr->keynum==64) { + // PRESSED THE SIMULATED MAIN MENU KEY + menuBar()->activateWindow(); + } + else { //TODO: HIGHLIGHT IT FOR VISUAL EFFECT __pckeymatrix|=1ULL<<(ptr->keynum); __keyb_update(); + } } ptr++; } diff --git a/mainwindow.h b/mainwindow.h index cffafbe..6ebc481 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,6 +39,7 @@ protected: virtual void keyReleaseEvent(QKeyEvent *ev); void closeEvent(QCloseEvent *event); bool eventFilter(QObject *obj, QEvent *ev); + void resizeEvent(QResizeEvent *event); private slots: void on_EmuScreen_destroyed(); diff --git a/mainwindow.ui b/mainwindow.ui index 839ff77..bdc69ed 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1076 - 598 + 546 + 900 @@ -26,25 +26,25 @@ background: black; - - + + - + 0 0 - 528 - 364 + 132 + 91 - 528 - 364 + 1056 + 728 @@ -70,7 +70,7 @@ - + 0 0 @@ -83,7 +83,7 @@ - 464 + 16777215 16777215 @@ -100,7 +100,7 @@ false - border-image: url(:/bitmap/bitmap/keyboard.png) 0 0 0 0 repeat stretch; + border-image: url(:/bitmap/bitmap/keyboard.png) 0 0 0 0 stretch stretch; border-width: 0px; @@ -118,8 +118,8 @@ border-width: 0px; 0 0 - 1076 - 19 + 546 + 20 diff --git a/newrpl-ui.pro b/newrpl-ui.pro index 9f738e9..20c37ac 100644 --- a/newrpl-ui.pro +++ b/newrpl-ui.pro @@ -325,7 +325,7 @@ win32: LIBS += -lsetupapi android: SOURCES += external/hidapi/libusb/hid.c android: INCLUDEPATH += external/libusb-1.0.22/libusb/ -android: LIBS += -L$$PWD/external/libusb-1.0.22/android/libs -lusb +android: LIBS += -L$$PWD/external/libusb-1.0.22/android/libs/armeabi-v7a -lusb1.0 freebsd: SOURCES += external/hidapi/libusb/hid.c freebsd: LIBS += -lusb -lthr -liconv @@ -343,4 +343,22 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) { $$PWD/external/libusb-1.0.22/android/libs/armeabi-v7a/libusb1.0.so } +DISTFILES += \ + android/AndroidManifest.xml \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradlew \ + android/res/values/libs.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew.bat \ + android/AndroidManifest.xml \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradlew \ + android/res/values/libs.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew.bat + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + diff --git a/qemuscreen.cpp b/qemuscreen.cpp index e9df7ec..1c07ec7 100644 --- a/qemuscreen.cpp +++ b/qemuscreen.cpp @@ -119,8 +119,8 @@ QEmuScreen::QEmuScreen(QWidget *parent) : setScene(&scr); setSceneRect(0,-5,screen_width,screen_height+5); centerOn(qreal(screen_width)/2,qreal(screen_height)/2); - scale(4.0,4.0); - + m_scale=1.0; + setScale(4.0); show(); @@ -140,6 +140,17 @@ void QEmuScreen::setWord(int offset,unsigned int color) } } +void QEmuScreen::setScale(qreal _scale) +{ + scale(_scale/m_scale,_scale/m_scale); + m_scale=_scale; + + QSize s; + s.setWidth(0); + s.setHeight((screen_height+5)*m_scale); + setMinimumSize(s); +} + void QEmuScreen::update() { @@ -215,3 +226,4 @@ void QEmuScreen::update() } } + diff --git a/qemuscreen.h b/qemuscreen.h index 8a57c8f..d1cc3d4 100644 --- a/qemuscreen.h +++ b/qemuscreen.h @@ -18,6 +18,7 @@ public: // SIZE OF THE SCREEN TO EMULATE int screen_width; int screen_height; + qreal m_scale; // MAIN COLORS, ALL GRAYS WILL BE INTERPOLATED QColor BkgndColor; QColor MainColor; @@ -36,8 +37,10 @@ public: void setPixel(int offset,int color); void setWord(int offset,unsigned int color); void setMode(int _mode,unsigned int *_buffer); + void setScale(qreal _scale); explicit QEmuScreen(QWidget *parent = 0); + signals: public slots: