Warning, file /utilities/basket/src/variouswidgets.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /** 0002 * SPDX-FileCopyrightText: (C) 2003 Sébastien Laoût <slaout@linux62.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef VARIOUSWIDGETS_H 0008 #define VARIOUSWIDGETS_H 0009 0010 #include <QDialog> 0011 #include <QWidget> 0012 0013 #include <KComboBox> 0014 #include <KUrlLabel> 0015 0016 class QLineEdit; 0017 class QListWidgetItem; 0018 class QResizeEvent; 0019 class QString; 0020 class QKeyEvent; 0021 0022 /** A widget to select a command to run, 0023 * with a QLineEdit and a QPushButton. 0024 * @author Sébastien Laoût 0025 */ 0026 class RunCommandRequester : public QWidget 0027 { 0028 Q_OBJECT 0029 public: 0030 RunCommandRequester(const QString &runCommand, const QString &message, QWidget *parent = nullptr); 0031 ~RunCommandRequester() override; 0032 QString runCommand(); 0033 void setRunCommand(const QString &runCommand); 0034 QLineEdit *lineEdit() 0035 { 0036 return m_runCommand; 0037 } 0038 private Q_SLOTS: 0039 void slotSelCommand(); 0040 0041 private: 0042 QLineEdit *m_runCommand; 0043 QString m_message; 0044 }; 0045 0046 /** KComboBox to ask icon size 0047 * @author Sébastien Laoût 0048 */ 0049 class IconSizeCombo : public KComboBox 0050 { 0051 Q_OBJECT 0052 public: 0053 explicit IconSizeCombo(QWidget *parent = nullptr); 0054 ~IconSizeCombo() override; 0055 int iconSize(); 0056 void setSize(int size); 0057 }; 0058 0059 /** A window that the user resize to graphically choose a new image size 0060 * TODO: Create a SizePushButton or even SizeWidget 0061 * @author Sébastien Laoût 0062 */ 0063 class ViewSizeDialog : public QDialog 0064 { 0065 Q_OBJECT 0066 public: 0067 ViewSizeDialog(QWidget *parent, int w, int h); 0068 ~ViewSizeDialog() override; 0069 0070 private: 0071 void resizeEvent(QResizeEvent *) override; 0072 QWidget *m_sizeGrip; 0073 }; 0074 0075 /** A label displaying a link that, once clicked, offer a What's This messageBox to help users. 0076 * @author Sébastien Laoût 0077 */ 0078 class HelpLabel : public KUrlLabel 0079 { 0080 Q_OBJECT 0081 public: 0082 HelpLabel(const QString &text, const QString &message, QWidget *parent); 0083 ~HelpLabel() override; 0084 QString message() 0085 { 0086 return m_message; 0087 } 0088 public Q_SLOTS: 0089 void setMessage(const QString &message) 0090 { 0091 m_message = message; 0092 } 0093 void display(); 0094 0095 private: 0096 QString m_message; 0097 }; 0098 0099 /** A dialog to choose the size of an icon. 0100 * @author Sébastien Laoût 0101 */ 0102 class IconSizeDialog : public QDialog 0103 { 0104 Q_OBJECT 0105 public: 0106 IconSizeDialog(const QString &caption, const QString &message, const QString &icon, int iconSize, QWidget *parent); 0107 ~IconSizeDialog() override; 0108 int iconSize() 0109 { 0110 return m_iconSize; 0111 } /// << @return the chosen icon size (16, 32, ...) or -1 if canceled! 0112 protected Q_SLOTS: 0113 void slotCancel(); 0114 void slotSelectionChanged(); 0115 void choose(QListWidgetItem *); 0116 0117 private: 0118 QListWidgetItem *m_size16; 0119 QListWidgetItem *m_size22; 0120 QListWidgetItem *m_size32; 0121 QListWidgetItem *m_size48; 0122 QListWidgetItem *m_size64; 0123 QListWidgetItem *m_size128; 0124 int m_iconSize; 0125 QPushButton *okButton; 0126 }; 0127 0128 /** 0129 * A missing class from Frameworks (and Qt): a combobox to select a font size! 0130 */ 0131 class FontSizeCombo : public KComboBox 0132 { 0133 Q_OBJECT 0134 public: 0135 FontSizeCombo(bool rw, bool withDefault, QWidget *parent = nullptr); 0136 ~FontSizeCombo() override; 0137 void setFontSize(qreal size); 0138 qreal fontSize(); 0139 0140 protected: 0141 void keyPressEvent(QKeyEvent *event) override; 0142 Q_SIGNALS: 0143 void sizeChanged(qreal size); 0144 void escapePressed(); 0145 void returnPressed2(); 0146 private Q_SLOTS: 0147 void textChangedInCombo(const QString &text); 0148 0149 private: 0150 bool m_withDefault; 0151 }; 0152 0153 #endif // VARIOUSWIDGETS_H