1 /* 2 * Copyright (C) 2009, 2010, 2011, 2013 Nicolas Bonnefon and other contributors 3 * 4 * This file is part of glogg. 5 * 6 * glogg is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * glogg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef CONFIGURATION_H 21 #define CONFIGURATION_H 22 23 #include <QFont> 24 #include <QSettings> 25 26 #include "persistable.h" 27 28 // Type of regexp to use for searches 29 enum SearchRegexpType { 30 ExtendedRegexp, 31 Wildcard, 32 FixedString, 33 }; 34 35 // Configuration class containing everything in the "Settings" dialog 36 class Configuration : public Persistable { 37 public: 38 Configuration(); 39 40 // Accesses the main font used for display 41 QFont mainFont() const; 42 void setMainFont( QFont newFont ); 43 44 // Accesses the regexp types 45 SearchRegexpType mainRegexpType() const 46 { return mainRegexpType_; } 47 SearchRegexpType quickfindRegexpType() const 48 { return quickfindRegexpType_; } 49 bool isQuickfindIncremental() const 50 { return quickfindIncremental_; } 51 void setMainRegexpType( SearchRegexpType type ) 52 { mainRegexpType_ = type; } 53 void setQuickfindRegexpType( SearchRegexpType type ) 54 { quickfindRegexpType_ = type; } 55 void setQuickfindIncremental( bool is_incremental ) 56 { quickfindIncremental_ = is_incremental; } 57 58 // View settings 59 bool isOverviewVisible() const 60 { return overviewVisible_; } 61 void setOverviewVisible( bool isVisible ) 62 { overviewVisible_ = isVisible; } 63 bool mainLineNumbersVisible() const 64 { return lineNumbersVisibleInMain_; } 65 bool filteredLineNumbersVisible() const 66 { return lineNumbersVisibleInFiltered_; } 67 void setMainLineNumbersVisible( bool lineNumbersVisible ) 68 { lineNumbersVisibleInMain_ = lineNumbersVisible; } 69 void setFilteredLineNumbersVisible( bool lineNumbersVisible ) 70 { lineNumbersVisibleInFiltered_ = lineNumbersVisible; } 71 72 // Reads/writes the current config in the QSettings object passed 73 virtual void saveToStorage( QSettings& settings ) const; 74 virtual void retrieveFromStorage( QSettings& settings ); 75 76 private: 77 // Configuration settings 78 QFont mainFont_; 79 SearchRegexpType mainRegexpType_; 80 SearchRegexpType quickfindRegexpType_; 81 bool quickfindIncremental_; 82 83 // View settings 84 bool overviewVisible_; 85 bool lineNumbersVisibleInMain_; 86 bool lineNumbersVisibleInFiltered_; 87 }; 88 89 #endif 90