1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2007-2009 Licq developers
4  *
5  * Licq 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  * Licq 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 Licq; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #include "skinnablecombobox.h"
21 
22 #include "config/skin.h"
23 
24 using namespace LicqQtGui;
25 
SkinnableComboBox(const Config::ComboSkin & skin,QWidget * parent)26 SkinnableComboBox::SkinnableComboBox(const Config::ComboSkin& skin, QWidget* parent)
27   : QComboBox(parent)
28 {
29   applySkin(skin);
30 }
31 
SkinnableComboBox(QWidget * parent)32 SkinnableComboBox::SkinnableComboBox(QWidget* parent)
33   : QComboBox(parent)
34 {
35 }
36 
applySkin(const Config::ComboSkin & skin)37 void SkinnableComboBox::applySkin(const Config::ComboSkin& skin)
38 {
39   // Set colors
40   QPalette pal;
41   if (skin.background.isValid())
42   {
43     pal.setColor(QPalette::Base, skin.background);
44     pal.setColor(QPalette::Button, skin.background);
45   }
46   if (skin.foreground.isValid())
47   {
48     pal.setColor(QPalette::Text, skin.foreground);
49     pal.setColor(QPalette::ButtonText, skin.foreground);
50   }
51   setPalette(pal);
52 }
53