Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
f4725115
Commit
f4725115
authored
Jan 22, 2010
by
Ludovic Fauvet
Browse files
Disable undo/redo menu items if no action available in the stack
parent
48e382b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Gui/MainWindow.cpp
View file @
f4725115
...
...
@@ -111,6 +111,15 @@ MainWindow::MainWindow( QWidget *parent ) :
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
projectUpdated
(
const
QString
&
,
bool
)
),
this
,
SLOT
(
projectUpdated
(
const
QString
&
,
bool
)
)
);
// Undo/Redo
connect
(
UndoStack
::
getInstance
(
this
),
SIGNAL
(
canRedoChanged
(
bool
)
),
this
,
SLOT
(
canRedoChanged
(
bool
)
)
);
connect
(
UndoStack
::
getInstance
(
this
),
SIGNAL
(
canUndoChanged
(
bool
)
),
this
,
SLOT
(
canUndoChanged
(
bool
)
)
);
canRedoChanged
(
UndoStack
::
getInstance
(
this
)
->
canRedo
()
);
canUndoChanged
(
UndoStack
::
getInstance
(
this
)
->
canUndo
()
);
// Wizard
m_pWizard
=
new
ProjectWizard
(
this
);
m_pWizard
->
setModal
(
true
);
...
...
@@ -575,6 +584,16 @@ void MainWindow::on_actionImport_triggered()
m_importController
->
exec
();
}
void
MainWindow
::
canUndoChanged
(
bool
canUndo
)
{
m_ui
.
actionUndo
->
setEnabled
(
canUndo
);
}
void
MainWindow
::
canRedoChanged
(
bool
canRedo
)
{
m_ui
.
actionRedo
->
setEnabled
(
canRedo
);
}
#ifdef DEBUG_CRASHHANDLER
void
MainWindow
::
setupCrashTester
()
{
...
...
src/Gui/MainWindow.h
View file @
f4725115
...
...
@@ -109,6 +109,8 @@ private slots:
void
toolButtonClicked
(
int
id
);
void
projectUpdated
(
const
QString
&
projectName
,
bool
savedStatus
);
void
keyboardShortcutChanged
(
const
QString
&
,
const
QString
&
);
void
canUndoChanged
(
bool
canUndo
);
void
canRedoChanged
(
bool
canRedo
);
signals:
void
translateDockWidgetTitle
();
...
...
src/Gui/UndoStack.cpp
View file @
f4725115
...
...
@@ -40,6 +40,9 @@ UndoStack::UndoStack( QWidget* parent ) : QUndoView( parent )
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
projectSaved
()
),
m_undoStack
,
SLOT
(
setClean
()
)
);
connect
(
m_undoStack
,
SIGNAL
(
canRedoChanged
(
bool
)
),
this
,
SIGNAL
(
canRedoChanged
(
bool
)
)
);
connect
(
m_undoStack
,
SIGNAL
(
canUndoChanged
(
bool
)
),
this
,
SIGNAL
(
canUndoChanged
(
bool
)
)
);
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
projectClosed
()
),
this
,
SLOT
(
clear
()
)
);
}
...
...
@@ -58,6 +61,16 @@ void UndoStack::endMacro()
m_undoStack
->
endMacro
();
}
bool
UndoStack
::
canUndo
()
{
m_undoStack
->
canUndo
();
}
bool
UndoStack
::
canRedo
()
{
m_undoStack
->
canRedo
();
}
void
UndoStack
::
clear
()
{
m_undoStack
->
clear
();
...
...
src/Gui/UndoStack.h
View file @
f4725115
...
...
@@ -40,6 +40,8 @@ class UndoStack : public QUndoView, public QSingleton<UndoStack>
void
push
(
QUndoCommand
*
command
);
void
beginMacro
(
const
QString
&
text
);
void
endMacro
();
bool
canUndo
();
bool
canRedo
();
private:
UndoStack
(
QWidget
*
parent
);
...
...
@@ -53,6 +55,8 @@ class UndoStack : public QUndoView, public QSingleton<UndoStack>
signals:
void
cleanChanged
(
bool
val
);
void
canRedoChanged
(
bool
canRedo
);
void
canUndoChanged
(
bool
canUndo
);
friend
class
QSingleton
<
UndoStack
>
;
};
...
...
Write
Preview
Supports
Markdown
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