client: Optionally ensure backlog on buffer show
[quassel.git] / src / client / backlogsettings.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-2020 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #include "backlogsettings.h"
22
23 BacklogSettings::BacklogSettings()
24     : ClientSettings("Backlog")
25 {}
26
27 int BacklogSettings::requesterType() const
28 {
29     return localValue("RequesterType", BacklogRequester::PerBufferUnread).toInt();
30 }
31
32 void BacklogSettings::setRequesterType(int requesterType)
33 {
34     setLocalValue("RequesterType", requesterType);
35 }
36
37 int BacklogSettings::dynamicBacklogAmount() const
38 {
39     return localValue("DynamicBacklogAmount", 200).toInt();
40 }
41
42 void BacklogSettings::setDynamicBacklogAmount(int amount)
43 {
44     return setLocalValue("DynamicBacklogAmount", amount);
45 }
46
47 bool BacklogSettings::ensureBacklogOnBufferShow() const
48 {
49     // This settings key is also used within BufferWidget::BufferWidget()
50     return localValue("EnsureBacklogOnBufferShow", true).toBool();
51 }
52
53 void BacklogSettings::setEnsureBacklogOnBufferShow(bool enabled)
54 {
55     return setLocalValue("EnsureBacklogOnBufferShow", enabled);
56 }
57
58 int BacklogSettings::fixedBacklogAmount() const
59 {
60     return localValue("FixedBacklogAmount", 500).toInt();
61 }
62
63 void BacklogSettings::setFixedBacklogAmount(int amount)
64 {
65     return setLocalValue("FixedBacklogAmount", amount);
66 }
67
68 int BacklogSettings::globalUnreadBacklogLimit() const
69 {
70     return localValue("GlobalUnreadBacklogLimit", 5000).toInt();
71 }
72
73 void BacklogSettings::setGlobalUnreadBacklogLimit(int limit)
74 {
75     return setLocalValue("GlobalUnreadBacklogLimit", limit);
76 }
77
78 int BacklogSettings::globalUnreadBacklogAdditional() const
79 {
80     return localValue("GlobalUnreadBacklogAdditional", 100).toInt();
81 }
82
83 void BacklogSettings::setGlobalUnreadBacklogAdditional(int additional)
84 {
85     return setLocalValue("GlobalUnreadBacklogAdditional", additional);
86 }
87
88 int BacklogSettings::perBufferUnreadBacklogLimit() const
89 {
90     return localValue("PerBufferUnreadBacklogLimit", 200).toInt();
91 }
92
93 void BacklogSettings::setPerBufferUnreadBacklogLimit(int limit)
94 {
95     return setLocalValue("PerBufferUnreadBacklogLimit", limit);
96 }
97
98 int BacklogSettings::perBufferUnreadBacklogAdditional() const
99 {
100     return localValue("PerBufferUnreadBacklogAdditional", 50).toInt();
101 }
102
103 void BacklogSettings::setPerBufferUnreadBacklogAdditional(int additional)
104 {
105     return setLocalValue("PerBufferUnreadBacklogAdditional", additional);
106 }