File indexing completed on 2024-10-06 04:26:03
0001 /* 0002 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0003 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 0009 #ifndef _K3B_WELCOME_WIDGET_H_ 0010 #define _K3B_WELCOME_WIDGET_H_ 0011 0012 #include <QList> 0013 #include <QMap> 0014 #include <QImage> 0015 #include <QPixmap> 0016 #include <QWidget> 0017 0018 class KConfigGroup; 0019 class QDragEnterEvent; 0020 class QDropEvent; 0021 class QMouseEvent; 0022 class QPaintEvent; 0023 class QResizeEvent; 0024 class QTextDocument; 0025 0026 0027 namespace K3b { 0028 0029 class FlatButton; 0030 class MainWindow; 0031 0032 class WelcomeWidget : public QWidget 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 explicit WelcomeWidget( MainWindow* mainWindow, QWidget* parent = 0 ); 0038 ~WelcomeWidget() override; 0039 0040 void loadConfig( const KConfigGroup& c ); 0041 void saveConfig( KConfigGroup c ); 0042 0043 int heightForWidth( int width ) const override; 0044 0045 void addAction( QAction* ); 0046 void removeAction( QAction* ); 0047 void removeButton( FlatButton* ); 0048 void rebuildGui(); 0049 void rebuildGui( const QList<QAction*>& ); 0050 0051 protected: 0052 bool event( QEvent* event ) override; 0053 void resizeEvent( QResizeEvent* ) override; 0054 void paintEvent( QPaintEvent* ) override; 0055 void dropEvent( QDropEvent* event ) override; 0056 void dragEnterEvent( QDragEnterEvent* event ) override; 0057 void mousePressEvent ( QMouseEvent* e ) override; 0058 0059 private Q_SLOTS: 0060 void slotThemeChanged(); 0061 void slotMoreActions(); 0062 0063 private: 0064 void repositionButtons(); 0065 void updateBgPix(); 0066 0067 MainWindow* m_mainWindow; 0068 0069 QTextDocument* m_header; 0070 QTextDocument* m_infoText; 0071 0072 QSize m_buttonSize; 0073 int m_cols; 0074 int m_rows; 0075 0076 QList<QAction*> m_actions; 0077 QList<FlatButton*> m_buttons; 0078 QMap<FlatButton*, QAction*> m_buttonMap; 0079 0080 FlatButton* m_buttonMore; 0081 0082 bool m_infoTextVisible; 0083 0084 QPixmap m_bgPixmap; 0085 QImage m_bgImage; 0086 }; 0087 0088 } // namespace K3b 0089 0090 #endif