• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
themewidget.cpp
1/*
2 * Copyright (C) 2005 Petri Damstén <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#include <kpushbutton.h>
23#include <kdebug.h>
24#include <tdelocale.h>
25#include <tqlabel.h>
26#include <tqlayout.h>
27
28ThemeWidget::ThemeWidget(TQWidget *parent, const char *name)
29 : ThemeWidgetLayout(parent, name), m_themeFile(0)
30{
31 running->setText("");
32 setDescriptionMaxHeight();
33}
34
35ThemeWidget::ThemeWidget(ThemeFile* tf)
36 : m_themeFile(tf)
37{
38 TQPixmap pixmap = m_themeFile->icon();
39 if(!pixmap.isNull())
40 icon->setPixmap(pixmap);
41 TQString version;
42 if(!m_themeFile->version().isEmpty())
43 version = " - " + m_themeFile->version();
44 themeName->setText(
45 m_themeFile->locale()->translate(m_themeFile->name().ascii()) + version);
46 description->setText(
47 m_themeFile->locale()->translate(m_themeFile->description().ascii()));
48 running->setText("");
49 buttonGo->hide();
50 setDescriptionMaxHeight();
51}
52
53ThemeWidget::~ThemeWidget()
54{
55 delete m_themeFile;
56}
57
58int ThemeWidget::addInstance()
59{
60 int i = 1;
61 while(m_instancePool.find(i) != m_instancePool.end())
62 ++i;
63 m_instancePool.append(i);
64 updateRunning();
65 return i;
66}
67
68void ThemeWidget::removeInstance(int instance)
69{
70 m_instancePool.remove(instance);
71 updateRunning();
72}
73
74void ThemeWidget::updateRunning()
75{
76 int i = instances();
77 if(i > 0)
78 running->setText(i18n("<p align=\"center\">%1 running</p>").arg(i));
79 else
80 running->setText("");
81}
82
83void ThemeWidget::setDescriptionText(TQString text)
84{
85 description->setText(text);
86}
87
88void ThemeWidget::setHeaderText(TQString text)
89{
90 themeName->setText(text);
91}
92
93void ThemeWidget::showButton(bool show)
94{
95 if(show)
96 buttonGo->show();
97 else
98 buttonGo->hide();
99 setDescriptionMaxHeight();
100}
101
102void ThemeWidget::setDescriptionMaxHeight()
103{
104 if(layoutText->geometry().height() <= 0)
105 return;
106 int height = layoutText->geometry().height() - themeName->height() -
107 layoutText->spacing();
108 if(buttonGo->isVisible())
109 height -= layoutButton->geometry().height() + layoutText->spacing();
110 description->setMaximumHeight(height);
111}
112
113#include "themewidget.moc"
ThemeFile
Definition: themefile.h:43

superkaramba

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

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.9.4
This website is maintained by Timothy Pearson.