• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
themewidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005 Petri Damst� <petri.damsten@iki.fi>
3  *
4  * This file is part of SuperKaramba.
5  *
6  * SuperKaramba is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * SuperKaramba is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with SuperKaramba; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  ****************************************************************************/
20 #include "themewidget.h"
21 #include "themelocale.h"
22 
23 ThemeWidget::ThemeWidget(QWidget *parent)
24  : QWidget(parent), m_themeFile(0)
25 {
26  setupUi(this);
27 
28  running->setText("");
29  setDescriptionMaxHeight();
30 }
31 
32 ThemeWidget::ThemeWidget(ThemeFile* tf)
33  : QWidget(0), m_themeFile(tf)
34 {
35  setupUi(this);
36 
37  QPixmap pixmap = m_themeFile->icon();
38  if (!pixmap.isNull())
39  iconLabel->setPixmap(pixmap);
40  QString version;
41  if (!m_themeFile->version().isEmpty())
42  version = " - " + m_themeFile->version();
43  themeName->setText(
44  m_themeFile->locale()->translate(m_themeFile->name().toAscii().constData()) + version);
45  description->setText(
46  m_themeFile->locale()->translate(m_themeFile->description().toAscii().constData()));
47  running->setText("");
48  buttonGo->hide();
49  setDescriptionMaxHeight();
50 }
51 
52 ThemeWidget::~ThemeWidget()
53 {
54  delete m_themeFile;
55 }
56 
57 int ThemeWidget::addInstance()
58 {
59  int i = 1;
60  while (m_instancePool.indexOf(i) >= 0)
61  ++i;
62 
63  m_instancePool.append(i);
64  updateRunning();
65  return i;
66 }
67 
68 void ThemeWidget::removeInstance(int instance)
69 {
70  m_instancePool.removeAll(instance);
71  updateRunning();
72 }
73 
74 void ThemeWidget::updateRunning()
75 {
76  int i = instances();
77  if (i > 0)
78  running->setText(i18n("<p align=\"center\">%1 running</p>", i));
79  else
80  running->setText("");
81 }
82 
83 void ThemeWidget::setDescriptionText(const QString &text)
84 {
85  description->setText(text);
86 }
87 
88 void ThemeWidget::setHeaderText(const QString &text)
89 {
90  themeName->setText(text);
91 }
92 
93 void ThemeWidget::showButton(bool show)
94 {
95  if (show)
96  buttonGo->show();
97  else
98  buttonGo->hide();
99  setDescriptionMaxHeight();
100 }
101 
102 void ThemeWidget::setDescriptionMaxHeight()
103 {
104  int h = height() - themeName->height() - 5;
105 
106  if (buttonGo->isVisible())
107  h -= buttonGo->height() + 15;
108 
109  description->setWordWrap(true);
110  description->setMaximumHeight(h);
111 }
112 
113 QPixmap ThemeWidget::icon()
114 {
115  return *iconLabel->pixmap();
116 }
117 
118 QString ThemeWidget::path()
119 {
120  return m_themeFile->getUrlPath().path();
121 }
122 
123 #include "themewidget.moc"
ThemeWidget::~ThemeWidget
~ThemeWidget()
Definition: themewidget.cpp:52
ThemeFile
Definition: themefile.h:41
ThemeLocale::translate
SUPERKARAMBA_EXPORT QString translate(const QString &text) const
Definition: themelocale.cpp:136
ThemeFile::locale
const ThemeLocale * locale() const
Definition: themefile.cpp:596
ThemeFile::getUrlPath
KUrl getUrlPath()
Definition: themefile.cpp:368
QWidget
themelocale.h
ThemeWidget::showButton
void showButton(bool show)
Definition: themewidget.cpp:93
ThemeWidget::removeInstance
void removeInstance(int instance)
Definition: themewidget.cpp:68
ThemeWidget::updateRunning
void updateRunning()
Definition: themewidget.cpp:74
themewidget.h
ThemeFile::name
const QString & name() const
Definition: themefile.cpp:536
ThemeWidget::instances
int instances() const
Definition: themewidget.h:44
ThemeWidget::icon
QPixmap icon()
Definition: themewidget.cpp:113
ThemeFile::description
const QString & description() const
Definition: themefile.cpp:576
ThemeFile::version
const QString & version() const
Definition: themefile.cpp:541
ThemeWidget::path
QString path()
Definition: themewidget.cpp:118
ThemeWidget::ThemeWidget
ThemeWidget(QWidget *parent=0)
Definition: themewidget.cpp:23
ThemeWidget::addInstance
int addInstance()
Definition: themewidget.cpp:57
ThemeWidget::setDescriptionText
void setDescriptionText(const QString &text)
Definition: themewidget.cpp:83
ThemeWidget::setDescriptionMaxHeight
void setDescriptionMaxHeight()
Definition: themewidget.cpp:102
description
static const char description[]
Definition: main.cpp:41
ThemeWidget::setHeaderText
void setHeaderText(const QString &text)
Definition: themewidget.cpp:88
ThemeFile::icon
QPixmap icon() const
Definition: themefile.cpp:263
version
static const char version[]
Definition: main.cpp:44
show
int show(long widget)
Definition: misc.cpp:600
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal