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

Displaying help with usage of score and guitar when they are touched first time.

parent 3254031d
Branches
Tags
No related merge requests found
1.3.0 alpha
- added touch interface, adjusted GUI layout to it
ANDROID
- corner menu button and menu like standard Android apps have
- file and color dialogues adjusted for touch screens
- corner menu button and menu similar to Android native
- new layout of dialog windows for better touch integration
- audio stack ported to Qt Audio for mobile devices
Under the hood
......
......@@ -19,6 +19,7 @@
#include "tmainview.h"
#include "ttoolbar.h"
#include "tmenu.h"
#include "mainwindow.h"
#if defined (Q_OS_ANDROID)
#include "tmaterialmenu.h"
#include <widgets/tmelodyitem.h>
......@@ -29,6 +30,7 @@
#include <tlayoutparams.h>
#include <touch/ttouchproxy.h>
#include <touch/ttouchmenu.h>
#include <touch/ttouchparams.h>
#include <tpath.h>
#include <tmtr.h>
#include <graphics/tdropshadoweffect.h>
......@@ -37,8 +39,9 @@
TmainView::TmainView(TlayoutParams* layParams, TtoolBar* toolW, QWidget* statLabW, TpitchView* pitchW,
QGraphicsView* scoreW, QGraphicsView* guitarW, TnoteName* name, QWidget* parent) :
QGraphicsView* scoreW, QGraphicsView* guitarW, TnoteName* name, MainWindow* parent) :
QGraphicsView(parent),
m_mainWindow(parent),
m_layParams(layParams),
m_tool(toolW),
m_status(statLabW),
......@@ -437,31 +440,40 @@ bool TmainView::viewportEvent(QEvent *event) {
m_fretView->hide();
}
// mapping all touches to score
QList<QTouchEvent::TouchPoint> pointList;
for (int i = 0; i < te->touchPoints().size(); ++i) {
QTouchEvent::TouchPoint touchPoint(te->touchPoints()[i]);
touchPoint.setPos(m_score->mapFromParent(touchPoint.pos().toPoint())); // map to score
touchPoint.setLastPos(m_score->mapFromParent(touchPoint.lastPos().toPoint()));
// touchPoint.setStartPos(m_score->mapFromParent(touchPoint.startPos().toPoint())); // So far unused
pointList << touchPoint;
if (TtouchParams::i()->scoreWasTouched) {
QList<QTouchEvent::TouchPoint> pointList;
for (int i = 0; i < te->touchPoints().size(); ++i) {
QTouchEvent::TouchPoint touchPoint(te->touchPoints()[i]);
touchPoint.setPos(m_score->mapFromParent(touchPoint.pos().toPoint())); // map to score
touchPoint.setLastPos(m_score->mapFromParent(touchPoint.lastPos().toPoint()));
// touchPoint.setStartPos(m_score->mapFromParent(touchPoint.startPos().toPoint())); // So far unused
pointList << touchPoint;
}
QTouchEvent touchToSend(event->type(), te->device(), te->modifiers(), te->touchPointStates(), pointList);
if (qApp->notify(m_score->viewport(), &touchToSend)) {
m_touchedWidget = m_score->viewport();
}
if (event->type() == QEvent::TouchEnd)
m_touchedWidget = 0;
return true;
} else {
m_mainWindow->setStatusMessage(TtouchProxy::touchScoreHelp(), 0);
TtouchParams::i()->scoreWasTouched = true;
}
QTouchEvent touchToSend(event->type(), te->device(), te->modifiers(), te->touchPointStates(), pointList);
if (qApp->notify(m_score->viewport(), &touchToSend)) {
m_touchedWidget = m_score->viewport();
}
if (event->type() == QEvent::TouchEnd)
m_touchedWidget = 0;
return true;
// 1.1.5 guitar was touched
} else if (m_fretView->guitarEnabled() &&
(m_fretView->isVisible() || m_touchedWidget == m_guitar->viewport() ||
m_container->childAt(mapFromScene(te->touchPoints().first().startPos())) == m_guitar->viewport())) {
if (m_fretView->isPreview() && !TtouchParams::i()->guitarWasTouched) {
m_mainWindow->setStatusMessage(TtouchProxy::touchGuitarHelp(), 0);
TtouchParams::i()->guitarWasTouched = true;
return false;
}
if (event->type() == QEvent::TouchEnd) {
m_touchedWidget = 0;
} else
m_touchedWidget = m_guitar->viewport();
m_fretView->mapTouchEvent(te);
return true;
return m_fretView->mapTouchEvent(te);
}
// 2. Other temporary item was touched
} else if (m_fretView && m_fretView->guitarEnabled() && itemAt(te->touchPoints().first().startPos().toPoint()) == m_fretView->proxy()) {
......
......@@ -35,6 +35,7 @@ class QBoxLayout;
class QGraphicsProxyWidget;
class QAction;
class TmelodyItem;
class MainWindow;
/**
* This widget manages of a layout of main Nootka window
......@@ -48,17 +49,17 @@ Q_OBJECT
public:
TmainView(TlayoutParams* layParams, TtoolBar* toolW, QWidget* statLabW, TpitchView* pitchW,
QGraphicsView* scoreW, QGraphicsView* guitarW, TnoteName* name, QWidget* parent = 0);
QGraphicsView* scoreW, QGraphicsView* guitarW, TnoteName* name, MainWindow* parent);
virtual ~TmainView();
void addNoteName(); /** Adds note name widget over a score (for single note mode) */
void takeNoteName(); /** Takes note name from view. */
void addExamViews(QWidget* resultsW, QWidget* progressW); /** Adds bar with those widgets */
void takeExamViews(); /** Removes exam widgets, WIDGETS ARE DELETED! */
void moveExamToName(); /** Moves 'exam view' above note view. Changes its direction to vertical. */
void setBarAutoHide(bool autoHide); /** Makes tool bar permanently visible or displayed on demand (mouse action) */
bool isAutoHide() { return m_isAutoHide; }
......@@ -97,8 +98,9 @@ protected slots:
void mainMenuExec();
void scoreMenuExec();
private:
MainWindow *m_mainWindow;
QWidget *m_status;
QGraphicsView *m_score, *m_guitar;
QWidget *m_results, *m_progress, *m_container, *m_touchedWidget;
......
......@@ -24,6 +24,26 @@
bool TtouchProxy::m_touchEnabled = false;
TtouchProxy* TtouchProxy::m_instance = 0;
QString TtouchProxy::touchScoreHelp() {
return tr("To edit a note in a score:<br>"
"Touch area about some note and move a finger - note cursor will appear to set a pitch of this note.<br>"
"Then take the finger away - additional buttons will appear for a while.<br>"
"You may add/remove an accidental or a note.<br>"
"Touch and move again to continue setting the pitch.<br>"
"To select the note - tap it quickly again.<br>"
"Touch a clef for a while to change it.<br>"
"To scroll the score with multiple staves - use two fingers");
}
QString TtouchProxy::touchGuitarHelp() {
return tr("Tap a fret you want to select - zoomed preview will appear.<br>"
"You may drag it right or left to change the fret.<br>"
"Tap zoomed preview on desired string to set the position."
);
}
TtouchProxy::TtouchProxy(QObject* parent) :
QObject(parent)
......
......@@ -43,6 +43,9 @@ public:
static void setTouchEnabled(bool touch);
static TtouchProxy* instance() { return m_instance; }
static QString touchScoreHelp(); /** Returns description text (multiple lines) how to use score with touch */
static QString touchGuitarHelp(); /** Returns description text (multiple lines) how to use fingerboard with touch */
signals:
void touchStateChanged(bool); /** Emitting when enabling of touch events changes. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment