1 /* 2 * Copyright (c) 2014-2021, Ilya Kotov <forkotov02@ya.ru> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef PALETTEEDITDIALOG_H 30 #define PALETTEEDITDIALOG_H 31 32 #include <QDialog> 33 #include <QPalette> 34 35 class QTableWidgetItem; 36 class QStyle; 37 38 namespace Ui { 39 class PaletteEditDialog; 40 } 41 42 class PaletteEditDialog : public QDialog 43 { 44 Q_OBJECT 45 46 public: 47 explicit PaletteEditDialog(const QPalette &palette, QStyle *currentStyle, QWidget *parent = nullptr); 48 ~PaletteEditDialog(); 49 50 QPalette selectedPalette() const; 51 52 signals: 53 void paletteChanged(const QPalette &p); 54 55 private slots: 56 void on_tableWidget_itemClicked(QTableWidgetItem *item); 57 void on_resetPaletteButton_clicked(); 58 void on_buildInactiveButton_clicked(); 59 void on_buildDisabledButton_clicked(); 60 61 private: 62 void setPalette(const QPalette &palette); 63 void hideEvent(QHideEvent *) override; 64 Ui::PaletteEditDialog *m_ui; 65 QStyle *m_currentStyle; 66 }; 67 68 #endif // PALETTEEDITDIALOG_H 69