| 1 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
|
| 3 |
/**************************************************************************** |
| 4 |
* Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 5 |
* Copyright (c) 2023 FreeCAD Project Association * |
| 6 |
* * |
| 7 |
* This file is part of FreeCAD. * |
| 8 |
* * |
| 9 |
* FreeCAD is free software: you can redistribute it and/or modify it * |
| 10 |
* under the terms of the GNU Lesser General Public License as * |
| 11 |
* published by the Free Software Foundation, either version 2.1 of the * |
| 12 |
* License, or (at your option) any later version. * |
| 13 |
* * |
| 14 |
* FreeCAD is distributed in the hope that it will be useful, but * |
| 15 |
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 17 |
* Lesser General Public License for more details. * |
| 18 |
* * |
| 19 |
* You should have received a copy of the GNU Lesser General Public * |
| 20 |
* License along with FreeCAD. If not, see * |
| 21 |
* <https://www.gnu.org/licenses/>. * |
| 22 |
* * |
| 23 |
***************************************************************************/ |
| 24 |
|
| 25 |
|
| 26 |
#ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H |
| 27 |
#define GUI_DIALOG_DLGSETTINGSGENERAL_H |
| 28 |
|
| 29 |
#include <Gui/PropertyPage.h> |
| 30 |
#include <memory> |
| 31 |
#include <string> |
| 32 |
|
| 33 |
class QTabWidget; |
| 34 |
|
| 35 |
namespace Gui |
| 36 |
{ |
| 37 |
namespace Dialog |
| 38 |
{ |
| 39 |
class Ui_DlgSettingsGeneral; |
| 40 |
class DlgCreateNewPreferencePackImp; |
| 41 |
class DlgPreferencePackManagementImp; |
| 42 |
class DlgRevertToBackupConfigImp; |
| 43 |
|
| 44 |
/** This class implements the settings for the application. |
| 45 |
* You can change window style, size of pixmaps, size of recent file list and so on |
| 46 |
* \author Werner Mayer |
| 47 |
*/ |
| 48 |
class DlgSettingsGeneral: public PreferencePage |
| 49 |
{ |
| 50 |
Q_OBJECT |
| 51 |
|
| 52 |
public: |
| 53 |
explicit DlgSettingsGeneral(QWidget* parent = nullptr); |
| 54 |
~DlgSettingsGeneral() override; |
| 55 |
|
| 56 |
void saveSettings() override; |
| 57 |
void loadSettings() override; |
| 58 |
void resetSettingsToDefaults() override; |
| 59 |
|
| 60 |
void saveThemes(); |
| 61 |
void loadThemes(); |
| 62 |
|
| 63 |
static void attachObserver(); |
| 64 |
|
| 65 |
protected: |
| 66 |
void changeEvent(QEvent* event) override; |
| 67 |
|
| 68 |
protected Q_SLOTS: |
| 69 |
void onLoadPreferencePackClicked(const std::string& packName); |
| 70 |
void recreatePreferencePackMenu(); |
| 71 |
void newPreferencePackDialogAccepted(); |
| 72 |
void onManagePreferencePacksClicked(); |
| 73 |
void onImportConfigClicked(); |
| 74 |
void onThemeChanged(int index); |
| 75 |
void onLinkActivated(const QString& link); |
| 76 |
|
| 77 |
public Q_SLOTS: |
| 78 |
void onUnitSystemIndexChanged(int index); |
| 79 |
|
| 80 |
private: |
| 81 |
void saveUnitSystemSettings(); |
| 82 |
void saveDockWindowVisibility(); |
| 83 |
void loadDockWindowVisibility(); |
| 84 |
void setRecentFileSize(); |
| 85 |
void saveAsNewPreferencePack(); |
| 86 |
void revertToSavedConfig(); |
| 87 |
bool setLanguage(); // Returns true if language has been changed |
| 88 |
void setNumberLocale(bool force = false); |
| 89 |
void setDecimalPointConversion(bool on); |
| 90 |
void retranslateUnits(); |
| 91 |
int getCurrentIconSize() const; |
| 92 |
void addIconSizes(int current); |
| 93 |
void translateIconSizes(); |
| 94 |
|
| 95 |
private: |
| 96 |
int localeIndex; |
| 97 |
bool themeChanged; |
| 98 |
std::unique_ptr<Ui_DlgSettingsGeneral> ui; |
| 99 |
std::unique_ptr<DlgCreateNewPreferencePackImp> newPreferencePackDialog; |
| 100 |
std::unique_ptr<DlgPreferencePackManagementImp> preferencePackManagementDialog; |
| 101 |
std::unique_ptr<DlgRevertToBackupConfigImp> revertToBackupConfigDialog; |
| 102 |
}; |
| 103 |
|
| 104 |
} // namespace Dialog |
| 105 |
} // namespace Gui |
| 106 |
|
| 107 |
#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H |