summaryrefslogtreecommitdiffstats
path: root/src/themedesigner
diff options
context:
space:
mode:
Diffstat (limited to 'src/themedesigner')
-rw-r--r--src/themedesigner/CMakeLists.txt17
-rw-r--r--src/themedesigner/main.cpp75
-rw-r--r--src/themedesigner/mainwindow.cpp585
-rw-r--r--src/themedesigner/mainwindow.h125
-rw-r--r--src/themedesigner/themedicongroupitem.cpp105
-rw-r--r--src/themedesigner/themedicongroupitem.h54
-rw-r--r--src/themedesigner/themediconitem.cpp195
-rw-r--r--src/themedesigner/themediconitem.h48
-rw-r--r--src/themedesigner/themediconview.cpp304
-rw-r--r--src/themedesigner/themediconview.h86
10 files changed, 1594 insertions, 0 deletions
diff --git a/src/themedesigner/CMakeLists.txt b/src/themedesigner/CMakeLists.txt
new file mode 100644
index 00000000..1cdd4a74
--- /dev/null
+++ b/src/themedesigner/CMakeLists.txt
@@ -0,0 +1,17 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/src/libs/imageproperties
+ ${CMAKE_SOURCE_DIR}/src/libs/themeengine
+ ${CMAKE_SOURCE_DIR}/src/libs/widgets/common
+)
+
+
+##### digikamthemedesigner (executable)
+
+tde_add_executable( digikamthemedesigner AUTOMOC
+ SOURCES
+ main.cpp mainwindow.cpp themedicongroupitem.cpp themediconitem.cpp themediconview.cpp
+ LINK
+ digikam-shared tdecore-shared tdeui-shared ${KDCRAW_LIBRARIES} ${KEXIV2_LIBRARIES}
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/src/themedesigner/main.cpp b/src/themedesigner/main.cpp
new file mode 100644
index 00000000..27bc7459
--- /dev/null
+++ b/src/themedesigner/main.cpp
@@ -0,0 +1,75 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-02-12
+ * Description : main program from digiKam theme designer
+ *
+ * Copyright (C) 2004-2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ * Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqstring.h>
+
+// KDE includes.
+
+#include <tdeapplication.h>
+#include <tdeaboutdata.h>
+#include <tdecmdlineargs.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+
+// Local includes.
+
+#include "daboutdata.h"
+#include "mainwindow.h"
+
+static const char *description = Digikam::themeDesignerDescription();
+
+static TDECmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Document to open." ), 0 },
+ TDECmdLineLastOption
+};
+
+int main(int argc, char** argv)
+{
+ TDEAboutData aboutData("digikamthemedesigner",
+ I18N_NOOP("digiKam Theme Designer"),
+ digikam_version,
+ description,
+ TDEAboutData::License_GPL,
+ Digikam::copyright(),
+ 0,
+ Digikam::webProjectUrl());
+
+ Digikam::authorsRegistration(aboutData);
+
+ TDECmdLineArgs::init(argc, argv, &aboutData);
+ TDECmdLineArgs::addCmdLineOptions(options);
+
+ TDEGlobal::locale()->setMainCatalogue( "digikam" );
+
+ TDEApplication app;
+ Digikam::MainWindow *im = new Digikam::MainWindow();
+ app.setMainWidget(im);
+ im->resize(800, 600);
+ im->show();
+
+ return app.exec();
+}
diff --git a/src/themedesigner/mainwindow.cpp b/src/themedesigner/mainwindow.cpp
new file mode 100644
index 00000000..ae4ef0d7
--- /dev/null
+++ b/src/themedesigner/mainwindow.cpp
@@ -0,0 +1,585 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-14
+ * Description : main digiKam theme designer window
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ * Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqpushbutton.h>
+#include <tqgroupbox.h>
+#include <tqlabel.h>
+#include <tqcombobox.h>
+#include <tqcheckbox.h>
+#include <tqframe.h>
+#include <tqsplitter.h>
+#include <tqheader.h>
+#include <tqlayout.h>
+#include <tqfileinfo.h>
+#include <tqtextstream.h>
+#include <tqdatetime.h>
+
+// KDE includes.
+
+#include <tdelocale.h>
+#include <kcolordialog.h>
+#include <kcolorbutton.h>
+#include <tdeapplication.h>
+#include <kiconloader.h>
+#include <tdefiledialog.h>
+#include <tdemessagebox.h>
+#include <kuser.h>
+
+// Local includes.
+
+#include "albumsettings.h"
+#include "folderview.h"
+#include "folderitem.h"
+#include "themediconview.h"
+#include "imagepropertiestab.h"
+#include "themeengine.h"
+#include "theme.h"
+#include "mainwindow.h"
+#include "mainwindow.moc"
+
+namespace Digikam
+{
+
+MainWindow::MainWindow()
+ : TQWidget(0, 0, WDestructiveClose)
+{
+ setCaption(i18n("digiKam Theme Designer"));
+
+ AlbumSettings *albumSettings = new AlbumSettings();
+ albumSettings->readSettings();
+
+ // Initialize theme engine ------------------------------------
+
+ ThemeEngine::instance()->scanThemes();
+ m_theme = new Theme(*(ThemeEngine::instance()->getCurrentTheme()));
+
+ // Actual views ------------------------------------------------
+
+ TQGridLayout* layout = new TQGridLayout(this);
+
+ TQSplitter* splitter = new TQSplitter(this);
+ splitter->setOrientation( TQt::Horizontal );
+ splitter->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding));
+
+ m_folderView = new FolderView(splitter);
+ m_iconView = new ThemedIconView(splitter);
+ m_propView = new ImagePropertiesTab(splitter, false);
+
+ // Property Editor ---------------------------------------------
+
+ TQGroupBox *groupBox = new TQGroupBox(this);
+ TQVBoxLayout* vlay = new TQVBoxLayout(groupBox);
+
+ TQLabel* label1 = new TQLabel("Property: ", groupBox);
+ m_propertyCombo = new TQComboBox(groupBox);
+
+ m_bevelLabel = new TQLabel("Bevel: ", groupBox);
+ m_bevelCombo = new TQComboBox(groupBox);
+
+ m_gradientLabel = new TQLabel("Gradient: ", groupBox);
+ m_gradientCombo = new TQComboBox(groupBox);
+
+ m_begColorLabel = new TQLabel("Start Color: ", groupBox);
+ m_begColorBtn = new KColorButton(groupBox);
+
+ m_endColorLabel = new TQLabel("End Color: ", groupBox);
+ m_endColorBtn = new KColorButton(groupBox);
+
+ m_addBorderCheck = new TQCheckBox("Add Border", groupBox);
+
+ m_borderColorLabel = new TQLabel("Border Color: ", groupBox);
+ m_borderColorBtn = new KColorButton(groupBox);
+
+ vlay->setAlignment(TQt::AlignTop);
+ vlay->setSpacing(5);
+ vlay->setMargin(5);
+ vlay->addWidget(label1);
+ vlay->addWidget(m_propertyCombo);
+ vlay->addWidget(m_bevelLabel);
+ vlay->addWidget(m_bevelCombo);
+ vlay->addWidget(m_gradientLabel);
+ vlay->addWidget(m_gradientCombo);
+ vlay->addWidget(m_begColorLabel);
+ vlay->addWidget(m_begColorBtn);
+ vlay->addWidget(m_endColorLabel);
+ vlay->addWidget(m_endColorBtn);
+ vlay->addWidget( m_addBorderCheck );
+ vlay->addWidget(m_borderColorLabel);
+ vlay->addWidget(m_borderColorBtn);
+ vlay->addItem(new TQSpacerItem(10, 10, TQSizePolicy::Minimum, TQSizePolicy::Expanding));
+
+ layout->setMargin(5);
+ layout->setSpacing(5);
+ layout->addWidget(splitter, 0, 0);
+ layout->addWidget(groupBox, 0, 1);
+
+ // -------------------------------------------------------------
+
+ m_propertyCombo->insertItem( "Base", BASE);
+ m_propertyCombo->insertItem( "Regular Text", REGULARTEXT);
+ m_propertyCombo->insertItem( "Selected Text", SELECTEDTEXT);
+ m_propertyCombo->insertItem( "Special Regular Text", REGULARSPECIALTEXT);
+ m_propertyCombo->insertItem( "Special Selected Text", SELECTEDSPECIALTEXT);
+ m_propertyCombo->insertItem( "Banner", BANNER);
+ m_propertyCombo->insertItem( "Thumbnail Regular", THUMBNAILREGULAR);
+ m_propertyCombo->insertItem( "Thumbnail Selected", THUMBNAILSELECTED);
+ m_propertyCombo->insertItem( "ListView Regular", LISTVIEWREGULAR);
+ m_propertyCombo->insertItem( "ListView Selected", LISTVIEWSELECTED);
+
+ m_bevelCombo->insertItem( "Flat", FLAT);
+ m_bevelCombo->insertItem( "Raised", RAISED);
+ m_bevelCombo->insertItem( "Sunken", SUNKEN );
+
+ m_gradientCombo->insertItem( "Solid", SOLID);
+ m_gradientCombo->insertItem( "Horizontal", HORIZONTAL);
+ m_gradientCombo->insertItem( "Vertical", VERTICAL );
+ m_gradientCombo->insertItem( "Diagonal", DIAGONAL );
+
+ m_bevelMap[FLAT] = Theme::FLAT;
+ m_bevelMap[RAISED] = Theme::RAISED;
+ m_bevelMap[SUNKEN] = Theme::SUNKEN;
+
+ m_gradientMap[SOLID] = Theme::SOLID;
+ m_gradientMap[HORIZONTAL] = Theme::HORIZONTAL;
+ m_gradientMap[VERTICAL] = Theme::VERTICAL;
+ m_gradientMap[DIAGONAL] = Theme::DIAGONAL;
+
+ m_bevelReverseMap[Theme::FLAT] = FLAT;
+ m_bevelReverseMap[Theme::RAISED] = RAISED;
+ m_bevelReverseMap[Theme::SUNKEN] = SUNKEN;
+
+ m_gradientReverseMap[Theme::SOLID] = SOLID;
+ m_gradientReverseMap[Theme::HORIZONTAL] = HORIZONTAL;
+ m_gradientReverseMap[Theme::VERTICAL] = VERTICAL;
+ m_gradientReverseMap[Theme::DIAGONAL] = DIAGONAL;
+
+ m_begColorBtn->setColor(TQt::black);
+ m_endColorBtn->setColor(TQt::black);
+ m_borderColorBtn->setColor(TQt::black);
+
+ connect(m_propertyCombo, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotPropertyChanged()));
+ connect(m_bevelCombo, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotUpdateTheme()));
+ connect(m_gradientCombo, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotUpdateTheme()));
+
+ connect(m_begColorBtn, TQ_SIGNAL(changed(const TQColor&)),
+ this, TQ_SLOT(slotUpdateTheme()));
+ connect(m_endColorBtn, TQ_SIGNAL(changed(const TQColor&)),
+ this, TQ_SLOT(slotUpdateTheme()));
+ connect(m_addBorderCheck, TQ_SIGNAL(toggled(bool)),
+ this, TQ_SLOT(slotUpdateTheme()));
+ connect(m_borderColorBtn, TQ_SIGNAL(changed(const TQColor&)),
+ this, TQ_SLOT(slotUpdateTheme()));
+
+ // Bottom button bar -------------------------------------------------------
+
+ TQHBoxLayout* buttonLayout = new TQHBoxLayout(0);
+ buttonLayout->setMargin(5);
+ buttonLayout->setSpacing(5);
+ buttonLayout->addItem(new TQSpacerItem(10, 10, TQSizePolicy::Expanding,
+ TQSizePolicy::Minimum));
+
+ TQPushButton* loadButton = new TQPushButton( this );
+ loadButton->setText( "&Load" );
+ buttonLayout->addWidget( loadButton );
+
+ TQPushButton* saveButton = new TQPushButton( this );
+ saveButton->setText( "&Save" );
+ buttonLayout->addWidget( saveButton );
+
+ TQPushButton* closeButton = new TQPushButton( this );
+ closeButton->setText( "&Close" );
+ buttonLayout->addWidget( closeButton );
+
+ layout->addMultiCellLayout(buttonLayout, 1, 1, 0, 1);
+
+ connect(loadButton, TQ_SIGNAL(clicked()),
+ this, TQ_SLOT(slotLoad()));
+ connect(saveButton, TQ_SIGNAL(clicked()),
+ this, TQ_SLOT(slotSave()));
+ connect(closeButton, TQ_SIGNAL(clicked()),
+ this, TQ_SLOT(close()));
+
+ // ------------------------------------------------------------------------
+
+ m_folderView->addColumn("My Albums");
+ m_folderView->setResizeMode(TQListView::LastColumn);
+ m_folderView->setRootIsDecorated(true);
+
+ TDEIconLoader *iconLoader = tdeApp->iconLoader();
+ for (int i=0; i<10; i++)
+ {
+ FolderItem* folderItem = new FolderItem(m_folderView, TQString("Album %1").arg(i));
+ folderItem->setPixmap(0, iconLoader->loadIcon("folder", TDEIcon::NoGroup,
+ 32, TDEIcon::DefaultState, 0, true));
+ if (i == 2)
+ {
+ m_folderView->setSelected(folderItem, true);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+
+ slotPropertyChanged();
+ slotUpdateTheme();
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::slotLoad()
+{
+ TQString path = KFileDialog::getOpenFileName(TQString(), TQString(),
+ this);
+ if (path.isEmpty())
+ return;
+
+ TQFileInfo fi(path);
+ m_theme->name = fi.fileName();
+ m_theme->filePath = path;
+
+ ThemeEngine::instance()->setCurrentTheme(*m_theme, m_theme->name, true);
+ *m_theme = *(ThemeEngine::instance()->getCurrentTheme());
+ slotPropertyChanged();
+}
+
+void MainWindow::slotSave()
+{
+ TQString path = KFileDialog::getSaveFileName(TQString(), TQString(), this);
+ if (path.isEmpty())
+ return;
+
+ TQFile file(path);
+ if (!file.open(IO_WriteOnly))
+ {
+ KMessageBox::error(this, "Failed to open file for writing");
+ return;
+ }
+
+ TQFileInfo fi(path);
+ m_theme->name = fi.fileName();
+ m_theme->filePath = path;
+
+ ThemeEngine::instance()->setCurrentTheme(*m_theme, m_theme->name, false);
+ ThemeEngine::instance()->saveTheme();
+}
+
+void MainWindow::slotPropertyChanged()
+{
+ m_bevelCombo->blockSignals(true);
+ m_gradientCombo->blockSignals(true);
+ m_begColorBtn->blockSignals(true);
+ m_endColorBtn->blockSignals(true);
+ m_addBorderCheck->blockSignals(true);
+ m_borderColorBtn->blockSignals(true);
+
+ m_bevelCombo->setEnabled(false);
+ m_bevelLabel->setEnabled(false);
+ m_gradientCombo->setEnabled(false);
+ m_gradientLabel->setEnabled(false);
+ m_begColorBtn->setEnabled(false);
+ m_begColorLabel->setEnabled(false);
+ m_endColorBtn->setEnabled(false);
+ m_endColorLabel->setEnabled(false);
+ m_addBorderCheck->setEnabled(false);
+ m_borderColorBtn->setEnabled(false);
+ m_borderColorLabel->setEnabled(false);
+
+ switch(m_propertyCombo->currentItem())
+ {
+ case(BASE):
+ {
+ m_begColorLabel->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_begColorBtn->setColor(m_theme->baseColor);
+ break;
+ }
+ case(REGULARTEXT):
+ {
+ m_begColorLabel->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_begColorBtn->setColor(m_theme->textRegColor);
+ break;
+ }
+ case(SELECTEDTEXT):
+ {
+ m_begColorLabel->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_begColorBtn->setColor(m_theme->textSelColor);
+ break;
+ }
+ case(REGULARSPECIALTEXT):
+ {
+ m_begColorLabel->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_begColorBtn->setColor(m_theme->textSpecialRegColor);
+ break;
+ }
+ case(SELECTEDSPECIALTEXT):
+ {
+ m_begColorLabel->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_begColorBtn->setColor(m_theme->textSpecialSelColor);
+ break;
+ }
+ case(BANNER):
+ {
+ m_bevelCombo->setEnabled(true);
+ m_gradientCombo->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_endColorBtn->setEnabled(true);
+ m_addBorderCheck->setEnabled(true);
+ m_borderColorBtn->setEnabled(true);
+ m_bevelLabel->setEnabled(true);
+ m_gradientLabel->setEnabled(true);
+ m_begColorLabel->setEnabled(true);
+ m_endColorLabel->setEnabled(true);
+ m_borderColorLabel->setEnabled(true);
+
+ m_bevelCombo->setCurrentItem(m_bevelReverseMap[m_theme->bannerBevel]);
+ m_gradientCombo->setCurrentItem(m_gradientReverseMap[m_theme->bannerGrad]);
+
+ m_begColorBtn->setColor(m_theme->bannerColor);
+ m_endColorBtn->setColor(m_theme->bannerColorTo);
+
+ m_addBorderCheck->setChecked(m_theme->bannerBorder);
+ m_borderColorBtn->setColor(m_theme->bannerBorderColor);
+
+ break;
+ }
+ case(THUMBNAILREGULAR):
+ {
+ m_bevelCombo->setEnabled(true);
+ m_gradientCombo->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_endColorBtn->setEnabled(true);
+ m_addBorderCheck->setEnabled(true);
+ m_borderColorBtn->setEnabled(true);
+ m_bevelLabel->setEnabled(true);
+ m_gradientLabel->setEnabled(true);
+ m_begColorLabel->setEnabled(true);
+ m_endColorLabel->setEnabled(true);
+ m_borderColorLabel->setEnabled(true);
+
+ m_bevelCombo->setCurrentItem(m_bevelReverseMap[m_theme->thumbRegBevel]);
+ m_gradientCombo->setCurrentItem(m_gradientReverseMap[m_theme->thumbRegGrad]);
+
+ m_begColorBtn->setColor(m_theme->thumbRegColor);
+ m_endColorBtn->setColor(m_theme->thumbRegColorTo);
+
+ m_addBorderCheck->setChecked(m_theme->thumbRegBorder);
+ m_borderColorBtn->setColor(m_theme->thumbRegBorderColor);
+
+ break;
+ }
+ case(THUMBNAILSELECTED):
+ {
+ m_bevelCombo->setEnabled(true);
+ m_gradientCombo->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_endColorBtn->setEnabled(true);
+ m_addBorderCheck->setEnabled(true);
+ m_borderColorBtn->setEnabled(true);
+ m_bevelLabel->setEnabled(true);
+ m_gradientLabel->setEnabled(true);
+ m_begColorLabel->setEnabled(true);
+ m_endColorLabel->setEnabled(true);
+ m_borderColorLabel->setEnabled(true);
+
+ m_bevelCombo->setCurrentItem(m_bevelReverseMap[m_theme->thumbSelBevel]);
+ m_gradientCombo->setCurrentItem(m_gradientReverseMap[m_theme->thumbSelGrad]);
+
+ m_begColorBtn->setColor(m_theme->thumbSelColor);
+ m_endColorBtn->setColor(m_theme->thumbSelColorTo);
+
+ m_addBorderCheck->setChecked(m_theme->thumbSelBorder);
+ m_borderColorBtn->setColor(m_theme->thumbSelBorderColor);
+
+ break;
+ }
+ case(LISTVIEWREGULAR):
+ {
+ m_bevelCombo->setEnabled(true);
+ m_gradientCombo->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_endColorBtn->setEnabled(true);
+ m_addBorderCheck->setEnabled(true);
+ m_borderColorBtn->setEnabled(true);
+ m_bevelLabel->setEnabled(true);
+ m_gradientLabel->setEnabled(true);
+ m_begColorLabel->setEnabled(true);
+ m_endColorLabel->setEnabled(true);
+ m_borderColorLabel->setEnabled(true);
+
+ m_bevelCombo->setCurrentItem(m_bevelReverseMap[m_theme->listRegBevel]);
+ m_gradientCombo->setCurrentItem(m_gradientReverseMap[m_theme->listRegGrad]);
+
+ m_begColorBtn->setColor(m_theme->listRegColor);
+ m_endColorBtn->setColor(m_theme->listRegColorTo);
+
+ m_addBorderCheck->setChecked(m_theme->listRegBorder);
+ m_borderColorBtn->setColor(m_theme->listRegBorderColor);
+
+ break;
+ }
+ case(LISTVIEWSELECTED):
+ {
+ m_bevelCombo->setEnabled(true);
+ m_gradientCombo->setEnabled(true);
+ m_begColorBtn->setEnabled(true);
+ m_endColorBtn->setEnabled(true);
+ m_addBorderCheck->setEnabled(true);
+ m_borderColorBtn->setEnabled(true);
+ m_bevelLabel->setEnabled(true);
+ m_gradientLabel->setEnabled(true);
+ m_begColorLabel->setEnabled(true);
+ m_endColorLabel->setEnabled(true);
+ m_borderColorLabel->setEnabled(true);
+
+ m_bevelCombo->setCurrentItem(m_bevelReverseMap[m_theme->listSelBevel]);
+ m_gradientCombo->setCurrentItem(m_gradientReverseMap[m_theme->listSelGrad]);
+
+ m_begColorBtn->setColor(m_theme->listSelColor);
+ m_endColorBtn->setColor(m_theme->listSelColorTo);
+
+ m_addBorderCheck->setChecked(m_theme->listSelBorder);
+ m_borderColorBtn->setColor(m_theme->listSelBorderColor);
+
+ break;
+ }
+ };
+
+ m_bevelCombo->blockSignals(false);
+ m_gradientCombo->blockSignals(false);
+ m_begColorBtn->blockSignals(false);
+ m_endColorBtn->blockSignals(false);
+ m_addBorderCheck->blockSignals(false);
+ m_borderColorBtn->blockSignals(false);
+}
+
+void MainWindow::slotUpdateTheme()
+{
+ switch(m_propertyCombo->currentItem())
+ {
+ case(BASE):
+ {
+ m_theme->baseColor = m_begColorBtn->color();
+ break;
+ }
+ case(REGULARTEXT):
+ {
+ m_theme->textRegColor = m_begColorBtn->color();
+ break;
+ }
+ case(SELECTEDTEXT):
+ {
+ m_theme->textSelColor = m_begColorBtn->color();
+ break;
+ }
+ case(REGULARSPECIALTEXT):
+ {
+ m_theme->textSpecialRegColor = m_begColorBtn->color();
+ break;
+ }
+ case(SELECTEDSPECIALTEXT):
+ {
+ m_theme->textSpecialSelColor = m_begColorBtn->color();
+ break;
+ }
+ case(BANNER):
+ {
+ m_theme->bannerBevel = (Theme::Bevel) m_bevelMap[m_bevelCombo->currentItem()];
+ m_theme->bannerGrad = (Theme::Gradient) m_gradientMap[m_gradientCombo->currentItem()];
+
+ m_theme->bannerColor = m_begColorBtn->color();
+ m_theme->bannerColorTo = m_endColorBtn->color();
+
+ m_theme->bannerBorder = m_addBorderCheck->isChecked();
+ m_theme->bannerBorderColor = m_borderColorBtn->color();
+
+ break;
+ }
+ case(THUMBNAILREGULAR):
+ {
+ m_theme->thumbRegBevel = (Theme::Bevel) m_bevelMap[m_bevelCombo->currentItem()];
+ m_theme->thumbRegGrad = (Theme::Gradient) m_gradientMap[m_gradientCombo->currentItem()];
+
+ m_theme->thumbRegColor = m_begColorBtn->color();
+ m_theme->thumbRegColorTo = m_endColorBtn->color();
+
+ m_theme->thumbRegBorder = m_addBorderCheck->isChecked();
+ m_theme->thumbRegBorderColor = m_borderColorBtn->color();
+
+ break;
+ }
+ case(THUMBNAILSELECTED):
+ {
+ m_theme->thumbSelBevel = (Theme::Bevel) m_bevelMap[m_bevelCombo->currentItem()];
+ m_theme->thumbSelGrad = (Theme::Gradient) m_gradientMap[m_gradientCombo->currentItem()];
+
+ m_theme->thumbSelColor = m_begColorBtn->color();
+ m_theme->thumbSelColorTo = m_endColorBtn->color();
+
+ m_theme->thumbSelBorder = m_addBorderCheck->isChecked();
+ m_theme->thumbSelBorderColor = m_borderColorBtn->color();
+
+ break;
+ }
+ case(LISTVIEWREGULAR):
+ {
+ m_theme->listRegBevel = (Theme::Bevel) m_bevelMap[m_bevelCombo->currentItem()];
+ m_theme->listRegGrad = (Theme::Gradient) m_gradientMap[m_gradientCombo->currentItem()];
+
+ m_theme->listRegColor = m_begColorBtn->color();
+ m_theme->listRegColorTo = m_endColorBtn->color();
+
+ m_theme->listRegBorder = m_addBorderCheck->isChecked();
+ m_theme->listRegBorderColor = m_borderColorBtn->color();
+
+ break;
+ }
+ case(LISTVIEWSELECTED):
+ {
+ m_theme->listSelBevel = (Theme::Bevel) m_bevelMap[m_bevelCombo->currentItem()];
+ m_theme->listSelGrad = (Theme::Gradient) m_gradientMap[m_gradientCombo->currentItem()];
+
+ m_theme->listSelColor = m_begColorBtn->color();
+ m_theme->listSelColorTo = m_endColorBtn->color();
+
+ m_theme->listSelBorder = m_addBorderCheck->isChecked();
+ m_theme->listSelBorderColor = m_borderColorBtn->color();
+
+ break;
+ }
+ };
+
+ ThemeEngine::instance()->setCurrentTheme(*m_theme, "Digikam ThemeEditor Theme");
+}
+
+} // NameSpace Digikam
diff --git a/src/themedesigner/mainwindow.h b/src/themedesigner/mainwindow.h
new file mode 100644
index 00000000..087dac20
--- /dev/null
+++ b/src/themedesigner/mainwindow.h
@@ -0,0 +1,125 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-14
+ * Description : main digiKam theme designer window
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ * Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+// TQt includes.
+
+#include <tqwidget.h>
+#include <tqmap.h>
+
+class TQComboBox;
+class TQCheckBox;
+class TQLabel;
+class KColorButton;
+
+namespace Digikam
+{
+
+class ImagePropertiesTab;
+class FolderView;
+class ThemedIconView;
+class Theme;
+
+class MainWindow : public TQWidget
+{
+ TQ_OBJECT
+
+
+public:
+
+ enum PROPERTY
+ {
+ BASE = 0,
+ REGULARTEXT,
+ SELECTEDTEXT,
+ REGULARSPECIALTEXT,
+ SELECTEDSPECIALTEXT,
+ BANNER,
+ THUMBNAILREGULAR,
+ THUMBNAILSELECTED,
+ LISTVIEWREGULAR,
+ LISTVIEWSELECTED
+ };
+
+ enum BEVEL
+ {
+ FLAT = 0,
+ RAISED,
+ SUNKEN
+ };
+
+ enum GRADIENT
+ {
+ SOLID = 0,
+ HORIZONTAL,
+ VERTICAL,
+ DIAGONAL
+ };
+
+public:
+
+ MainWindow();
+ ~MainWindow();
+
+private slots:
+
+ void slotLoad();
+ void slotSave();
+ void slotPropertyChanged();
+ void slotUpdateTheme();
+
+private:
+
+ TQLabel *m_bevelLabel;
+ TQLabel *m_gradientLabel;
+ TQLabel *m_begColorLabel;
+ TQLabel *m_endColorLabel;
+ TQLabel *m_borderColorLabel;
+
+ TQComboBox *m_propertyCombo;
+ TQComboBox *m_bevelCombo;
+ TQComboBox *m_gradientCombo;
+
+ TQCheckBox *m_addBorderCheck;
+
+ TQMap<int,int> m_bevelMap;
+ TQMap<int,int> m_bevelReverseMap;
+ TQMap<int,int> m_gradientMap;
+ TQMap<int,int> m_gradientReverseMap;
+
+ KColorButton *m_endColorBtn;
+ KColorButton *m_begColorBtn;
+ KColorButton *m_borderColorBtn;
+
+ FolderView *m_folderView;
+ ThemedIconView *m_iconView;
+ ImagePropertiesTab *m_propView;
+ Theme *m_theme;
+};
+
+} // NameSpace Digikam
+
+#endif // MAINWINDOW_H
diff --git a/src/themedesigner/themedicongroupitem.cpp b/src/themedesigner/themedicongroupitem.cpp
new file mode 100644
index 00000000..1da37fd3
--- /dev/null
+++ b/src/themedesigner/themedicongroupitem.cpp
@@ -0,0 +1,105 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon group item
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqpixmap.h>
+#include <tqpainter.h>
+
+// KDE includes.
+
+#include <tdelocale.h>
+
+// Local includes.
+
+#include "themeengine.h"
+#include "themediconview.h"
+#include "themedicongroupitem.h"
+
+namespace Digikam
+{
+
+ThemedIconGroupItem::ThemedIconGroupItem(ThemedIconView* view)
+ : IconGroupItem(view), m_view(view)
+{
+}
+
+ThemedIconGroupItem::~ThemedIconGroupItem()
+{
+}
+
+void ThemedIconGroupItem::paintBanner()
+{
+ TQRect r(0, 0, rect().width(), rect().height());
+
+ TQPixmap pix(m_view->bannerPixmap());
+
+ TQFont fn(m_view->font());
+ fn.setBold(true);
+ int fnSize = fn.pointSize();
+ bool usePointSize;
+ if (fnSize > 0)
+ {
+ fn.setPointSize(fnSize+2);
+ usePointSize = true;
+ }
+ else
+ {
+ fnSize = fn.pixelSize();
+ fn.setPixelSize(fnSize+2);
+ usePointSize = false;
+ }
+
+ TQPainter p(&pix);
+ p.setPen(ThemeEngine::instance()->textSelColor());
+ p.setFont(fn);
+
+ TQRect tr;
+ p.drawText(5, 5, r.width(), r.height(),
+ TQt::AlignLeft | TQt::AlignTop, i18n("Album Banner"),
+ -1, &tr);
+
+ r.setY(tr.height() + 2);
+
+ if (usePointSize)
+ fn.setPointSize(m_view->font().pointSize());
+ else
+ fn.setPixelSize(m_view->font().pixelSize());
+
+ fn.setBold(false);
+ p.setFont(fn);
+
+ p.drawText(5, r.y(), r.width(), r.height(),
+ TQt::AlignLeft | TQt::AlignVCenter, i18n("July 2007 - 10 Items"));
+
+ p.end();
+
+ r = rect();
+ r = TQRect(iconView()->contentsToViewport(TQPoint(r.x(), r.y())),
+ TQSize(r.width(), r.height()));
+
+ bitBlt(iconView()->viewport(), r.x(), r.y(), &pix,
+ 0, 0, r.width(), r.height());
+}
+
+} // NameSpace Digikam
diff --git a/src/themedesigner/themedicongroupitem.h b/src/themedesigner/themedicongroupitem.h
new file mode 100644
index 00000000..a54f2bc6
--- /dev/null
+++ b/src/themedesigner/themedicongroupitem.h
@@ -0,0 +1,54 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon group item
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#ifndef THEMEDICONGROUPITEM_H
+#define THEMEDICONGROUPITEM_H
+
+// Local includes.
+
+#include "icongroupitem.h"
+
+namespace Digikam
+{
+
+class ThemedIconView;
+
+class ThemedIconGroupItem : public IconGroupItem
+{
+public:
+
+ ThemedIconGroupItem(ThemedIconView* view);
+ ~ThemedIconGroupItem();
+
+protected:
+
+ void paintBanner();
+
+private:
+
+ ThemedIconView* m_view;
+};
+
+} // NameSpace Digikam
+
+#endif /* THEMEDICONGROUPITEM_H */
diff --git a/src/themedesigner/themediconitem.cpp b/src/themedesigner/themediconitem.cpp
new file mode 100644
index 00000000..9e90beda
--- /dev/null
+++ b/src/themedesigner/themediconitem.cpp
@@ -0,0 +1,195 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon item
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpalette.h>
+#include <tqpen.h>
+#include <tqfontmetrics.h>
+#include <tqfont.h>
+#include <tqdatetime.h>
+
+// KDE includes.
+
+#include <tdeglobal.h>
+#include <tdelocale.h>
+#include <tdeapplication.h>
+#include <kiconloader.h>
+
+// Local includes.
+
+#include "themeengine.h"
+#include "themediconview.h"
+#include "themediconitem.h"
+
+namespace Digikam
+{
+
+static void dateToString(const TQDateTime& datetime, TQString& str)
+{
+ str = TDEGlobal::locale()->formatDateTime(datetime, true, false);
+}
+
+static TQString squeezedText(TQPainter* p, int width, const TQString& text)
+{
+ TQString fullText(text);
+ fullText.replace("\n"," ");
+ TQFontMetrics fm(p->fontMetrics());
+ int textWidth = fm.width(fullText);
+ if (textWidth > width)
+ {
+ // start with the dots only
+ TQString squeezedText = "...";
+ int squeezedWidth = fm.width(squeezedText);
+
+ // estimate how many letters we can add to the dots on both sides
+ int letters = fullText.length() * (width - squeezedWidth) / textWidth;
+ if (width < squeezedWidth) letters=1;
+ squeezedText = fullText.left(letters) + "...";
+ squeezedWidth = fm.width(squeezedText);
+
+ if (squeezedWidth < width)
+ {
+ // we estimated too short
+ // add letters while text < label
+ do
+ {
+ letters++;
+ squeezedText = fullText.left(letters) + "...";
+ squeezedWidth = fm.width(squeezedText);
+ }
+ while (squeezedWidth < width);
+
+ letters--;
+ squeezedText = fullText.left(letters) + "...";
+ }
+ else if (squeezedWidth > width)
+ {
+ // we estimated too long
+ // remove letters while text > label
+ do
+ {
+ letters--;
+ squeezedText = fullText.left(letters) + "...";
+ squeezedWidth = fm.width(squeezedText);
+ }
+ while (letters && squeezedWidth > width);
+ }
+
+ if (letters >= 5)
+ {
+ return squeezedText;
+ }
+ }
+
+ return fullText;
+}
+
+ThemedIconItem::ThemedIconItem(IconGroupItem* parent)
+ : IconItem(parent)
+{
+}
+
+ThemedIconItem::~ThemedIconItem()
+{
+}
+
+void ThemedIconItem::paintItem()
+{
+ ThemedIconView* view = (ThemedIconView*)iconView();
+
+ TQPixmap pix;
+ TQRect r;
+
+ if (isSelected())
+ pix = *(view->itemBaseSelPixmap());
+ else
+ pix = *(view->itemBaseRegPixmap());
+
+ ThemeEngine* te = ThemeEngine::instance();
+
+ TQPainter p(&pix);
+ p.setPen(isSelected() ? te->textSelColor() : te->textRegColor());
+
+ {
+ r = view->itemPixmapRect();
+ TDEIconLoader *iconLoader = tdeApp->iconLoader();
+ TQPixmap thumbnail = iconLoader->loadIcon("colors", TDEIcon::NoGroup,
+ 100, TDEIcon::DefaultState, 0, true);
+
+ p.drawPixmap(r.x() + (r.width()-thumbnail.width())/2,
+ r.y() + (r.height()-thumbnail.height())/2,
+ thumbnail);
+ }
+
+ r = view->itemNameRect();
+ p.setFont(view->itemFontReg());
+ p.drawText(r, TQt::AlignCenter, squeezedText(&p, r.width(), "IMG_00.JPG"));
+
+ p.setFont(view->itemFontCom());
+ r = view->itemCommentsRect();
+ p.drawText(r, TQt::AlignCenter, squeezedText(&p, r.width(), i18n("Photo caption")));
+
+ p.setFont(view->itemFontXtra());
+ {
+ TQDateTime date = TQDateTime::currentDateTime();
+
+ r = view->itemDateRect();
+ p.setFont(view->itemFontXtra());
+ TQString str;
+ dateToString(date, str);
+ p.drawText(r, TQt::AlignCenter, squeezedText(&p, r.width(), str));
+ }
+
+ p.setFont(view->itemFontCom());
+ p.setPen(isSelected() ? te->textSpecialSelColor() : te->textSpecialRegColor());
+
+ {
+ TQString tags = i18n("Events, Places, Vacation");
+
+ r = view->itemTagRect();
+ p.drawText(r, TQt::AlignCenter,
+ squeezedText(&p, r.width(), tags));
+ }
+
+
+ if (this == view->currentItem())
+ {
+ p.setPen(TQPen(isSelected() ? te->textSelColor() : te->textRegColor(),
+ 0, TQt::DotLine));
+ p.drawRect(1, 1, pix.width()-2, pix.height()-2);
+ }
+
+ p.end();
+
+ r = rect();
+ r = TQRect(view->contentsToViewport(TQPoint(r.x(), r.y())),
+ TQSize(r.width(), r.height()));
+
+ bitBlt(view->viewport(), r.x(), r.y(), &pix,
+ 0, 0, r.width(), r.height());
+}
+
+} // NameSpace Digikam
diff --git a/src/themedesigner/themediconitem.h b/src/themedesigner/themediconitem.h
new file mode 100644
index 00000000..0d54cceb
--- /dev/null
+++ b/src/themedesigner/themediconitem.h
@@ -0,0 +1,48 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon item
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#ifndef THEMEDICONITEM_H
+#define THEMEDICONITEM_H
+
+// Local includes.
+
+#include "iconitem.h"
+
+namespace Digikam
+{
+
+class ThemedIconItem : public IconItem
+{
+public:
+
+ ThemedIconItem(IconGroupItem* parent);
+ ~ThemedIconItem();
+
+protected:
+
+ void paintItem();
+};
+
+} // NameSpace Digikam
+
+#endif /* THEMEDICONITEM_H */
diff --git a/src/themedesigner/themediconview.cpp b/src/themedesigner/themediconview.cpp
new file mode 100644
index 00000000..ef5759e6
--- /dev/null
+++ b/src/themedesigner/themediconview.cpp
@@ -0,0 +1,304 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon view
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ * Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+// Local includes.
+
+#include "themeengine.h"
+#include "themedicongroupitem.h"
+#include "themediconitem.h"
+#include "themediconview.h"
+#include "themediconview.moc"
+
+namespace Digikam
+{
+
+class ThemedIconViewPriv
+{
+public:
+
+ int thumbSize;
+
+ TQRect itemRect;
+ TQRect itemDateRect;
+ TQRect itemPixmapRect;
+ TQRect itemNameRect;
+ TQRect itemCommentsRect;
+ TQRect itemResolutionRect;
+ TQRect itemSizeRect;
+ TQRect itemTagRect;
+ TQRect bannerRect;
+
+ TQPixmap itemRegPixmap;
+ TQPixmap itemSelPixmap;
+ TQPixmap bannerPixmap;
+
+ TQFont fnReg;
+ TQFont fnCom;
+ TQFont fnXtra;
+};
+
+ThemedIconView::ThemedIconView(TQWidget* parent)
+ : IconView(parent)
+{
+ d = new ThemedIconViewPriv;
+ d->thumbSize = 128;
+
+
+ ThemedIconGroupItem* groupItem = new ThemedIconGroupItem(this);
+ for (int i=0; i<10; i++)
+ {
+ ThemedIconItem* item = new ThemedIconItem(groupItem);
+ if (i > 0 && i < 3)
+ item->setSelected(true, false);
+ }
+
+ updateBannerRectPixmap();
+ updateItemRectsPixmap();
+
+ connect(ThemeEngine::instance(), TQ_SIGNAL(signalThemeChanged()),
+ this, TQ_SLOT(slotThemeChanged()));
+}
+
+ThemedIconView::~ThemedIconView()
+{
+ delete d;
+}
+
+TQRect ThemedIconView::itemRect() const
+{
+ return d->itemRect;
+}
+
+TQRect ThemedIconView::itemDateRect() const
+{
+ return d->itemDateRect;
+}
+
+TQRect ThemedIconView::itemPixmapRect() const
+{
+ return d->itemPixmapRect;
+}
+
+TQRect ThemedIconView::itemNameRect() const
+{
+ return d->itemNameRect;
+}
+
+TQRect ThemedIconView::itemCommentsRect() const
+{
+ return d->itemCommentsRect;
+}
+
+TQRect ThemedIconView::itemResolutionRect() const
+{
+ return d->itemResolutionRect;
+}
+
+TQRect ThemedIconView::itemTagRect() const
+{
+ return d->itemTagRect;
+}
+
+TQRect ThemedIconView::itemSizeRect() const
+{
+ return d->itemSizeRect;
+}
+
+TQRect ThemedIconView::bannerRect() const
+{
+ return d->bannerRect;
+}
+
+TQPixmap* ThemedIconView::itemBaseRegPixmap() const
+{
+ return &d->itemRegPixmap;
+}
+
+TQPixmap* ThemedIconView::itemBaseSelPixmap() const
+{
+ return &d->itemSelPixmap;
+}
+
+TQPixmap ThemedIconView::bannerPixmap() const
+{
+ return d->bannerPixmap;
+}
+
+TQFont ThemedIconView::itemFontReg() const
+{
+ return d->fnReg;
+}
+
+TQFont ThemedIconView::itemFontCom() const
+{
+ return d->fnCom;
+}
+
+TQFont ThemedIconView::itemFontXtra() const
+{
+ return d->fnXtra;
+}
+
+void ThemedIconView::slotThemeChanged()
+{
+ updateBannerRectPixmap();
+ updateItemRectsPixmap();
+
+ viewport()->update();
+}
+
+void ThemedIconView::resizeEvent(TQResizeEvent* e)
+{
+ IconView::resizeEvent(e);
+
+ if (d->bannerRect.width() != frameRect().width())
+ updateBannerRectPixmap();
+}
+
+void ThemedIconView::updateBannerRectPixmap()
+{
+ d->bannerRect = TQRect(0, 0, 0, 0);
+
+ // Title --------------------------------------------------------
+ TQFont fn(font());
+ int fnSize = fn.pointSize();
+ bool usePointSize;
+ if (fnSize > 0)
+ {
+ fn.setPointSize(fnSize+2);
+ usePointSize = true;
+ }
+ else
+ {
+ fnSize = fn.pixelSize();
+ fn.setPixelSize(fnSize+2);
+ usePointSize = false;
+ }
+
+ fn.setBold(true);
+ TQFontMetrics fm(fn);
+ TQRect tr = fm.boundingRect(0, 0, frameRect().width(),
+ 0xFFFFFFFF, TQt::AlignLeft | TQt::AlignVCenter,
+ "XXX");
+ d->bannerRect.setHeight(tr.height());
+
+ if (usePointSize)
+ fn.setPointSize(font().pointSize());
+ else
+ fn.setPixelSize(font().pixelSize());
+
+ fn.setBold(false);
+ fm = TQFontMetrics(fn);
+
+ tr = fm.boundingRect(0, 0, frameRect().width(),
+ 0xFFFFFFFF, TQt::AlignLeft | TQt::AlignVCenter,
+ "XXX");
+
+ d->bannerRect.setHeight(d->bannerRect.height() + tr.height() + 10);
+ d->bannerRect.setWidth(frameRect().width());
+
+ d->bannerPixmap = ThemeEngine::instance()->bannerPixmap(d->bannerRect.width(),
+ d->bannerRect.height());
+}
+
+void ThemedIconView::updateItemRectsPixmap()
+{
+ d->itemRect = TQRect(0,0,0,0);
+ d->itemDateRect = TQRect(0,0,0,0);
+ d->itemPixmapRect = TQRect(0,0,0,0);
+ d->itemNameRect = TQRect(0,0,0,0);
+ d->itemCommentsRect = TQRect(0,0,0,0);
+ d->itemResolutionRect = TQRect(0,0,0,0);
+ d->itemSizeRect = TQRect(0,0,0,0);
+ d->itemTagRect = TQRect(0,0,0,0);
+
+ d->fnReg = font();
+ d->fnCom = font();
+ d->fnXtra = font();
+ d->fnCom.setItalic(true);
+
+ int fnSz = d->fnReg.pointSize();
+ if (fnSz > 0)
+ {
+ d->fnCom.setPointSize(fnSz-1);
+ d->fnXtra.setPointSize(fnSz-2);
+ }
+ else
+ {
+ fnSz = d->fnReg.pixelSize();
+ d->fnCom.setPixelSize(fnSz-1);
+ d->fnXtra.setPixelSize(fnSz-2);
+ }
+
+ int margin = 5;
+ int w = d->thumbSize + 2*margin;
+
+ TQFontMetrics fm(d->fnReg);
+ TQRect oneRowRegRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF,
+ TQt::AlignTop | TQt::AlignHCenter,
+ "XXXXXXXXX");
+ fm = TQFontMetrics(d->fnCom);
+ TQRect oneRowComRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF,
+ TQt::AlignTop | TQt::AlignHCenter,
+ "XXXXXXXXX");
+ fm = TQFontMetrics(d->fnXtra);
+ TQRect oneRowXtraRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF,
+ TQt::AlignTop | TQt::AlignHCenter,
+ "XXXXXXXXX");
+
+ int y = margin;
+
+ d->itemPixmapRect = TQRect(margin, y, w, d->thumbSize+margin);
+ y = d->itemPixmapRect.bottom();
+
+ {
+ d->itemNameRect = TQRect(margin, y, w, oneRowRegRect.height());
+ y = d->itemNameRect.bottom();
+ }
+
+ {
+ d->itemCommentsRect = TQRect(margin, y, w, oneRowComRect.height());
+ y = d->itemCommentsRect.bottom();
+ }
+
+ {
+ d->itemDateRect = TQRect(margin, y, w, oneRowXtraRect.height());
+ y = d->itemDateRect.bottom();
+ }
+
+ {
+ d->itemTagRect = TQRect(margin, y, w, oneRowComRect.height());
+ y = d->itemTagRect.bottom();
+ }
+
+ d->itemRect = TQRect(0, 0, w+2*margin, y+margin);
+
+ d->itemRegPixmap = ThemeEngine::instance()->thumbRegPixmap(d->itemRect.width(),
+ d->itemRect.height());
+
+ d->itemSelPixmap = ThemeEngine::instance()->thumbSelPixmap(d->itemRect.width(),
+ d->itemRect.height());
+}
+
+} // NameSpace Digikam
diff --git a/src/themedesigner/themediconview.h b/src/themedesigner/themediconview.h
new file mode 100644
index 00000000..ef2e3e15
--- /dev/null
+++ b/src/themedesigner/themediconview.h
@@ -0,0 +1,86 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-07-15
+ * Description : themed icon view
+ *
+ * Copyright (C) 2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *
+ * 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, 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.
+ *
+ * ============================================================ */
+
+#ifndef THEMEDICONVIEW_H
+#define THEMEDICONVIEW_H
+
+// TQt includes.
+
+#include <tqpixmap.h>
+
+// Local includes.
+
+#include "iconview.h"
+
+namespace Digikam
+{
+
+class ThemedIconViewPriv;
+
+class ThemedIconView : public IconView
+{
+ TQ_OBJECT
+
+
+public:
+
+ ThemedIconView(TQWidget* parent);
+ ~ThemedIconView();
+
+ TQRect itemRect() const;
+ TQRect itemDateRect() const;
+ TQRect itemPixmapRect() const;
+ TQRect itemNameRect() const;
+ TQRect itemCommentsRect() const;
+ TQRect itemResolutionRect() const;
+ TQRect itemSizeRect() const;
+ TQRect itemTagRect() const;
+ TQRect bannerRect() const;
+
+ TQPixmap* itemBaseRegPixmap() const;
+ TQPixmap* itemBaseSelPixmap() const;
+ TQPixmap bannerPixmap() const;
+
+ TQFont itemFontReg() const;
+ TQFont itemFontCom() const;
+ TQFont itemFontXtra() const;
+
+protected:
+
+ void resizeEvent(TQResizeEvent* e);
+
+private:
+
+ void updateBannerRectPixmap();
+ void updateItemRectsPixmap();
+
+ ThemedIconViewPriv* d;
+
+private slots:
+
+ void slotThemeChanged();
+};
+
+} // NameSpace Digikam
+
+#endif /* THEMEDICONVIEW_H */