OpenStructure
Loading...
Searching...
No Matches
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-2020 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>
25
26#include <QListView>
27#include <QMessageBox>
28#include <QStandardItemModel>
29
30/*
31 Author: Stefan Scheuber
32*/
33
34namespace ost { namespace gui {
35
36// the display window for Log Messages
38{
39 Q_OBJECT;
40public:
41 MessageWidget(QWidget* parent=NULL);
43
44public:
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
57
58signals:
59 void MessageCountChanged(QMessageBox::Icon);
60 void AllCleared();
61
62public slots:
63 void ErrorOutput(unsigned int id,const QString& output);
64 void Clear();
66 void Update();
67
68private slots:
69 void ContextMenuRequested(const QPoint& pos);
70
71private:
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
virtual bool Save(const QString &prefix)
void MessageCountChanged(QMessageBox::Icon)
virtual int GetMessagesCount(QMessageBox::Icon icon=QMessageBox::NoIcon)
QPixmap GetIcon(QMessageBox::Icon icon, QWidget *widget)
ActionList GetActions()
get Widget specific actions
virtual void LogMessage(const QString &message, QIcon icon)
virtual void LogMessage(QStandardItem *item)
MessageWidget(QWidget *parent=NULL)
virtual int GetTotalMessagesCount()
virtual void LogMessage(const QString &message, QMessageBox::Icon icon=QMessageBox::Information)
virtual bool Restore(const QString &prefix)
void ErrorOutput(unsigned int id, const QString &output)
Base class for widgets.
Definition widget.hh:40
#define DLLEXPORT_OST_GUI
QList< QAction * > ActionList
Definition widget.hh:33
Definition base.dox:1