libyui-qt-pkg
Loading...
Searching...
No Matches
YQPkgTextDialog.h
1/*
2 Copyright (c) 2000 - 2010 Novell, Inc.
3 Copyright (c) 2021 SUSE LLC
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) version 3.0 of the License. This library
9 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 License for more details. You should have received a copy of the GNU
13 Lesser General Public License along with this library; if not, write
14 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
15 Floor, Boston, MA 02110-1301 USA
16*/
17
18
19/*
20 File: YQPkgTextDialog.h
21 Author: Stefan Hundhammer <shundhammer.de>
22*/
23
24
25#ifndef YQPkgTextDialog_h
26#define YQPkgTextDialog_h
27
28#include "YQZypp.h"
29#include <QDialog>
30#include <QEvent>
31#include <zypp/ResObject.h>
32
33class QPushButton;
34class QTextBrowser;
35
36using std::string;
37
38
42class YQPkgTextDialog: public QDialog
43{
44 Q_OBJECT
45
46public:
47
57 YQPkgTextDialog( const QString & text,
58 QWidget * parent,
59 const QString & acceptButtonLabel,
60 const QString & rejectButtonLabel );
69 YQPkgTextDialog( const QString & text, QWidget * parent );
70
74 virtual ~YQPkgTextDialog();
75
80 virtual QSize sizeHint() const;
81
85 static void showText( QWidget * parent, const QString & text );
86
90 static void showText( QWidget * parent,
91 ZyppSel selectable,
92 const string & text );
93
98 static bool confirmText( QWidget * parent,
99 const QString & text,
100 const QString & acceptButtonLabel,
101 const QString & rejectButtonLabel );
102
107 static bool confirmText( QWidget * parent, const QString & text );
108 static bool confirmText( QWidget * parent, const char * text );
109
115 static bool confirmText( QWidget * parent,
116 ZyppSel selectable,
117 const string & text );
118
124 static QString htmlParagraphs( const string & rawText );
125
129 static QString htmlHeading( const QString & text );
130
135 static QString htmlHeading( ZyppSel selectable );
136
145 static QString htmlEscape( const QString & plainText );
146
147
148public slots:
149
153 void setText( const QString & text );
154 void setText( const string & text );
155
159 void setText( ZyppSel selectable,
160 const string & text );
161
162protected:
163
167 void buildDialog( const QString & text,
168 QWidget * parent,
169 const QString & acceptButtonLabel,
170 const QString & rejectButtonLabel = "" );
175 bool eventFilter( QObject * obj, QEvent * ev );
176
177
178 // Data members
179
180 QPushButton * _acceptButton;
181 QPushButton * _rejectButton;
182 QTextBrowser * _textBrowser;
183};
184
185
186
187#endif // ifndef YQPkgTextDialog_h
Dialog that shows a scrolled (HTML) text.
Definition YQPkgTextDialog.h:43
static QString htmlParagraphs(const string &rawText)
Definition YQPkgTextDialog.cc:281
static QString htmlHeading(const QString &text)
Definition YQPkgTextDialog.cc:299
void setText(const QString &text)
Definition YQPkgTextDialog.cc:188
void buildDialog(const QString &text, QWidget *parent, const QString &acceptButtonLabel, const QString &rejectButtonLabel="")
Definition YQPkgTextDialog.cc:77
static QString htmlEscape(const QString &plainText)
Definition YQPkgTextDialog.cc:266
static bool confirmText(QWidget *parent, const QString &text, const QString &acceptButtonLabel, const QString &rejectButtonLabel)
Definition YQPkgTextDialog.cc:224
virtual QSize sizeHint() const
Definition YQPkgTextDialog.cc:152
virtual ~YQPkgTextDialog()
Definition YQPkgTextDialog.cc:71
static void showText(QWidget *parent, const QString &text)
Definition YQPkgTextDialog.cc:207
bool eventFilter(QObject *obj, QEvent *ev)
Definition YQPkgTextDialog.cc:159