Skip to content
Snippets Groups Projects
Commit aabaa520 authored by SeeLook's avatar SeeLook
Browse files

Exec of Touch menu returns action now, using Fusion style under Android and proper plugins path

parent e90d9d21
No related branches found
No related tags found
No related merge requests found
...@@ -73,9 +73,9 @@ void TtouchMenu::addAction(QAction* a) { ...@@ -73,9 +73,9 @@ void TtouchMenu::addAction(QAction* a) {
} }
void TtouchMenu::exec(const QPoint& endPos, const QPoint& startPos) { QAction* TtouchMenu::exec(const QPoint& endPos, const QPoint& startPos) {
if (startPos.x() == -1 && startPos.y() == -1) if (startPos.x() == -1 && startPos.y() == -1)
QMenu::exec(endPos); return QMenu::exec(endPos);
else { else {
m_endPos = endPos; m_endPos = endPos;
m_startPos = startPos; m_startPos = startPos;
...@@ -83,7 +83,7 @@ void TtouchMenu::exec(const QPoint& endPos, const QPoint& startPos) { ...@@ -83,7 +83,7 @@ void TtouchMenu::exec(const QPoint& endPos, const QPoint& startPos) {
m_step = 0; m_step = 0;
m_offset = QPoint((m_endPos.x() - m_startPos.x()) / m_count, (m_endPos.y() - m_startPos.y()) / m_count); m_offset = QPoint((m_endPos.x() - m_startPos.x()) / m_count, (m_endPos.y() - m_startPos.y()) / m_count);
m_animTimer->start(40); m_animTimer->start(40);
QMenu::exec(startPos); return QMenu::exec(startPos);
} }
} }
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
/** Overrides standard @p exec method of @p QMenu. /** Overrides standard @p exec method of @p QMenu.
* Menu is positioned at @p endPos point but when @p startPos is set, * Menu is positioned at @p endPos point but when @p startPos is set,
* an animation from it is performed */ * an animation from it is performed */
void exec(const QPoint& endPos, const QPoint& startPos = QPoint(-1, -1)); QAction* exec(const QPoint& endPos, const QPoint& startPos = QPoint(-1, -1));
protected: protected:
virtual void showEvent(QShowEvent* e); // correct initial position virtual void showEvent(QShowEvent* e); // correct initial position
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QApplication> #include <QApplication>
#include <QStyleFactory>
#include <QDebug> #include <QDebug>
#include <QTranslator> #include <QTranslator>
...@@ -61,6 +62,9 @@ int main(int argc, char *argv[]) ...@@ -61,6 +62,9 @@ int main(int argc, char *argv[])
} }
resetConfig = false; resetConfig = false;
a = new QApplication(argc, argv); a = new QApplication(argc, argv);
#if defined (Q_OS_ANDROID)
a->setStyle(QStyleFactory::create("Fusion"));
#endif
gl = new Tglobals(); gl = new Tglobals();
gl->path = Tglobals::getInstPath(qApp->applicationDirPath()); gl->path = Tglobals::getInstPath(qApp->applicationDirPath());
confFile = gl->config->fileName(); confFile = gl->config->fileName();
......
...@@ -38,15 +38,14 @@ ...@@ -38,15 +38,14 @@
#include "exam/tprogresswidget.h" #include "exam/tprogresswidget.h"
#include "exam/texamview.h" #include "exam/texamview.h"
#include "exam/texamexecutor.h" #include "exam/texamexecutor.h"
#include <level/tlevelselector.h>
#include <widgets/tpitchview.h> #include <widgets/tpitchview.h>
#include <tsound.h> #include <tsound.h>
#include <taboutnootka.h> #include <taboutnootka.h>
#include <tsupportnootka.h> #include <tsupportnootka.h>
#include <plugins/tpluginsloader.h>
#endif #endif
#include <level/tlevelselector.h>
#include <plugins/tpluginsloader.h>
extern Tglobals *gl; extern Tglobals *gl;
extern bool resetConfig; extern bool resetConfig;
...@@ -172,7 +171,7 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -172,7 +171,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(bar->aboutSimpleAct, &QAction::triggered, this, &MainWindow::aboutSlot); connect(bar->aboutSimpleAct, &QAction::triggered, this, &MainWindow::aboutSlot);
#else #else
connect(bar->settingsAct, SIGNAL(triggered()), this, SLOT(createSettingsDialog())); connect(bar->settingsAct, SIGNAL(triggered()), this, SLOT(createSettingsDialog()));
connect(bar->levelCreatorAct, SIGNAL(triggered()), this, SLOT(openLevelCreator())); // connect(bar->levelCreatorAct, SIGNAL(triggered()), this, SLOT(openLevelCreator()));
connect(bar->startExamAct, SIGNAL(triggered()), this, SLOT(startExamSlot())); connect(bar->startExamAct, SIGNAL(triggered()), this, SLOT(startExamSlot()));
connect(bar->analyseAct, SIGNAL(triggered()), this, SLOT(analyseSlot())); connect(bar->analyseAct, SIGNAL(triggered()), this, SLOT(analyseSlot()));
connect(bar->aboutAct, &QAction::triggered, this, &MainWindow::aboutSlot); connect(bar->aboutAct, &QAction::triggered, this, &MainWindow::aboutSlot);
...@@ -183,6 +182,7 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -183,6 +182,7 @@ MainWindow::MainWindow(QWidget *parent) :
#endif #endif
setSingleNoteMode(gl->S->isSingleNoteMode); setSingleNoteMode(gl->S->isSingleNoteMode);
connect(bar->levelCreatorAct, SIGNAL(triggered()), this, SLOT(openLevelCreator()));
connect(score, SIGNAL(noteChanged(int,Tnote)), this, SLOT(noteWasClicked(int,Tnote))); connect(score, SIGNAL(noteChanged(int,Tnote)), this, SLOT(noteWasClicked(int,Tnote)));
connect(score, &TmainScore::clefChanged, this, &MainWindow::adjustAmbitus); connect(score, &TmainScore::clefChanged, this, &MainWindow::adjustAmbitus);
connect(guitar, &TfingerBoard::guitarClicked, this, &MainWindow::guitarWasClicked); connect(guitar, &TfingerBoard::guitarClicked, this, &MainWindow::guitarWasClicked);
...@@ -345,7 +345,6 @@ void MainWindow::createSettingsDialog() { ...@@ -345,7 +345,6 @@ void MainWindow::createSettingsDialog() {
void MainWindow::openLevelCreator(QString levelFile) { void MainWindow::openLevelCreator(QString levelFile) {
#if !defined (Q_OS_ANDROID)
if (score->isScorePlayed()) if (score->isScorePlayed())
m_melButt->playMelodySlot(); // stop playing m_melButt->playMelodySlot(); // stop playing
sound->wait(); // stops pitch detection sound->wait(); // stops pitch detection
...@@ -368,15 +367,16 @@ void MainWindow::openLevelCreator(QString levelFile) { ...@@ -368,15 +367,16 @@ void MainWindow::openLevelCreator(QString levelFile) {
bool ok; bool ok;
int levelNr = levelText.toInt(&ok); int levelNr = levelText.toInt(&ok);
if (ok) { if (ok) {
#if !defined (Q_OS_ANDROID)
TlevelSelector ls; TlevelSelector ls;
ls.selectLevel(levelNr); ls.selectLevel(levelNr);
m_level = ls.getSelectedLevel(); m_level = ls.getSelectedLevel();
prepareToExam(); prepareToExam();
executor = new TexamExecutor(this, startExercise ? "exercise" : "", &m_level); // start exam executor = new TexamExecutor(this, startExercise ? "exercise" : "", &m_level); // start exam
#endif
} }
else else
sound->go(); // restore pitch detection sound->go(); // restore pitch detection
#endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment