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
|
/***************************************************************************
fontscolors.cpp - description
-------------------
begin : Tue Mar 7 2000
copyright : (C) 2000 by mark dufour
email : m.dufour@twi.tudelft.nl
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "fontscolors.h"
#include "globals.h"
#include "browser.h"
#include "sourcebox.h"
#include "chatbox.h"
#include "utility.h"
#include "separator.h"
#include <qfontdialog.h>
#include <qcolordialog.h>
#include <qlineedit.h>
fontscolors::fontscolors(QWidget *parent, const char *name) : QWidget(parent,name){
initDialog();
QObject::connect( Bbrowserfont, SIGNAL( clicked() ), this, SLOT( changeBrowserFont() ) );
QObject::connect( Bsourcefont, SIGNAL( clicked() ), this, SLOT( changeSourceFont() ) );
QObject::connect( Bircfont, SIGNAL( clicked() ), this, SLOT( changeIrcFont() ) );
QObject::connect( Bemailfont, SIGNAL( clicked() ), this, SLOT( changeEmailFont() ) );
QObject::connect( Bextensionforeground, SIGNAL( clicked() ), this, SLOT( changeExtensionColor() ) );
QObject::connect( Bvisitedforeground, SIGNAL( clicked() ), this, SLOT( changeVisitedColor() ) );
QObject::connect( Btitleforeground, SIGNAL( clicked() ), this, SLOT( changeTitleForeground() ) );
QObject::connect( Btitlebackground, SIGNAL( clicked() ), this, SLOT( changeTitleBackground() ) );
QObject::connect( Bhighlightforeground, SIGNAL( clicked() ), this, SLOT( changeHighlightForeground() ) );
QObject::connect( Bhighlightbackground, SIGNAL( clicked() ), this, SLOT( changeHighlightBackground() ) );
QObject::connect( Bbackground, SIGNAL( clicked() ), this, SLOT( changeBackgroundColor() ) );
extensionColor = QColor( blue );
visitedColor = QColor( darkMagenta );
titleForeground = QColor( black );
titleBackground = QColor( blue );
highlightForeground = QColor( white );
highlightBackground = QColor( darkBlue );
backgroundColor = QColor( lightGray );
}
void fontscolors::changeExtensionColor()
{
if( changeColor( extensionColor ) )
browser->setCatLabelColors();
}
void fontscolors::changeVisitedColor()
{
if( changeColor( visitedColor ) )
browser->setCatLabelColors();
}
void fontscolors::changeTitleForeground()
{
if( changeColor( titleForeground ) )
browser->setTitleLabelColors();
}
void fontscolors::changeTitleBackground()
{
if( changeColor( titleBackground ) )
browser->setTitleLabelColors();
}
void fontscolors::changeHighlightForeground()
{
if( changeColor( highlightForeground ) )
browser->setCatLabelColors();
}
void fontscolors::changeBackgroundColor()
{
if( changeColor( backgroundColor ) )
{
browser->setBackgroundColor();
browser->setCatLabelColors();
}
}
void fontscolors::changeHighlightBackground()
{
if( changeColor( highlightBackground ) )
browser->setCatLabelColors();
}
int fontscolors::changeColor( QColor &color )
{
QColor c = QColorDialog::getColor( color );
if( c.isValid() )
{
color = c;
return TRUE;
}
return FALSE;
}
void fontscolors::changeBrowserFont()
{
bool ok;
QFont f = QFontDialog::getFont( &ok, browser->font() );
if( ok )
{
LEbrowserfont->setText( f.rawName() );
LEbrowserfont->setCursorPosition( 0 );
browser->setFont( f );
browser->maskSep->adjustFont( f );
browser->genSep->adjustFont( f );
}
}
void fontscolors::changeSourceFont()
{
bool ok;
QFont f = QFontDialog::getFont( &ok, browser->sourceBox->font() );
if( ok )
{
LEsourcefont->setText( f.rawName() );
LEsourcefont->setCursorPosition( 0 );
browser->sourceBox->setFont( f );
}
}
void fontscolors::changeEmailFont()
{
bool ok;
QFont f;
f.setRawName( LEemailfont->text() );
f = QFontDialog::getFont( &ok, f );
if( ok )
{
LEemailfont->setText( f.rawName() );
LEemailfont->setCursorPosition( 0 );
}
}
void fontscolors::changeIrcFont()
{
bool ok;
QFont f = QFontDialog::getFont( &ok, browser->chatBox->font() );
if( ok )
{
LEircfont->setText( f.rawName() );
LEircfont->setCursorPosition( 0 );
browser->chatBox->setFont( f );
}
}
fontscolors::~fontscolors(){
}
|