OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
message_widget.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_MESSAGES_MESSAGE_WIDGET_HH
20 #define OST_GUI_MESSAGES_MESSAGE_WIDGET_HH
21 
22 
23 #include <ost/gui/widget.hh>
24 #include <ost/gui/module_config.hh>
25 
26 #include <QListView>
27 #include <QMessageBox>
28 #include <QStandardItemModel>
29 
30 /*
31  Author: Stefan Scheuber
32 */
33 
34 namespace ost { namespace gui {
35 
36 // the display window for Log Messages
38 {
39  Q_OBJECT;
40 public:
41  MessageWidget(QWidget* parent=NULL);
42  ~MessageWidget();
43 
44 public:
45  virtual void LogMessage(const QString& message, QMessageBox::Icon icon=QMessageBox::Information);
46  virtual void LogMessage(QStandardItem* item);
47  virtual void LogMessage(const QString& message, QIcon icon);
48 
49  virtual int GetMessagesCount(QMessageBox::Icon icon=QMessageBox::NoIcon);
50  virtual int GetTotalMessagesCount();
51  virtual bool Save(const QString& prefix) { return true; }
52  virtual bool Restore(const QString& prefix) { return true; }
53 
54  QPixmap GetIcon(QMessageBox::Icon icon, QWidget* widget);
55 
56  ActionList GetActions();
57 
58 signals:
59  void MessageCountChanged(QMessageBox::Icon);
60  void AllCleared();
61 
62 public slots:
63  void ErrorOutput(unsigned int id,const QString& output);
64  void Clear();
65  void RemoveSelected();
66  void Update();
67 
68 private slots:
69  void ContextMenuRequested(const QPoint& pos);
70 
71 private:
72  void Increase(QMessageBox::Icon icon);
73  void Decrease(QMessageBox::Icon icon);
74 
75  QStandardItemModel* model_;
76  QListView* view_;
77 
78  ActionList actions_;
79  QMap<int,int> count_map_;
80 };
81 
82 }} // ns
83 
84 #endif
#define DLLEXPORT_OST_GUI
virtual bool Save(const QString &prefix)
QList< QAction * > ActionList
Definition: widget.hh:33
virtual bool Restore(const QString &prefix)
Base class for widgets.
Definition: widget.hh:40
ImageStateConstModIPAlgorithm< ClearFnc > Clear
Definition: clear.hh:47