You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
5.5 KiB
146 lines
5.5 KiB
15 years ago
|
/***************************************************************************
|
||
|
displaycfg.cpp - description
|
||
|
-------------------
|
||
|
begin : Fr Aug 15 2003
|
||
|
copyright : (C) 2003 by Martin Witte
|
||
|
email : witte@kawo1.rwth-aachen.de
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* 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 "displaycfg.h"
|
||
|
#include <kcolorbutton.h>
|
||
|
#include <kcolordialog.h>
|
||
12 years ago
|
#include <tdefontdialog.h>
|
||
15 years ago
|
|
||
13 years ago
|
#include <tqlayout.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
14 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqbuttongroup.h>
|
||
15 years ago
|
|
||
13 years ago
|
DisplayConfiguration::DisplayConfiguration(TQWidget *parent)
|
||
|
: TQWidget (parent),
|
||
15 years ago
|
m_dirty(true),
|
||
|
m_ignore_gui_updates(false)
|
||
|
{
|
||
14 years ago
|
TQGroupBox *bg = new TQGroupBox(i18n("Display Colors"), this);
|
||
15 years ago
|
bg->setColumnLayout(0, Qt::Vertical );
|
||
13 years ago
|
bg->layout()->setSpacing( 8 );
|
||
|
bg->layout()->setMargin( 12 );
|
||
|
TQGridLayout *gl = new TQGridLayout (bg->layout());
|
||
15 years ago
|
|
||
|
m_btnActive = new KColorButton(queryDisplayActiveColor(), bg);
|
||
|
m_btnInactive = new KColorButton(queryDisplayInactiveColor(), bg);
|
||
|
m_btnBkgnd = new KColorButton(queryDisplayBkgndColor(), bg);
|
||
|
|
||
14 years ago
|
connect(m_btnActive, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
|
connect(m_btnInactive, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
|
connect(m_btnBkgnd, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
15 years ago
|
|
||
14 years ago
|
TQLabel *l1 = new TQLabel(i18n("Active Text"), bg);
|
||
|
TQLabel *l2 = new TQLabel(i18n("Inactive Text"), bg);
|
||
|
TQLabel *l3 = new TQLabel(i18n("Background Color"), bg);
|
||
15 years ago
|
|
||
13 years ago
|
l1->setAlignment(TQLabel::AlignCenter);
|
||
|
l2->setAlignment(TQLabel::AlignCenter);
|
||
|
l3->setAlignment(TQLabel::AlignCenter);
|
||
15 years ago
|
|
||
13 years ago
|
l1->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
||
|
l2->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
||
|
l3->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
||
|
m_btnActive ->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding));
|
||
|
m_btnInactive->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding));
|
||
|
m_btnBkgnd ->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding));
|
||
15 years ago
|
|
||
14 years ago
|
m_btnActive ->setMinimumSize(TQSize(40, 40));
|
||
|
m_btnInactive->setMinimumSize(TQSize(40, 40));
|
||
|
m_btnBkgnd ->setMinimumSize(TQSize(40, 40));
|
||
15 years ago
|
|
||
14 years ago
|
gl->addWidget (l1, 0, 0, TQt::AlignCenter);
|
||
|
gl->addWidget (l2, 0, 1, TQt::AlignCenter);
|
||
|
gl->addWidget (l3, 0, 2, TQt::AlignCenter);
|
||
15 years ago
|
gl->addWidget (m_btnActive, 1, 0);
|
||
|
gl->addWidget (m_btnInactive, 1, 1);
|
||
|
gl->addWidget (m_btnBkgnd, 1, 2);
|
||
|
|
||
12 years ago
|
m_fontChooser = new TDEFontChooser(this, NULL, false, TQStringList(), true, 4);
|
||
15 years ago
|
m_fontChooser->setFont(queryDisplayFont());
|
||
13 years ago
|
m_fontChooser->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding));
|
||
15 years ago
|
|
||
14 years ago
|
TQVBoxLayout *l = new TQVBoxLayout(this, 10);
|
||
15 years ago
|
l->addWidget(bg);
|
||
|
l->addWidget(m_fontChooser);
|
||
|
|
||
14 years ago
|
connect(m_btnActive, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
|
connect(m_btnInactive, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
|
connect(m_btnBkgnd, TQT_SIGNAL(changed(const TQColor &)), this, TQT_SLOT(slotSetDirty()));
|
||
|
connect(m_fontChooser, TQT_SIGNAL(fontSelected(const TQFont &)), this, TQT_SLOT(slotSetDirty()));
|
||
15 years ago
|
|
||
|
}
|
||
|
|
||
|
|
||
|
DisplayConfiguration::~DisplayConfiguration()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
bool DisplayConfiguration::noticeDisplayColorsChanged(const TQColor &activeColor, const TQColor &inactiveColor, const TQColor &bkgnd)
|
||
15 years ago
|
{
|
||
|
m_ignore_gui_updates = true;
|
||
|
m_btnActive->setColor(activeColor);
|
||
|
m_btnInactive->setColor(inactiveColor);
|
||
|
m_btnBkgnd->setColor(bkgnd);
|
||
|
m_ignore_gui_updates = false;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
bool DisplayConfiguration::noticeDisplayFontChanged(const TQFont &f)
|
||
15 years ago
|
{
|
||
|
m_ignore_gui_updates = true;
|
||
|
m_fontChooser->setFont(f);
|
||
|
m_ignore_gui_updates = false;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
void DisplayConfiguration::slotOK()
|
||
|
{
|
||
|
if (m_dirty) {
|
||
|
sendDisplayColors(m_btnActive->color(), m_btnInactive->color(), m_btnBkgnd->color());
|
||
|
sendDisplayFont(m_fontChooser->font());
|
||
|
m_dirty = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void DisplayConfiguration::slotCancel()
|
||
|
{
|
||
|
if (m_dirty) {
|
||
|
m_ignore_gui_updates = true;
|
||
|
m_btnActive ->setColor(queryDisplayActiveColor());
|
||
|
m_btnInactive->setColor(queryDisplayInactiveColor());
|
||
|
m_btnBkgnd ->setColor(queryDisplayBkgndColor());
|
||
|
m_fontChooser->setFont(queryDisplayFont());
|
||
|
m_dirty = false;
|
||
|
m_ignore_gui_updates = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void DisplayConfiguration::slotSetDirty()
|
||
|
{
|
||
|
if (!m_dirty && !m_ignore_gui_updates) {
|
||
|
m_dirty = true;
|
||
|
emit sigDirty();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
#include "displaycfg.moc"
|