Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
luyikei
VLMC
Commits
f4725115
Commit
f4725115
authored
Jan 22, 2010
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable undo/redo menu items if no action available in the stack
parent
48e382b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
+38
-0
src/Gui/MainWindow.cpp
src/Gui/MainWindow.cpp
+19
-0
src/Gui/MainWindow.h
src/Gui/MainWindow.h
+2
-0
src/Gui/UndoStack.cpp
src/Gui/UndoStack.cpp
+13
-0
src/Gui/UndoStack.h
src/Gui/UndoStack.h
+4
-0
No files found.
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
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