Added hot key shortcuts for Qt TAS editor window.
This commit is contained in:
parent
8cfab72523
commit
f351150ad9
|
@ -3590,7 +3590,13 @@ void consoleWin_t::toggleMovieFrameDisplay(void)
|
||||||
void consoleWin_t::toggleMovieReadWrite(void)
|
void consoleWin_t::toggleMovieReadWrite(void)
|
||||||
{
|
{
|
||||||
fceuWrapperLock();
|
fceuWrapperLock();
|
||||||
FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
|
//FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
|
||||||
|
FCEUI_MovieToggleReadOnly();
|
||||||
|
|
||||||
|
if ( tasWin != NULL )
|
||||||
|
{
|
||||||
|
tasWin->updateRecordStatus();
|
||||||
|
}
|
||||||
fceuWrapperUnLock();
|
fceuWrapperUnLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,11 @@ TasEditorWindow::TasEditorWindow(QWidget *parent)
|
||||||
mainLayout->setMenuBar( menuBar );
|
mainLayout->setMenuBar( menuBar );
|
||||||
pianoRoll->setFocus();
|
pianoRoll->setFocus();
|
||||||
|
|
||||||
|
for (int i=0; i<HK_MAX; i++)
|
||||||
|
{
|
||||||
|
hotkeyShortcut[i] = nullptr;
|
||||||
|
}
|
||||||
|
initHotKeys();
|
||||||
initModules();
|
initModules();
|
||||||
|
|
||||||
updateCheckedItems();
|
updateCheckedItems();
|
||||||
|
@ -1174,8 +1179,8 @@ void TasEditorWindow::buildSideControlPanel(void)
|
||||||
connect( similarBtn, SIGNAL(clicked(void)), this, SLOT(findSimilarNote(void)) );
|
connect( similarBtn, SIGNAL(clicked(void)), this, SLOT(findSimilarNote(void)) );
|
||||||
connect( moreBtn , SIGNAL(clicked(void)), this, SLOT(findNextSimilarNote(void)) );
|
connect( moreBtn , SIGNAL(clicked(void)), this, SLOT(findNextSimilarNote(void)) );
|
||||||
|
|
||||||
shortcut = new QShortcut( QKeySequence("Pause"), this);
|
//shortcut = new QShortcut( QKeySequence("Pause"), this);
|
||||||
connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackPauseCB(void)) );
|
//connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackPauseCB(void)) );
|
||||||
|
|
||||||
shortcut = new QShortcut( QKeySequence("Shift+Up"), this);
|
shortcut = new QShortcut( QKeySequence("Shift+Up"), this);
|
||||||
connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameRewind(void)) );
|
connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameRewind(void)) );
|
||||||
|
@ -1201,6 +1206,53 @@ void TasEditorWindow::buildSideControlPanel(void)
|
||||||
connect( bkmkBrnchStack, SIGNAL(currentChanged(int)), this, SLOT(tabViewChanged(int) ) );
|
connect( bkmkBrnchStack, SIGNAL(currentChanged(int)), this, SLOT(tabViewChanged(int) ) );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::initHotKeys(void)
|
||||||
|
{
|
||||||
|
for (int i=0; i<HK_MAX; i++)
|
||||||
|
{
|
||||||
|
QKeySequence ks = Hotkeys[i].getKeySeq();
|
||||||
|
QShortcut *shortcut = Hotkeys[i].getShortcut();
|
||||||
|
|
||||||
|
//printf("HotKey: %i %s\n", i, ks.toString().toStdString().c_str() );
|
||||||
|
|
||||||
|
if ( hotkeyShortcut[i] == nullptr )
|
||||||
|
{
|
||||||
|
hotkeyShortcut[i] = new QShortcut( ks, this );
|
||||||
|
|
||||||
|
if ( shortcut != nullptr )
|
||||||
|
{
|
||||||
|
connect( hotkeyShortcut[i], &QShortcut::activated, [ this, i, shortcut ] { activateHotkey( i, shortcut ); } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hotkeyShortcut[i]->setKey( ks );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frame Advance uses key state directly, disable shortcut events
|
||||||
|
hotkeyShortcut[HK_FRAME_ADVANCE]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_TURBO ]->setEnabled(false);
|
||||||
|
|
||||||
|
// Disable shortcuts that are not allowed with TAS Editor
|
||||||
|
hotkeyShortcut[HK_OPEN_ROM ]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_CLOSE_ROM ]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_QUIT ]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_FULLSCREEN ]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_MAIN_MENU_HIDE]->setEnabled(false);
|
||||||
|
hotkeyShortcut[HK_LOAD_LUA ]->setEnabled(false);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::activateHotkey( int hkIdx, QShortcut *shortcut )
|
||||||
|
{
|
||||||
|
shortcut->activated();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void TasEditorWindow::updateRecordStatus(void)
|
||||||
|
{
|
||||||
|
recRecordingCbox->setChecked( !movie_readonly );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void TasEditorWindow::updateCheckedItems(void)
|
void TasEditorWindow::updateCheckedItems(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1387,7 +1439,7 @@ void TasEditorWindow::frameUpdate(void)
|
||||||
mustCallManualLuaFunction = false;
|
mustCallManualLuaFunction = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pianoRoll->update();
|
pianoRoll->update();
|
||||||
|
|
||||||
if ( recentProjectMenuReset )
|
if ( recentProjectMenuReset )
|
||||||
|
@ -2241,11 +2293,15 @@ void TasEditorWindow::setCurrentPattern(int idx)
|
||||||
taseditorConfig.currentPattern = idx;
|
taseditorConfig.currentPattern = idx;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void TasEditorWindow::recordingChanged(int state)
|
void TasEditorWindow::recordingChanged(int newState)
|
||||||
{
|
{
|
||||||
fceuCriticalSection emuLock;
|
fceuCriticalSection emuLock;
|
||||||
|
int oldState = !movie_readonly ? Qt::Checked : Qt::Unchecked;
|
||||||
|
|
||||||
FCEUI_MovieToggleReadOnly();
|
if ( newState != oldState )
|
||||||
|
{
|
||||||
|
FCEUI_MovieToggleReadOnly();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void TasEditorWindow::editUndoCB(void)
|
void TasEditorWindow::editUndoCB(void)
|
||||||
|
@ -3927,10 +3983,10 @@ void QPianoRoll::contextMenuEvent(QContextMenuEvent *event)
|
||||||
|
|
||||||
mkr = markersManager->getMarkerAtFrame( rowUnderMouse );
|
mkr = markersManager->getMarkerAtFrame( rowUnderMouse );
|
||||||
|
|
||||||
act = new QAction(tr("Set Markers"), &menu);
|
act = new QAction(tr("Set Markers\tDbl-Clk"), &menu);
|
||||||
menu.addAction(act);
|
menu.addAction(act);
|
||||||
act->setEnabled( mkr == 0 );
|
act->setEnabled( mkr == 0 );
|
||||||
act->setShortcut(QKeySequence(tr("Double Click")));
|
//act->setShortcut(QKeySequence(tr("Double Click")));
|
||||||
connect(act, SIGNAL(triggered(void)), tasWin, SLOT(setMarkers(void)));
|
connect(act, SIGNAL(triggered(void)), tasWin, SLOT(setMarkers(void)));
|
||||||
|
|
||||||
act = new QAction(tr("Remove Markers"), &menu);
|
act = new QAction(tr("Remove Markers"), &menu);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
|
#include "Qt/config.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
#include "Qt/TasEditor/taseditor_config.h"
|
#include "Qt/TasEditor/taseditor_config.h"
|
||||||
#include "Qt/TasEditor/taseditor_project.h"
|
#include "Qt/TasEditor/taseditor_project.h"
|
||||||
|
@ -327,6 +328,7 @@ class TasEditorWindow : public QDialog
|
||||||
QMenuBar *buildMenuBar(void);
|
QMenuBar *buildMenuBar(void);
|
||||||
void buildPianoRollDisplay(void);
|
void buildPianoRollDisplay(void);
|
||||||
void buildSideControlPanel(void);
|
void buildSideControlPanel(void);
|
||||||
|
void initHotKeys(void);
|
||||||
void initPatterns(void);
|
void initPatterns(void);
|
||||||
|
|
||||||
QMenu *recentProjectMenu;
|
QMenu *recentProjectMenu;
|
||||||
|
@ -404,6 +406,8 @@ class TasEditorWindow : public QDialog
|
||||||
|
|
||||||
QClipboard *clipboard;
|
QClipboard *clipboard;
|
||||||
|
|
||||||
|
QShortcut *hotkeyShortcut[HK_MAX];
|
||||||
|
|
||||||
std::vector<std::string> patternsNames;
|
std::vector<std::string> patternsNames;
|
||||||
std::vector<std::vector<uint8_t>> patterns;
|
std::vector<std::vector<uint8_t>> patterns;
|
||||||
std::list <std::string*> projList;
|
std::list <std::string*> projList;
|
||||||
|
@ -428,6 +432,7 @@ class TasEditorWindow : public QDialog
|
||||||
void frameUpdate(void);
|
void frameUpdate(void);
|
||||||
void updateCheckedItems(void);
|
void updateCheckedItems(void);
|
||||||
void updateHistoryItems(void);
|
void updateHistoryItems(void);
|
||||||
|
void updateRecordStatus(void);
|
||||||
private slots:
|
private slots:
|
||||||
void openProject(void);
|
void openProject(void);
|
||||||
void saveProjectCb(void);
|
void saveProjectCb(void);
|
||||||
|
@ -507,6 +512,7 @@ class TasEditorWindow : public QDialog
|
||||||
void setMarkers(void);
|
void setMarkers(void);
|
||||||
void removeMarkers(void);
|
void removeMarkers(void);
|
||||||
void ungreenzoneSelectedFrames(void);
|
void ungreenzoneSelectedFrames(void);
|
||||||
|
void activateHotkey( int hkIdx, QShortcut *shortcut );
|
||||||
|
|
||||||
friend class RECORDER;
|
friend class RECORDER;
|
||||||
friend class SPLICER;
|
friend class SPLICER;
|
||||||
|
|
Loading…
Reference in New Issue