1bb02e0acSNicolas Bonnefon /* 280bca0a3SNicolas 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 5880bca0a3SNicolas Bonnefon // "Advanced" settings 5980bca0a3SNicolas Bonnefon bool pollingEnabled() const 6080bca0a3SNicolas Bonnefon { return pollingEnabled_; } 6180bca0a3SNicolas Bonnefon void setPollingEnabled( bool enabled ) 6280bca0a3SNicolas Bonnefon { pollingEnabled_ = enabled; } 6380bca0a3SNicolas Bonnefon uint32_t pollIntervalMs() const 6480bca0a3SNicolas Bonnefon { return pollIntervalMs_; } 6580bca0a3SNicolas Bonnefon void setPollIntervalMs( uint32_t interval ) 6680bca0a3SNicolas Bonnefon { pollIntervalMs_ = interval; } 67*3b104697SAnton Filimonov bool loadLastSession() const 68*3b104697SAnton Filimonov { return loadLastSession_; } 69*3b104697SAnton Filimonov void setLoadLastSession( bool enabled ) 70*3b104697SAnton Filimonov { loadLastSession_ = enabled; } 7180bca0a3SNicolas Bonnefon 72bb02e0acSNicolas Bonnefon // View settings 73bb02e0acSNicolas Bonnefon bool isOverviewVisible() const 74bb02e0acSNicolas Bonnefon { return overviewVisible_; } 75bb02e0acSNicolas Bonnefon void setOverviewVisible( bool isVisible ) 76bb02e0acSNicolas Bonnefon { overviewVisible_ = isVisible; } 77bb02e0acSNicolas Bonnefon bool mainLineNumbersVisible() const 78bb02e0acSNicolas Bonnefon { return lineNumbersVisibleInMain_; } 79bb02e0acSNicolas Bonnefon bool filteredLineNumbersVisible() const 80bb02e0acSNicolas Bonnefon { return lineNumbersVisibleInFiltered_; } 81bb02e0acSNicolas Bonnefon void setMainLineNumbersVisible( bool lineNumbersVisible ) 82bb02e0acSNicolas Bonnefon { lineNumbersVisibleInMain_ = lineNumbersVisible; } 83bb02e0acSNicolas Bonnefon void setFilteredLineNumbersVisible( bool lineNumbersVisible ) 84bb02e0acSNicolas Bonnefon { lineNumbersVisibleInFiltered_ = lineNumbersVisible; } 85bb02e0acSNicolas Bonnefon 86f688be2eSNicolas Bonnefon // Default settings for new views 87f688be2eSNicolas Bonnefon bool isSearchAutoRefreshDefault() const 88f688be2eSNicolas Bonnefon { return searchAutoRefresh_; } 89f688be2eSNicolas Bonnefon void setSearchAutoRefreshDefault( bool auto_refresh ) 90f688be2eSNicolas Bonnefon { searchAutoRefresh_ = auto_refresh; } 91f688be2eSNicolas Bonnefon bool isSearchIgnoreCaseDefault() const 92f688be2eSNicolas Bonnefon { return searchIgnoreCase_; } 93f688be2eSNicolas Bonnefon void setSearchIgnoreCaseDefault( bool ignore_case ) 94f688be2eSNicolas Bonnefon { searchIgnoreCase_ = ignore_case; } 95f688be2eSNicolas Bonnefon 96bb02e0acSNicolas Bonnefon // Reads/writes the current config in the QSettings object passed 97bb02e0acSNicolas Bonnefon virtual void saveToStorage( QSettings& settings ) const; 98bb02e0acSNicolas Bonnefon virtual void retrieveFromStorage( QSettings& settings ); 99bb02e0acSNicolas Bonnefon 100bb02e0acSNicolas Bonnefon private: 101bb02e0acSNicolas Bonnefon // Configuration settings 102bb02e0acSNicolas Bonnefon QFont mainFont_; 103bb02e0acSNicolas Bonnefon SearchRegexpType mainRegexpType_; 104bb02e0acSNicolas Bonnefon SearchRegexpType quickfindRegexpType_; 105bb02e0acSNicolas Bonnefon bool quickfindIncremental_; 10680bca0a3SNicolas Bonnefon bool pollingEnabled_; 10780bca0a3SNicolas Bonnefon uint32_t pollIntervalMs_; 108*3b104697SAnton Filimonov bool loadLastSession_; 109bb02e0acSNicolas Bonnefon 110bb02e0acSNicolas Bonnefon // View settings 111bb02e0acSNicolas Bonnefon bool overviewVisible_; 112bb02e0acSNicolas Bonnefon bool lineNumbersVisibleInMain_; 113bb02e0acSNicolas Bonnefon bool lineNumbersVisibleInFiltered_; 114f688be2eSNicolas Bonnefon 115f688be2eSNicolas Bonnefon // Default settings for new views 116f688be2eSNicolas Bonnefon bool searchAutoRefresh_; 117f688be2eSNicolas Bonnefon bool searchIgnoreCase_; 118bb02e0acSNicolas Bonnefon }; 119bb02e0acSNicolas Bonnefon 120bb02e0acSNicolas Bonnefon #endif 121