Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
328188cf
Commit
328188cf
authored
Jan 22, 2010
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo/redo now works even if the history dock is closed.
parent
9003b2d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
7 deletions
+43
-7
src/Gui/MainWindow.cpp
src/Gui/MainWindow.cpp
+16
-0
src/Gui/MainWindow.h
src/Gui/MainWindow.h
+2
-0
src/Gui/UndoStack.cpp
src/Gui/UndoStack.cpp
+10
-5
src/Gui/UndoStack.h
src/Gui/UndoStack.h
+2
-2
src/Gui/ui/MainWindow.ui
src/Gui/ui/MainWindow.ui
+13
-0
No files found.
src/Gui/MainWindow.cpp
View file @
328188cf
...
...
@@ -459,6 +459,16 @@ void MainWindow::on_actionClose_Project_triggered()
ProjectManager
::
getInstance
()
->
closeProject
();
}
void
MainWindow
::
on_actionUndo_triggered
()
{
UndoStack
::
getInstance
(
this
)
->
undo
();
}
void
MainWindow
::
on_actionRedo_triggered
()
{
UndoStack
::
getInstance
(
this
)
->
redo
();
}
#define INIT_SHORTCUT( instName, shortcutName, actionInstance ) \
const SettingValue* instName = SettingsManager::getInstance()->getValue( "keyboard_shortcut", shortcutName );\
KeyboardShortcutHelper* helper##instName = new KeyboardShortcutHelper( shortcutName, this, true ); \
...
...
@@ -478,6 +488,8 @@ void MainWindow::initializeMenuKeyboardShortcut()
INIT_SHORTCUT
(
closeProject
,
"Close project"
,
actionClose_Project
);
INIT_SHORTCUT
(
importProject
,
"Import media"
,
actionImport
);
INIT_SHORTCUT
(
renderProject
,
"Render project"
,
actionRender
);
INIT_SHORTCUT
(
undo
,
"Undo"
,
actionUndo
);
INIT_SHORTCUT
(
redo
,
"Redo"
,
actionRedo
);
}
#undef INIT_SHORTCUT
...
...
@@ -507,6 +519,10 @@ void MainWindow::keyboardShortcutChanged( const QString& name, const QString&
m_ui
.
actionImport
->
setShortcut
(
val
);
else
if
(
name
==
"Render project"
)
m_ui
.
actionRender
->
setShortcut
(
val
);
else
if
(
name
==
"Undo"
)
m_ui
.
actionUndo
->
setShortcut
(
val
);
else
if
(
name
==
"Redo"
)
m_ui
.
actionRedo
->
setShortcut
(
val
);
else
qWarning
()
<<
"Unknown shortcut:"
<<
name
;
}
...
...
src/Gui/MainWindow.h
View file @
328188cf
...
...
@@ -102,6 +102,8 @@ private slots:
void
on_actionHelp_triggered
();
void
on_actionProject_Preferences_triggered
();
void
on_actionClose_Project_triggered
();
void
on_actionUndo_triggered
();
void
on_actionRedo_triggered
();
void
on_actionCrash_triggered
();
void
on_actionImport_triggered
();
void
toolButtonClicked
(
int
id
);
...
...
src/Gui/UndoStack.cpp
View file @
328188cf
...
...
@@ -40,11 +40,6 @@ UndoStack::UndoStack( QWidget* parent ) : QUndoView( parent )
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
projectSaved
()
),
m_undoStack
,
SLOT
(
setClean
()
)
);
m_undoShortcut
=
new
KeyboardShortcutHelper
(
"Undo"
,
this
);
m_redoShortcut
=
new
KeyboardShortcutHelper
(
"Redo"
,
this
);
connect
(
m_undoShortcut
,
SIGNAL
(
activated
()
),
m_undoStack
,
SLOT
(
undo
()
)
);
connect
(
m_redoShortcut
,
SIGNAL
(
activated
()
),
m_undoStack
,
SLOT
(
redo
()
)
);
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
projectClosed
()
),
this
,
SLOT
(
clear
()
)
);
}
...
...
@@ -67,3 +62,13 @@ void UndoStack::clear()
{
m_undoStack
->
clear
();
}
void
UndoStack
::
undo
()
{
m_undoStack
->
undo
();
}
void
UndoStack
::
redo
()
{
m_undoStack
->
redo
();
}
src/Gui/UndoStack.h
View file @
328188cf
...
...
@@ -45,11 +45,11 @@ class UndoStack : public QUndoView, public QSingleton<UndoStack>
UndoStack
(
QWidget
*
parent
);
QUndoStack
*
m_undoStack
;
KeyboardShortcutHelper
*
m_undoShortcut
;
KeyboardShortcutHelper
*
m_redoShortcut
;
public
slots
:
void
clear
();
void
undo
();
void
redo
();
signals:
void
cleanChanged
(
bool
val
);
...
...
src/Gui/ui/MainWindow.ui
View file @
328188cf
...
...
@@ -50,6 +50,9 @@
<property
name=
"title"
>
<string>
Edit
</string>
</property>
<addaction
name=
"actionUndo"
/>
<addaction
name=
"actionRedo"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionPreferences"
/>
<addaction
name=
"actionProject_Preferences"
/>
</widget>
...
...
@@ -217,6 +220,16 @@
<string>
Crash
</string>
</property>
</action>
<action
name=
"actionUndo"
>
<property
name=
"text"
>
<string>
Undo
</string>
</property>
</action>
<action
name=
"actionRedo"
>
<property
name=
"text"
>
<string>
Redo
</string>
</property>
</action>
</widget>
<resources>
<include
location=
"../../../ressources.qrc"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment