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
|
/********************************************************************
* Copyright (C) 2005, 2006 Piotr Pszczolkowski
*-------------------------------------------------------------------
* This file is part of BSCommander (Beesoft Commander).
*
* BSCommander 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.
*
* BSCommander 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 BsC; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*******************************************************************/
/*------- include files:
-------------------------------------------------------------------*/
#include "Config.h"
#include "Settings.h"
/*------- local constants:
-------------------------------------------------------------------*/
const QString Config::PanelConfigGroupName = "Panel config";
const QString Config::AppConfigGroup = "Application";
//.........................................................
const QString Config::LFS_FontKey = "lfs font";
const QString Config::FTP_FontKey = "ftp font";
const QString Config::LFS_BkgColorKey = "lfs background color";
const QString Config::FTP_BkgColorKey = "ftp background color";
const QString Config::LangKey = "language";
const QString Config::SelectionModeKey = "selection mode";
const QString Config::FnDispModeKey = "function buttons display mode";
const QString Config::FnFontKey = "function buttons font";
const QString Config::TerminalKey = "terminal";
const QString Config::ColumnsResizeKey = "disable columns resize";
//.........................................................
const QString Config::LFS_DefaultFont = "Sans Serif,9,-1,5,50,0,0,0,0,0";
const QString Config::FTP_DefaultFont = "Sans Serif,9,-1,5,50,0,0,0,0,0";
const QString Config::FN_DefaultFont = "Sans Serif,10,-1,5,50,0,0,0,0,0";
const QString Config::LFS_DefaultBkgColor = "#ffffc8";
const QString Config::FTP_DefaultBkgColor = "#fdca97";
/*------- local static variables:
-------------------------------------------------------------------*/
Config* Config::d_instance = 0;
//*******************************************************************
// Config CONSTRUCTOR
//*******************************************************************
Config::Config()
{
refresh();
}
// end of Config
//*******************************************************************
// ~Config CONSTRUCTOR
//*******************************************************************
Config::~Config()
{}
// end of ~Config
//*******************************************************************
// instance PUBLIC
//*******************************************************************
Config* Config::instance()
{
if( 0 == d_instance ) {
d_instance = new Config;
}
return d_instance;
}
// end of instance
//*******************************************************************
// refresh PUBLIC
//*******************************************************************
void Config::refresh()
{
QString info;
if( Settings::read( PanelConfigGroupName, LFS_FontKey, info ) ) {
d_lfs_font.fromString( info );
}
else {
d_lfs_font.fromString( LFS_DefaultFont );
}
//........................................................
if( Settings::read( PanelConfigGroupName, FTP_FontKey, info ) ) {
d_ftp_font.fromString( info );
}
else {
d_ftp_font.fromString( FTP_DefaultFont );
}
//........................................................
if( Settings::read( PanelConfigGroupName, LFS_BkgColorKey, info ) ) {
d_lfs_bkg_color.setNamedColor( info );
}
else {
d_lfs_bkg_color.setNamedColor( LFS_DefaultBkgColor );
}
//........................................................
if( Settings::read( PanelConfigGroupName, FTP_BkgColorKey, info ) ) {
d_ftp_bkg_color.setNamedColor( info );
}
else {
d_ftp_bkg_color.setNamedColor( FTP_DefaultBkgColor );
}
//........................................................
if( FALSE == Settings::read( AppConfigGroup, LangKey, d_lang ) ) {
d_lang = Lang_EN;
}
//........................................................
if( FALSE == Settings::read( AppConfigGroup, SelectionModeKey, d_selection_mode ) ) {
d_selection_mode = NC;
}
//.........................................................
if( FALSE == Settings::read( AppConfigGroup, FnDispModeKey, d_fn_disp_mode ) ) {
d_fn_disp_mode = FULL_DESC;
}
//........................................................
if( Settings::read( AppConfigGroup, FnFontKey, info ) ) {
d_fn_font.fromString( info );
}
else {
d_fn_font.fromString( FN_DefaultFont );
}
//........................................................
Settings::read( AppConfigGroup, TerminalKey, d_terminal_call );
Settings::read( PanelConfigGroupName, ColumnsResizeKey, d_disable_columns_resize );
}
// end of refresh
|