summaryrefslogtreecommitdiffstats
path: root/src/gvcore/bcgdialog.cpp
blob: 8f3ec3666aa59fd2b7e91a3d74904163e4a128dd (plain)
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
// vim: set tabstop=4 shiftwidth=4 noexpandtab
/*
Gwenview - A simple image viewer for TDE
Copyright 2006 Aurélien Gâteau

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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/
// Self
#include "bcgdialog.moc"

// TQt
#include <tqslider.h>
#include <tqvbox.h>

// KDE
#include <tdelocale.h>

// Local
#include "imageview.h"
#include "bcgdialogbase.h"

namespace Gwenview {


struct BCGDialog::Private {
	ImageView* mView;
	BCGDialogBase* mContent;
};


BCGDialog::BCGDialog(ImageView* view) 
: KDialogBase(view, "bcg_dialog", false /* modal */, 
	i18n("Adjust Brightness/Contrast/Gamma"), KDialogBase::Close | KDialogBase::Default)
{
	d=new Private;
	d->mView=view;
	d->mContent=new BCGDialogBase(this);
	setMainWidget(d->mContent);
	connect(d->mContent->mBSlider, TQT_SIGNAL(valueChanged(int)),
		view, TQT_SLOT(setBrightness(int)) );
	connect(d->mContent->mCSlider, TQT_SIGNAL(valueChanged(int)),
		view, TQT_SLOT(setContrast(int)) );
	connect(d->mContent->mGSlider, TQT_SIGNAL(valueChanged(int)),
		view, TQT_SLOT(setGamma(int)) );
	
	connect(view, TQT_SIGNAL(bcgChanged()),
		this, TQT_SLOT(updateFromImageView()) );
}


BCGDialog::~BCGDialog() {
	delete d;
}


void BCGDialog::slotDefault() {
	d->mView->setBrightness(0);	
	d->mView->setContrast(0);	
	d->mView->setGamma(0);	
	updateFromImageView();
}


void BCGDialog::updateFromImageView() {
	d->mContent->mBSlider->setValue(d->mView->brightness());
	d->mContent->mCSlider->setValue(d->mView->contrast());
	d->mContent->mGSlider->setValue(d->mView->gamma());
}


} // namespace