Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
8de9fa35
Commit
8de9fa35
authored
Dec 13, 2012
by
Sebastian Eichelbaum
Browse files
[ADD
#227
] added message dock. Not yet working.
parent
4413f222
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
163 additions
and
11 deletions
+163
-11
src/qt4gui/qt4/WMainWindow.cpp
src/qt4gui/qt4/WMainWindow.cpp
+18
-4
src/qt4gui/qt4/WMainWindow.h
src/qt4gui/qt4/WMainWindow.h
+20
-0
src/qt4gui/qt4/WQtMessageDock.cpp
src/qt4gui/qt4/WQtMessageDock.cpp
+46
-0
src/qt4gui/qt4/WQtMessageDock.h
src/qt4gui/qt4/WQtMessageDock.h
+57
-0
src/qt4gui/qt4/guiElements/WQtMessagePopup.cpp
src/qt4gui/qt4/guiElements/WQtMessagePopup.cpp
+16
-7
src/qt4gui/qt4/guiElements/WQtMessagePopup.h
src/qt4gui/qt4/guiElements/WQtMessagePopup.h
+6
-0
No files found.
src/qt4gui/qt4/WMainWindow.cpp
View file @
8de9fa35
...
...
@@ -245,6 +245,10 @@ void WMainWindow::setupGUI()
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_controlPanel
->
getColormapperDock
()
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_controlPanel
->
getRoiDock
()
);
// the message dock:
m_messageDock
=
new
WQtMessageDock
(
"Messages"
,
this
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_messageDock
);
// tabify those panels by default
if
(
m_networkEditor
)
{
...
...
@@ -252,6 +256,7 @@ void WMainWindow::setupGUI()
}
tabifyDockWidget
(
m_controlPanel
->
getModuleDock
(),
m_controlPanel
->
getColormapperDock
()
);
tabifyDockWidget
(
m_controlPanel
->
getColormapperDock
(),
m_controlPanel
->
getRoiDock
()
);
tabifyDockWidget
(
m_controlPanel
->
getRoiDock
(),
m_messageDock
);
m_glDock
=
new
QMainWindow
();
m_glDock
->
setObjectName
(
"GLDock"
);
...
...
@@ -939,7 +944,7 @@ bool WMainWindow::event( QEvent* event )
{
QString
title
=
"Module
\"
"
+
QString
::
fromStdString
(
e1
->
getModule
()
->
getName
()
)
+
"
\"
caused a problem."
;
QString
message
=
QString
::
fromStdString
(
e1
->
getMessage
()
);
reportError
(
m_networkEditor
->
getView
()
,
title
,
message
);
reportError
(
this
,
title
,
message
);
}
}
...
...
@@ -997,7 +1002,7 @@ bool WMainWindow::event( QEvent* event )
if
(
curWarnCount
&&
curErrCount
)
// Errors and warnings
{
reportError
(
m_networkEditor
->
getView
()
,
"There where errors and warnings during load."
,
reportError
(
this
,
"There where errors and warnings during load."
,
"Errors occurred during load of
\"
"
+
QString
::
fromStdString
(
e1
->
getFilename
()
)
+
"
\"
. "
"The loader tried to apply as much as possible, ignoring the erroneous data. The first errors where:"
+
QString
::
fromStdString
(
errors
)
+
...
...
@@ -1007,14 +1012,14 @@ bool WMainWindow::event( QEvent* event )
}
else
if
(
curWarnCount
&&
!
curErrCount
)
// only warnings
{
reportWarning
(
m_networkEditor
->
getView
()
,
"There where warnings during load."
,
reportWarning
(
this
,
"There where warnings during load."
,
"Warnings occurred during load of
\"
"
+
QString
::
fromStdString
(
e1
->
getFilename
()
)
+
"
\"
. "
+
QString
::
fromStdString
(
warnings
)
);
}
else
if
(
!
curWarnCount
&&
curErrCount
)
// only errors
{
reportError
(
m_networkEditor
->
getView
()
,
"There where errors during load."
,
reportError
(
this
,
"There where errors during load."
,
"Errors occurred during load of
\"
"
+
QString
::
fromStdString
(
e1
->
getFilename
()
)
+
"
\"
. "
"The loader tried to apply as much as possible, ignoring the erroneous data. The first errors where:"
+
QString
::
fromStdString
(
errors
)
...
...
@@ -1335,3 +1340,12 @@ void WMainWindow::addGlobalMenu( QWidget* widget )
widget
->
addAction
(
m_quitAction
);
}
const
WQtMessageDock
*
WMainWindow
::
getMessageDock
()
const
{
return
m_messageDock
;
}
WQtMessageDock
*
WMainWindow
::
getMessageDock
()
{
return
m_messageDock
;
}
src/qt4gui/qt4/WMainWindow.h
View file @
8de9fa35
...
...
@@ -41,6 +41,7 @@
#include "WQtGLWidget.h"
#include "WSettingAction.h"
#include "networkEditor/WQtNetworkEditor.h"
#include "WQtMessageDock.h"
// forward declarations
class
QMenuBar
;
...
...
@@ -221,6 +222,20 @@ public:
* \param message the message
*/
void
reportInfo
(
QWidget
*
parent
,
QString
title
,
QString
message
);
/**
* Return the message dock widget
*
* \return the message dock
*/
const
WQtMessageDock
*
getMessageDock
()
const
;
/**
* Return the message dock widget
*
* \return the message dock
*/
WQtMessageDock
*
getMessageDock
();
protected:
/**
* Setup the GUI by handling special modules. NavSlices for example setup several toolbar buttons.
...
...
@@ -374,6 +389,11 @@ private:
WQtToolBar
*
m_permanentToolBar
;
//!< The permanent toolbar of the main window.
/**
* Message and log window
*/
WQtMessageDock
*
m_messageDock
;
// several menu items
QAction
*
m_newAction
;
//!< the new project button
QAction
*
m_loadButton
;
//!< the load button
...
...
src/qt4gui/qt4/WQtMessageDock.cpp
0 → 100644
View file @
8de9fa35
//---------------------------------------------------------------------------
//
// 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/QDockWidget>
#include <QtGui/QVBoxLayout>
#include "WQt4Gui.h"
#include "WQtMessageDock.h"
#include "WQtMessageDock.moc"
WQtMessageDock
::
WQtMessageDock
(
QString
dockTitle
,
QWidget
*
parent
)
:
QDockWidget
(
dockTitle
,
parent
)
{
setObjectName
(
"MessageDock:"
+
dockTitle
);
setAllowedAreas
(
Qt
::
AllDockWidgetAreas
);
setFeatures
(
QDockWidget
::
AllDockWidgetFeatures
);
}
WQtMessageDock
::~
WQtMessageDock
()
{
// cleanup
}
src/qt4gui/qt4/WQtMessageDock.h
0 → 100644
View file @
8de9fa35
//---------------------------------------------------------------------------
//
// 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 WQTMESSAGEDOCK_H
#define WQTMESSAGEDOCK_H
#include <QtGui/QDockWidget>
#include <QtGui/QVBoxLayout>
/**
* Dock widget for showing messages and logs
*/
class
WQtMessageDock
:
public
QDockWidget
{
Q_OBJECT
public:
/**
* Constructor
*
* \param dockTitle the title
* \param parent parent widget
*/
WQtMessageDock
(
QString
dockTitle
,
QWidget
*
parent
);
/**
* Destructor.
*/
virtual
~
WQtMessageDock
();
protected:
private:
};
#endif // WQTMESSAGEDOCK_H
src/qt4gui/qt4/guiElements/WQtMessagePopup.cpp
View file @
8de9fa35
...
...
@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <algorithm>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
...
...
@@ -43,6 +45,7 @@
#define OUTERMARGIN 10
#define BORDERWIDTH 2
#define CONTENTHEIGHT 16
#define MAXWIDTH 600
WQtMessagePopup
::
WQtMessagePopup
(
QWidget
*
parent
,
const
QString
&
title
,
const
QString
&
message
,
MessageType
type
)
:
QDialog
(
parent
,
Qt
::
Popup
|
Qt
::
FramelessWindowHint
),
...
...
@@ -54,19 +57,13 @@ WQtMessagePopup::WQtMessagePopup( QWidget* parent, const QString& title, const Q
setWindowModality
(
Qt
::
NonModal
);
setModal
(
false
);
// get top left corner
QPoint
p
=
parent
->
mapToGlobal
(
QPoint
(
0
,
0
)
);
// determine a width and height for the popup
unsigned
int
w
=
parent
->
width
()
-
(
2
.0
*
OUTERMARGIN
);
unsigned
int
w
=
std
::
min
(
parent
->
width
()
-
(
2
*
OUTERMARGIN
),
MAXWIDTH
);
unsigned
int
h
=
CONTENTHEIGHT
+
BORDERWIDTH
+
BORDERWIDTH
;
// change size of popup
resize
(
w
,
h
);
// set position, include margins
move
(
p
.
x
()
+
OUTERMARGIN
,
p
.
y
()
+
OUTERMARGIN
);
QString
borderColor
=
"red"
;
QString
titlePrefix
=
""
;
...
...
@@ -169,6 +166,18 @@ WQtMessagePopup::WQtMessagePopup( QWidget* parent, const QString& title, const Q
detailsBtn
->
setObjectName
(
"popupDialogButton"
);
}
void
WQtMessagePopup
::
showEvent
(
QShowEvent
*
event
)
{
// move widget to correct position
// get top left corner
QPoint
p
=
parentWidget
()
->
mapToGlobal
(
QPoint
(
parentWidget
()
->
width
()
/
2
,
parentWidget
()
->
height
()
)
);
// set position, include margins
move
(
p
.
x
()
-
width
()
/
2
-
OUTERMARGIN
/
2
,
p
.
y
()
-
height
()
-
OUTERMARGIN
);
QDialog
::
showEvent
(
event
);
}
WQtMessagePopup
::~
WQtMessagePopup
()
{
// cleanup
...
...
src/qt4gui/qt4/guiElements/WQtMessagePopup.h
View file @
8de9fa35
...
...
@@ -68,6 +68,12 @@ public slots:
*/
void
showMessage
();
protected:
/**
* On show. Called when opening the widget.
*
* \param event
*/
virtual
void
showEvent
(
QShowEvent
*
event
);
private:
/**
* Title Text
...
...
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