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