1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
// KPPPLoad - a PPP load monitor
// Copyright (C) 1998 Sean Vyain, svyain@mail.tds.net
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <kapp.h>
#include "Options.h"
Options::Options()
{
_config = KApplication::getKApplication()->getConfig();
}
void Options::sync()
{
_config->sync();
}
bool Options::getShowTxRate()
{
return _config->readNumEntry( "showTxRate", TRUE );
}
bool Options::getShowRxRate()
{
return _config->readNumEntry( "showRxRate", TRUE );
}
bool Options::getShowTxTotal()
{
return _config->readNumEntry( "showTxTotal", TRUE );
}
bool Options::getShowRxTotal()
{
return _config->readNumEntry( "showRxTotal", TRUE );
}
int Options::getStatsInterval()
{
return _config->readNumEntry( "statsInterval", 5 );
}
int Options::getPeriodicInterval()
{
return _config->readNumEntry( "periodicInterval", 0 );
}
const QString Options::getPPPCommand()
{
return _config->readEntry( "pppCommand", 0 );
}
const QString Options::getPeriodicCommand()
{
return _config->readEntry( "periodicCommand", 0 );
}
int Options::getLinkNumber()
{
return _config->readNumEntry( "linkNumber", 0 );
}
int Options::getRetryInterval()
{
return _config->readNumEntry( "retryInterval", 60 );
}
int Options::getRateDivider()
{
return _config->readNumEntry( "rateDivider", 1024 );
}
int Options::getStatsPeriod()
{
return _config->readNumEntry( "statsPeriod", 60 );
}
QColor Options::getRxColor()
{
return _config->readColorEntry( "rxColor", &QColor( "red" ) );
}
QColor Options::getTxColor()
{
return _config->readColorEntry( "txColor", &QColor( "darkblue" ) );
}
void Options::setShowTxRate( bool b )
{
if ( b != getShowTxRate() ) {
_config->writeEntry( "showTxRate", b );
emit sigShowTxRate();
}
}
void Options::setShowRxRate( bool b )
{
if ( b != getShowRxRate() ) {
_config->writeEntry( "showRxRate", b );
emit sigShowRxRate();
}
}
void Options::setShowTxTotal( bool b )
{
if ( b != getShowTxTotal() ) {
_config->writeEntry( "showTxTotal", b );
emit sigShowTxTotal();
}
}
void Options::setShowRxTotal( bool b )
{
if ( b != getShowRxTotal() ) {
_config->writeEntry( "showRxTotal", b );
emit sigShowRxTotal();
}
}
void Options::setStatsInterval( int i )
{
if ( i != getStatsInterval() ) {
_config->writeEntry( "statsInterval", i );
emit sigStatsInterval();
}
}
void Options::setPeriodicInterval( int i )
{
if ( i != getPeriodicInterval() ) {
_config->writeEntry( "periodicInterval", i );
emit sigPeriodicInterval();
}
}
void Options::setPPPCommand( const char* str )
{
if ( getPPPCommand() != str ) {
_config->writeEntry( "pppCommand", str );
emit sigPPPCommand();
}
}
void Options::setPeriodicCommand( const char* str )
{
if ( getPeriodicCommand() != str ) {
_config->writeEntry( "periodicCommand", str );
emit sigPeriodicCommand();
}
}
void Options::setLinkNumber( int i )
{
if ( i != getLinkNumber() ) {
_config->writeEntry( "linkNumber", i );
emit sigLinkNumber();
}
}
void Options::setRetryInterval( int i )
{
if ( i != getRetryInterval() ) {
_config->writeEntry( "retryInterval", i );
emit sigRetryInterval();
}
}
void Options::setRateDivider( int i )
{
if ( i != getRateDivider() ) {
_config->writeEntry( "rateDivider", i );
emit sigRateDivider();
}
}
void Options::setStatsPeriod( int i )
{
if ( i != getStatsPeriod() ) {
_config->writeEntry( "statsPeriod", i );
emit sigStatsPeriod();
}
}
void Options::setRxColor( QColor c )
{
if ( c != getRxColor() ) {
_config->writeEntry( "rxColor", c );
emit sigRxColor();
}
}
void Options::setTxColor( QColor c )
{
if ( c != getTxColor() ) {
_config->writeEntry( "txColor", c );
emit sigTxColor();
}
}
|