Merge pull request #1621 from shun-iwasawa/touch_control_optional

touch control optional
This commit is contained in:
Jeremy Bullock 2017-12-01 02:23:54 -06:00 committed by GitHub
commit 8894e90d79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 18 deletions

View file

@ -75,6 +75,8 @@
<command>MI_BringForward</command>
<command>MI_SendBack</command>
<command>MI_SendBackward</command>
<separator/>
<command>MI_TouchGestureControl</command>
</menu>
<menu title="Scan &amp;&amp; Cleanup">
<command>MI_DefineScanner</command>

View file

@ -74,6 +74,8 @@
<command>MI_ResetShift</command>
<separator/>
<command>MI_RasterizePli</command>
<separator/>
<command>MI_TouchGestureControl</command>
</menu>
<menu title="Edit">
<command>MI_Undo</command>

View file

@ -86,6 +86,7 @@ TEnv::IntVar DockingCheckToggleAction("DockingCheckToggleAction", 0);
TEnv::IntVar ShiftTraceToggleAction("ShiftTraceToggleAction", 0);
TEnv::IntVar EditShiftToggleAction("EditShiftToggleAction", 0);
TEnv::IntVar NoShiftToggleAction("NoShiftToggleAction", 0);
TEnv::IntVar TouchGestureControl("TouchGestureControl", 0);
//=============================================================================
namespace {
@ -1294,6 +1295,8 @@ void MainWindow::onMenuCheckboxChanged() {
EditShiftToggleAction = isChecked;
else if (cm->getAction(MI_NoShift) == action)
NoShiftToggleAction = isChecked;
else if (cm->getAction(MI_TouchGestureControl) == action)
TouchGestureControl = isChecked;
}
//-----------------------------------------------------------------------------
@ -1704,6 +1707,10 @@ void MainWindow::defineActions() {
createMenuEditAction(MI_ExitGroup, tr("&Exit Group"), "");
createMenuEditAction(MI_RemoveEndpoints, tr("&Remove Vector Overflow"), "");
createToggle(MI_TouchGestureControl, tr("&Touch Gesture Control"), "",
TouchGestureControl ? 1 : 0, MenuEditCommandType)
->setEnabled(true);
createMenuScanCleanupAction(MI_DefineScanner, tr("&Define Scanner..."), "");
createMenuScanCleanupAction(MI_ScanSettings, tr("&Scan Settings..."), "");
createMenuScanCleanupAction(MI_Scan, tr("&Scan"), "");
@ -2373,9 +2380,9 @@ RecentFiles::~RecentFiles() {}
void RecentFiles::addFilePath(QString path, FileType fileType) {
QList<QString> files =
(fileType == Scene) ? m_recentScenes : (fileType == Level)
? m_recentLevels
: m_recentFlipbookImages;
(fileType == Scene)
? m_recentScenes
: (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
int i;
for (i = 0; i < files.size(); i++)
if (files.at(i) == path) files.removeAt(i);
@ -2500,9 +2507,9 @@ void RecentFiles::saveRecentFiles() {
QList<QString> RecentFiles::getFilesNameList(FileType fileType) {
QList<QString> files =
(fileType == Scene) ? m_recentScenes : (fileType == Level)
? m_recentLevels
: m_recentFlipbookImages;
(fileType == Scene)
? m_recentScenes
: (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
QList<QString> names;
int i;
for (i = 0; i < files.size(); i++) {
@ -2529,9 +2536,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) {
menu->setEnabled(false);
else {
CommandId clearActionId =
(fileType == Scene) ? MI_ClearRecentScene : (fileType == Level)
? MI_ClearRecentLevel
: MI_ClearRecentImage;
(fileType == Scene)
? MI_ClearRecentScene
: (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage;
menu->setActions(names);
menu->addSeparator();
QAction *clearAction = CommandManager::instance()->getAction(clearActionId);

View file

@ -1152,6 +1152,10 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
addMenuItem(editMenu, MI_BringForward);
addMenuItem(editMenu, MI_SendBack);
addMenuItem(editMenu, MI_SendBackward);
editMenu->addSeparator();
addMenuItem(editMenu, MI_TouchGestureControl);
// Menu' SCAN CLEANUP
#ifdef LINETEST
QMenu *scanCleanupMenu = addMenu(tr("Scan"));

View file

@ -328,4 +328,6 @@
#define MI_AudioRecording "MI_AudioRecording"
#define MI_LipSyncPopup "MI_LipSyncPopup"
#define MI_AutoInputCellNumber "MI_AutoInputCellNumber"
#define MI_TouchGestureControl "MI_TouchGestureControl"
#endif

View file

@ -927,6 +927,9 @@ void SceneViewer::touchEvent(QTouchEvent *e, int type) {
//-----------------------------------------------------------------------------
bool SceneViewer::event(QEvent *e) {
if (CommandManager::instance()
->getAction(MI_TouchGestureControl)
->isChecked()) {
if (e->type() == QEvent::Gesture) {
gestureEvent(static_cast<QGestureEvent *>(e));
return true;
@ -937,6 +940,7 @@ bool SceneViewer::event(QEvent *e) {
m_gestureActive = true;
return true;
}
}
if (e->type() == QEvent::ShortcutOverride || e->type() == QEvent::KeyPress) {
if (!((QKeyEvent *)e)->isAutoRepeat()) {
TApp::instance()->getCurrentTool()->storeTool();