Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
66434683
Commit
66434683
authored
Feb 23, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] - added command prompt skeleton. Not yet completely done.
parent
6702d537
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
335 additions
and
1 deletion
+335
-1
src/gui/qt4/CMakeLists.txt
src/gui/qt4/CMakeLists.txt
+4
-1
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+5
-0
src/gui/qt4/WMainWindow.h
src/gui/qt4/WMainWindow.h
+3
-0
src/gui/qt4/commandPrompt/WQtCommandPrompt.cpp
src/gui/qt4/commandPrompt/WQtCommandPrompt.cpp
+82
-0
src/gui/qt4/commandPrompt/WQtCommandPrompt.h
src/gui/qt4/commandPrompt/WQtCommandPrompt.h
+88
-0
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.cpp
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.cpp
+75
-0
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.h
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.h
+78
-0
No files found.
src/gui/qt4/CMakeLists.txt
View file @
66434683
...
...
@@ -41,6 +41,8 @@ SET(GUI_QT4_MOC_HDRS
networkEditor/WQtNetworkInputPort.h
networkEditor/WQtNetworkOutputPort.h
networkEditor/WQtNetworkArrow.h
commandPrompt/WQtCommandPromptToolbar.h
commandPrompt/WQtCommandPrompt.h
)
IF
(
CMAKE_HOST_SYSTEM MATCHES Darwin
)
LIST
(
APPEND GUI_QT4_MOC_HDRS platformDependent/WQtGLWidgetMac.h
)
...
...
@@ -55,7 +57,8 @@ ENDIF()
QT4_WRAP_CPP
(
GUI_QT4_MOC_SRCS
${
GUI_QT4_MOC_HDRS
}
)
FILE
(
GLOB GUI_QT4_SRC
"*.cpp"
"guiElements/*.cpp"
"controlPanel/*.cpp"
"events/*.cpp"
"networkEditor/*.cpp"
"*.h"
"guiElements/*.h"
"controlPanel/*.h"
"events/*.h"
"networkEditor/*.h"
"../icons/WIcons.h"
)
FILE
(
GLOB GUI_QT4_SRC
"*.cpp"
"guiElements/*.cpp"
"controlPanel/*.cpp"
"events/*.cpp"
"networkEditor/*.cpp"
"*.h"
"guiElements/*.h"
"controlPanel/*.h"
"events/*.h"
"networkEditor/*.h"
"../icons/WIcons.h"
"commandPrompt/*.h"
"commandPrompt/*.cpp"
)
IF
(
CMAKE_HOST_SYSTEM MATCHES Darwin
)
FILE
(
GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetMac.cpp"
...
...
src/gui/qt4/WMainWindow.cpp
View file @
66434683
...
...
@@ -268,6 +268,11 @@ void WMainWindow::setupGUI()
}
}
// create command prompt toolbar
m_commandPrompt
=
new
WQtCommandPromptToolbar
(
"Command Prompt"
,
this
);
addToolBar
(
Qt
::
TopToolBarArea
,
m_commandPrompt
);
this
->
addAction
(
m_commandPrompt
->
toggleViewAction
()
);
// this enables the action even if the menu bar is invisible
// after creating the GUI, restore its saved state
restoreSavedState
();
}
...
...
src/gui/qt4/WMainWindow.h
View file @
66434683
...
...
@@ -40,6 +40,7 @@
#include "WQtToolBar.h"
#include "WQtGLWidget.h"
#include "networkEditor/WQtNetworkEditor.h"
#include "commandPrompt/WQtCommandPromptToolbar.h"
// forward declarations
class
QMenuBar
;
...
...
@@ -298,6 +299,8 @@ private:
WQtNetworkEditor
*
m_networkEditor
;
//!< network editor
WQtCommandPromptToolbar
*
m_commandPrompt
;
//!< command prompt
boost
::
shared_ptr
<
WQtGLWidget
>
m_mainGLWidget
;
//!< the main GL widget of the GUI
boost
::
shared_ptr
<
WQtNavGLWidget
>
m_navAxial
;
//!< the axial view widget GL widget of the GUI
boost
::
shared_ptr
<
WQtNavGLWidget
>
m_navCoronal
;
//!< the coronal view widget GL widget of the GUI
...
...
src/gui/qt4/commandPrompt/WQtCommandPrompt.cpp
0 → 100644
View file @
66434683
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <QtGui/QAction>
#include <QtGui/QLineEdit>
#include <QtGui/QKeyEvent>
#include "../WMainWindow.h"
#include "WQtCommandPrompt.h"
WQtCommandPrompt
::
WQtCommandPrompt
(
QWidget
*
parent
)
:
QLineEdit
(
parent
)
{
setText
(
"Not yet implemented. But as you tried the command prompt I assume you are a cool VIM user ;-)."
);
connect
(
this
,
SIGNAL
(
returnPressed
()
),
this
,
SLOT
(
commit
()
)
);
}
WQtCommandPrompt
::~
WQtCommandPrompt
()
{
// cleanup
}
void
WQtCommandPrompt
::
abort
()
{
setText
(
""
);
emit
done
();
}
void
WQtCommandPrompt
::
commit
()
{
setText
(
""
);
emit
done
();
}
void
WQtCommandPrompt
::
keyPressEvent
(
QKeyEvent
*
event
)
{
QLineEdit
::
keyPressEvent
(
event
);
}
bool
WQtCommandPrompt
::
event
(
QEvent
*
event
)
{
// we need to override this to be able to grab the escape key
if
(
event
->
type
()
==
QEvent
::
KeyRelease
)
{
QKeyEvent
*
keyEvent
=
dynamic_cast
<
QKeyEvent
*
>
(
event
);
// escape quits the prompt
if
(
keyEvent
&&
(
keyEvent
->
key
()
==
Qt
::
Key_Escape
)
)
{
abort
();
event
->
accept
();
return
true
;
}
}
return
QLineEdit
::
event
(
event
);
}
src/gui/qt4/commandPrompt/WQtCommandPrompt.h
0 → 100644
View file @
66434683
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTCOMMANDPROMPT_H
#define WQTCOMMANDPROMPT_H
#include <QtGui/QLineEdit>
/**
* This is a toolbar. It provides a command prompt -like interface for adding, removing and connecting modules
*/
class
WQtCommandPrompt
:
public
QLineEdit
{
Q_OBJECT
public:
/**
* Constructs the prompt.
*
* \param parent the parent widget of this widget, i.e. the widget that manages it.
*/
explicit
WQtCommandPrompt
(
QWidget
*
parent
);
/**
* destructor
*/
virtual
~
WQtCommandPrompt
();
signals:
/**
* Emited if the prompt should quit. On ESC or after commiting a command.
*/
void
done
();
protected:
/**
* Converts the given key press event into a line edit action.
*
* \param event the key
*/
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
/**
* Event handler
*
* \param event the event
*
* \return true if event was handled.
*/
bool
event
(
QEvent
*
event
);
private
slots
:
/**
* This aborts. The typed command will not be sent.
*/
void
abort
();
/**
* Commit the current command.
*/
void
commit
();
private:
};
#endif // WQTCOMMANDPROMPT_H
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.cpp
0 → 100644
View file @
66434683
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <QtGui/QAction>
#include <QtGui/QLabel>
#include "../WMainWindow.h"
#include "WQtCommandPrompt.h"
#include "WQtCommandPromptToolbar.h"
WQtCommandPromptToolbar
::
WQtCommandPromptToolbar
(
const
QString
&
title
,
WMainWindow
*
parent
)
:
QToolBar
(
title
,
parent
),
m_mainWindow
(
parent
)
{
setObjectName
(
title
);
this
->
setAllowedAreas
(
Qt
::
TopToolBarArea
|
Qt
::
BottomToolBarArea
);
setMinimumWidth
(
50
);
setMinimumHeight
(
30
);
setVisible
(
false
);
// toggle it using ":"
QList
<
QKeySequence
>
commandPromptShortcut
;
commandPromptShortcut
.
append
(
QKeySequence
(
Qt
::
Key_Colon
)
);
toggleViewAction
()
->
setShortcuts
(
commandPromptShortcut
);
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
"<b># </b>"
);
addWidget
(
label
);
m_prompt
=
new
WQtCommandPrompt
(
this
);
addWidget
(
m_prompt
);
// if the toolbar is triggered:
connect
(
toggleViewAction
(),
SIGNAL
(
triggered
(
bool
)
),
this
,
SLOT
(
show
()
)
);
connect
(
m_prompt
,
SIGNAL
(
done
()
),
this
,
SLOT
(
exit
()
)
);
}
WQtCommandPromptToolbar
::~
WQtCommandPromptToolbar
()
{
// cleanup
}
void
WQtCommandPromptToolbar
::
show
()
{
setVisible
(
true
);
m_prompt
->
setFocus
();
}
void
WQtCommandPromptToolbar
::
exit
()
{
setVisible
(
false
);
}
src/gui/qt4/commandPrompt/WQtCommandPromptToolbar.h
0 → 100644
View file @
66434683
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTCOMMANDPROMPTTOOLBAR_H
#define WQTCOMMANDPROMPTTOOLBAR_H
#include <QtGui/QToolBar>
class
WQtCommandPrompt
;
class
WMainWindow
;
/**
* This is a toolbar. It provides a command prompt -like interface for adding, removing and connecting modules
*/
class
WQtCommandPromptToolbar
:
public
QToolBar
{
Q_OBJECT
public:
/**
* Constructs the toolbar.
* \param title name of the toolbar.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
*/
explicit
WQtCommandPromptToolbar
(
const
QString
&
title
,
WMainWindow
*
parent
);
/**
* destructor
*/
virtual
~
WQtCommandPromptToolbar
();
protected:
private
slots
:
/**
* Toggles the prompt toolbar
*/
void
show
();
/**
* Exit prompt
*/
void
exit
();
private:
/**
* The main window parent.
*/
WMainWindow
*
m_mainWindow
;
/**
* The actual prompt edit.
*/
WQtCommandPrompt
*
m_prompt
;
};
#endif // WQTCOMMANDPROMPTTOOLBAR_H
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