- Improved palette document spec
[dashstudio.git] / src / components / colorpalette / brushsynchronizer.cpp
blob52414e054427c7d25e098373ad763d7b86e5b76f
1 /***************************************************************************
2 * Copyright (C) 2007 by Jorge Cuadrado *
3 * kuadrosxx@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "brushsynchronizer.h"
23 #include "mixer.h"
24 #include "palettes.h"
26 // namespace Dash {
27 namespace Component {
29 BrushSynchronizer::BrushSynchronizer(QObject *parent)
30 : QObject(parent)
32 m_mixer = new Mixer();
33 connect(m_mixer, SIGNAL(brushChanged(const QBrush &)), this, SLOT(onBrushChanged(const QBrush &)));
35 m_palettes = new Component::Palettes();
36 m_palettes->setWindowTitle(tr("Color palette") );
37 connect(m_palettes, SIGNAL(brushSelected(const QBrush &)), this, SLOT(onBrushSelected(const QBrush &)));
41 BrushSynchronizer::~BrushSynchronizer()
45 Mixer *BrushSynchronizer::mixer() const
47 return m_mixer;
50 Component::Palettes *BrushSynchronizer::palettes() const
52 return m_palettes;
55 void BrushSynchronizer::setBrush(const QBrush& brush)
57 //FIXME: revisar que no se haga un ciclo infinito con los signals
58 m_palettes->setBrush(brush);
59 m_mixer->setBrush(brush);
62 void BrushSynchronizer::onBrushChanged( const QBrush & brush )
64 m_palettes->setBrush(brush);
65 emit brushChanged(brush);
68 void BrushSynchronizer::onBrushSelected( const QBrush & brush )
70 m_mixer->setBrush(brush);
71 emit brushChanged(brush);
75 // }