1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
#ifndef BaseConfigurationDialog_h
#define BaseConfigurationDialog_h
/******************************************************************************
*
* Copyright (C) 2002 Hugo PEREIRA <mailto: hugo.pereira@free.fr>
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* Any WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
*******************************************************************************/
#include "OptionWidget.h"
#include "OptionWidgetList.h"
#include "TabbedDialog.h"
#include "XmlOptions.h"
#include <QLayout>
class CustomDialog;
namespace Private
{
class IconThemeDialog;
};
//* configuration dialog
class BaseConfigurationDialog: public TabbedDialog, public OptionWidgetList
{
Q_OBJECT
public:
//* flag bitset for the Base configuration
enum Flag
{
None = 0,
Base = 1<<0,
List = 1<<2,
TextEdition = 1<<3,
TabEmulation = 1<<4,
ParagraphHighlight = 1<<5,
TextEditionFlags = 1<<6,
BoxSelection = 1<<7,
Default = Base|List,
AllTextEdition = TabEmulation|ParagraphHighlight|TextEditionFlags
};
Q_DECLARE_FLAGS( Flags, Flag );
//* constructor
explicit BaseConfigurationDialog( QWidget* = nullptr, Flags = Flag::None );
// read
using OptionWidgetList::read;
void read()
{
OptionWidgetList::read( XmlOptions::get() );
_checkModified();
}
//* adds configuration box for base options used in all appications
QWidget* baseConfiguration( QWidget* = nullptr, Flags = Flag::Default );
//* list configuration box
QWidget* listConfiguration( QWidget* = nullptr );
//* TextEdit configuration box
QWidget* textEditConfiguration( QWidget* = nullptr, Flags = Flag::AllTextEdition );
Q_SIGNALS:
//* modified
void modified();
//* apply button pressed
void apply();
//* ok button pressed
void ok();
//* canceled button pressed
void cancel();
//* reset button pressed
void reset();
//* restore defaults button pressed
void restoreDefaults();
//* emitted when configuration is changed
void configurationChanged();
protected Q_SLOTS:
//* show pixmap path dialog
void _editPixmapPathList();
//* show icon path dialog
void _editIconTheme();
//* check options changed
bool _checkModified();
//* update configuration
void _apply();
//* save configuration from options
void _save();
//* restore configuration
void _cancel();
//* reset
void _reset();
//* restore default options
void _restoreDefaults();
protected:
//* find modification
bool _findModification( const Options&, const Options& ) const;
private:
//* pointer to original options set
/**
it is needed to keep track of the changes
so that initial set is restored when pressing the cancel button
*/
const Options backupOptions_;
//* pixmap path dialog
CustomDialog* pixmapPathDialog_ = nullptr;
//* icon theme dialog
Private::IconThemeDialog* iconThemeDialog_ = nullptr;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( BaseConfigurationDialog::Flags )
#endif
|