diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-17 08:33:13 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-17 08:33:13 +0000 |
commit | 5543c8d9438bdee5065f9c30e418f9b664aee170 (patch) | |
tree | 3f360005ae611849a11adab769c34033dee2147f /digikam/themedesigner | |
download | digikam-5543c8d9438bdee5065f9c30e418f9b664aee170.tar.gz digikam-5543c8d9438bdee5065f9c30e418f9b664aee170.zip |
Added developer-abandoned KDE3 version of Digikam
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/digikam@1075997 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'digikam/themedesigner')
-rw-r--r-- | digikam/themedesigner/Makefile.am | 19 | ||||
-rw-r--r-- | digikam/themedesigner/main.cpp | 75 | ||||
-rw-r--r-- | digikam/themedesigner/mainwindow.cpp | 585 | ||||
-rw-r--r-- | digikam/themedesigner/mainwindow.h | 124 | ||||
-rw-r--r-- | digikam/themedesigner/themedicongroupitem.cpp | 105 | ||||
-rw-r--r-- | digikam/themedesigner/themedicongroupitem.h | 54 | ||||
-rw-r--r-- | digikam/themedesigner/themediconitem.cpp | 195 | ||||
-rw-r--r-- | digikam/themedesigner/themediconitem.h | 48 | ||||
-rw-r--r-- | digikam/themedesigner/themediconview.cpp | 304 | ||||
-rw-r--r-- | digikam/themedesigner/themediconview.h | 85 |
10 files changed, 1594 insertions, 0 deletions
diff --git a/digikam/themedesigner/Makefile.am b/digikam/themedesigner/Makefile.am new file mode 100644 index 0000000..bbd9723 --- /dev/null +++ b/digikam/themedesigner/Makefile.am @@ -0,0 +1,19 @@ +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/digikam/digikam \ + -I$(top_srcdir)/digikam/libs/widgets/common \ + -I$(top_srcdir)/digikam/libs/dimg \ + -I$(top_srcdir)/digikam/libs/themeengine \ + -I$(top_srcdir)/digikam/libs/dmetadata \ + -I$(top_srcdir)/digikam/libs/imageproperties \ + $(LIBKEXIV2_CFLAGS) $(LIBKDCRAW_CFLAGS) $(all_includes) + +bin_PROGRAMS = digikamthemedesigner + +digikamthemedesigner_SOURCES = main.cpp mainwindow.cpp themedicongroupitem.cpp \ + themediconitem.cpp themediconview.cpp + +digikamthemedesigner_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) \ + $(top_builddir)/digikam/digikam/libdigikam.la + +digikamthemedesigner_LDFLAGS = $(KDE_RPATH) $(all_libraries) $(LIB_KUTILS) diff --git a/digikam/themedesigner/main.cpp b/digikam/themedesigner/main.cpp new file mode 100644 index 0000000..0616ea0 --- /dev/null +++ b/digikam/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. + * + * ============================================================ */ + +// Qt includes. + +#include <qstring.h> + +// KDE includes. + +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <kglobal.h> +#include <klocale.h> + +// Local includes. + +#include "daboutdata.h" +#include "mainwindow.h" + +static const char *description = Digikam::themeDesignerDescription(); + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open." ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char** argv) +{ + KAboutData aboutData("digikamthemedesigner", + I18N_NOOP("digiKam Theme Designer"), + digikam_version, + description, + KAboutData::License_GPL, + Digikam::copyright(), + 0, + Digikam::webProjectUrl()); + + Digikam::authorsRegistration(aboutData); + + KCmdLineArgs::init(argc, argv, &aboutData); + KCmdLineArgs::addCmdLineOptions(options); + + KGlobal::locale()->setMainCatalogue( "digikam" ); + + KApplication app; + Digikam::MainWindow *im = new Digikam::MainWindow(); + app.setMainWidget(im); + im->resize(800, 600); + im->show(); + + return app.exec(); +} diff --git a/digikam/themedesigner/mainwindow.cpp b/digikam/themedesigner/mainwindow.cpp new file mode 100644 index 0000000..1e9868d --- /dev/null +++ b/digikam/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. + * + * ============================================================ */ + +// Qt includes. + +#include <qpushbutton.h> +#include <qgroupbox.h> +#include <qlabel.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qframe.h> +#include <qsplitter.h> +#include <qheader.h> +#include <qlayout.h> +#include <qfileinfo.h> +#include <qtextstream.h> +#include <qdatetime.h> + +// KDE includes. + +#include <klocale.h> +#include <kcolordialog.h> +#include <kcolorbutton.h> +#include <kapplication.h> +#include <kiconloader.h> +#include <kfiledialog.h> +#include <kmessagebox.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() + : QWidget(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 ------------------------------------------------ + + QGridLayout* layout = new QGridLayout(this); + + QSplitter* splitter = new QSplitter(this); + splitter->setOrientation( QSplitter::Horizontal ); + splitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + + m_folderView = new FolderView(splitter); + m_iconView = new ThemedIconView(splitter); + m_propView = new ImagePropertiesTab(splitter, false); + + // Property Editor --------------------------------------------- + + QGroupBox *groupBox = new QGroupBox(this); + QVBoxLayout* vlay = new QVBoxLayout(groupBox); + + QLabel* label1 = new QLabel("Property: ", groupBox); + m_propertyCombo = new QComboBox(groupBox); + + m_bevelLabel = new QLabel("Bevel: ", groupBox); + m_bevelCombo = new QComboBox(groupBox); + + m_gradientLabel = new QLabel("Gradient: ", groupBox); + m_gradientCombo = new QComboBox(groupBox); + + m_begColorLabel = new QLabel("Start Color: ", groupBox); + m_begColorBtn = new KColorButton(groupBox); + + m_endColorLabel = new QLabel("End Color: ", groupBox); + m_endColorBtn = new KColorButton(groupBox); + + m_addBorderCheck = new QCheckBox("Add Border", groupBox); + + m_borderColorLabel = new QLabel("Border Color: ", groupBox); + m_borderColorBtn = new KColorButton(groupBox); + + vlay->setAlignment(Qt::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 QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::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(Qt::black); + m_endColorBtn->setColor(Qt::black); + m_borderColorBtn->setColor(Qt::black); + + connect(m_propertyCombo, SIGNAL(activated(int)), + this, SLOT(slotPropertyChanged())); + connect(m_bevelCombo, SIGNAL(activated(int)), + this, SLOT(slotUpdateTheme())); + connect(m_gradientCombo, SIGNAL(activated(int)), + this, SLOT(slotUpdateTheme())); + + connect(m_begColorBtn, SIGNAL(changed(const QColor&)), + this, SLOT(slotUpdateTheme())); + connect(m_endColorBtn, SIGNAL(changed(const QColor&)), + this, SLOT(slotUpdateTheme())); + connect(m_addBorderCheck, SIGNAL(toggled(bool)), + this, SLOT(slotUpdateTheme())); + connect(m_borderColorBtn, SIGNAL(changed(const QColor&)), + this, SLOT(slotUpdateTheme())); + + // Bottom button bar ------------------------------------------------------- + + QHBoxLayout* buttonLayout = new QHBoxLayout(0); + buttonLayout->setMargin(5); + buttonLayout->setSpacing(5); + buttonLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, + QSizePolicy::Minimum)); + + QPushButton* loadButton = new QPushButton( this ); + loadButton->setText( "&Load" ); + buttonLayout->addWidget( loadButton ); + + QPushButton* saveButton = new QPushButton( this ); + saveButton->setText( "&Save" ); + buttonLayout->addWidget( saveButton ); + + QPushButton* closeButton = new QPushButton( this ); + closeButton->setText( "&Close" ); + buttonLayout->addWidget( closeButton ); + + layout->addMultiCellLayout(buttonLayout, 1, 1, 0, 1); + + connect(loadButton, SIGNAL(clicked()), + this, SLOT(slotLoad())); + connect(saveButton, SIGNAL(clicked()), + this, SLOT(slotSave())); + connect(closeButton, SIGNAL(clicked()), + this, SLOT(close())); + + // ------------------------------------------------------------------------ + + m_folderView->addColumn("My Albums"); + m_folderView->setResizeMode(QListView::LastColumn); + m_folderView->setRootIsDecorated(true); + + KIconLoader *iconLoader = KApplication::kApplication()->iconLoader(); + for (int i=0; i<10; i++) + { + FolderItem* folderItem = new FolderItem(m_folderView, QString("Album %1").arg(i)); + folderItem->setPixmap(0, iconLoader->loadIcon("folder", KIcon::NoGroup, + 32, KIcon::DefaultState, 0, true)); + if (i == 2) + { + m_folderView->setSelected(folderItem, true); + } + } + + // ------------------------------------------------------------------------ + + slotPropertyChanged(); + slotUpdateTheme(); +} + +MainWindow::~MainWindow() +{ +} + +void MainWindow::slotLoad() +{ + QString path = KFileDialog::getOpenFileName(QString::null, QString::null, + this); + if (path.isEmpty()) + return; + + QFileInfo 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() +{ + QString path = KFileDialog::getSaveFileName(QString::null, QString::null, this); + if (path.isEmpty()) + return; + + QFile file(path); + if (!file.open(IO_WriteOnly)) + { + KMessageBox::error(this, "Failed to open file for writing"); + return; + } + + QFileInfo 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/digikam/themedesigner/mainwindow.h b/digikam/themedesigner/mainwindow.h new file mode 100644 index 0000000..042d1e2 --- /dev/null +++ b/digikam/themedesigner/mainwindow.h @@ -0,0 +1,124 @@ +/* ============================================================ + * + * 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 + +// Qt includes. + +#include <qwidget.h> +#include <qmap.h> + +class QComboBox; +class QCheckBox; +class QLabel; +class KColorButton; + +namespace Digikam +{ + +class ImagePropertiesTab; +class FolderView; +class ThemedIconView; +class Theme; + +class MainWindow : public QWidget +{ + Q_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: + + QLabel *m_bevelLabel; + QLabel *m_gradientLabel; + QLabel *m_begColorLabel; + QLabel *m_endColorLabel; + QLabel *m_borderColorLabel; + + QComboBox *m_propertyCombo; + QComboBox *m_bevelCombo; + QComboBox *m_gradientCombo; + + QCheckBox *m_addBorderCheck; + + QMap<int,int> m_bevelMap; + QMap<int,int> m_bevelReverseMap; + QMap<int,int> m_gradientMap; + QMap<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/digikam/themedesigner/themedicongroupitem.cpp b/digikam/themedesigner/themedicongroupitem.cpp new file mode 100644 index 0000000..6586825 --- /dev/null +++ b/digikam/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. + * + * ============================================================ */ + +// Qt includes. + +#include <qpixmap.h> +#include <qpainter.h> + +// KDE includes. + +#include <klocale.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() +{ + QRect r(0, 0, rect().width(), rect().height()); + + QPixmap pix(m_view->bannerPixmap()); + + QFont 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; + } + + QPainter p(&pix); + p.setPen(ThemeEngine::instance()->textSelColor()); + p.setFont(fn); + + QRect tr; + p.drawText(5, 5, r.width(), r.height(), + Qt::AlignLeft | Qt::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(), + Qt::AlignLeft | Qt::AlignVCenter, i18n("July 2007 - 10 Items")); + + p.end(); + + r = rect(); + r = QRect(iconView()->contentsToViewport(QPoint(r.x(), r.y())), + QSize(r.width(), r.height())); + + bitBlt(iconView()->viewport(), r.x(), r.y(), &pix, + 0, 0, r.width(), r.height()); +} + +} // NameSpace Digikam diff --git a/digikam/themedesigner/themedicongroupitem.h b/digikam/themedesigner/themedicongroupitem.h new file mode 100644 index 0000000..a54f2bc --- /dev/null +++ b/digikam/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/digikam/themedesigner/themediconitem.cpp b/digikam/themedesigner/themediconitem.cpp new file mode 100644 index 0000000..7195384 --- /dev/null +++ b/digikam/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. + * + * ============================================================ */ + +// Qt includes. + +#include <qpainter.h> +#include <qpixmap.h> +#include <qpalette.h> +#include <qpen.h> +#include <qfontmetrics.h> +#include <qfont.h> +#include <qdatetime.h> + +// KDE includes. + +#include <kglobal.h> +#include <klocale.h> +#include <kapplication.h> +#include <kiconloader.h> + +// Local includes. + +#include "themeengine.h" +#include "themediconview.h" +#include "themediconitem.h" + +namespace Digikam +{ + +static void dateToString(const QDateTime& datetime, QString& str) +{ + str = KGlobal::locale()->formatDateTime(datetime, true, false); +} + +static QString squeezedText(QPainter* p, int width, const QString& text) +{ + QString fullText(text); + fullText.replace("\n"," "); + QFontMetrics fm(p->fontMetrics()); + int textWidth = fm.width(fullText); + if (textWidth > width) + { + // start with the dots only + QString 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(); + + QPixmap pix; + QRect r; + + if (isSelected()) + pix = *(view->itemBaseSelPixmap()); + else + pix = *(view->itemBaseRegPixmap()); + + ThemeEngine* te = ThemeEngine::instance(); + + QPainter p(&pix); + p.setPen(isSelected() ? te->textSelColor() : te->textRegColor()); + + { + r = view->itemPixmapRect(); + KIconLoader *iconLoader = KApplication::kApplication()->iconLoader(); + QPixmap thumbnail = iconLoader->loadIcon("colors", KIcon::NoGroup, + 100, KIcon::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, Qt::AlignCenter, squeezedText(&p, r.width(), "IMG_00.JPG")); + + p.setFont(view->itemFontCom()); + r = view->itemCommentsRect(); + p.drawText(r, Qt::AlignCenter, squeezedText(&p, r.width(), i18n("Photo caption"))); + + p.setFont(view->itemFontXtra()); + { + QDateTime date = QDateTime::currentDateTime(); + + r = view->itemDateRect(); + p.setFont(view->itemFontXtra()); + QString str; + dateToString(date, str); + p.drawText(r, Qt::AlignCenter, squeezedText(&p, r.width(), str)); + } + + p.setFont(view->itemFontCom()); + p.setPen(isSelected() ? te->textSpecialSelColor() : te->textSpecialRegColor()); + + { + QString tags = i18n("Events, Places, Vacation"); + + r = view->itemTagRect(); + p.drawText(r, Qt::AlignCenter, + squeezedText(&p, r.width(), tags)); + } + + + if (this == view->currentItem()) + { + p.setPen(QPen(isSelected() ? te->textSelColor() : te->textRegColor(), + 0, Qt::DotLine)); + p.drawRect(1, 1, pix.width()-2, pix.height()-2); + } + + p.end(); + + r = rect(); + r = QRect(view->contentsToViewport(QPoint(r.x(), r.y())), + QSize(r.width(), r.height())); + + bitBlt(view->viewport(), r.x(), r.y(), &pix, + 0, 0, r.width(), r.height()); +} + +} // NameSpace Digikam diff --git a/digikam/themedesigner/themediconitem.h b/digikam/themedesigner/themediconitem.h new file mode 100644 index 0000000..0d54cce --- /dev/null +++ b/digikam/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/digikam/themedesigner/themediconview.cpp b/digikam/themedesigner/themediconview.cpp new file mode 100644 index 0000000..2600434 --- /dev/null +++ b/digikam/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; + + QRect itemRect; + QRect itemDateRect; + QRect itemPixmapRect; + QRect itemNameRect; + QRect itemCommentsRect; + QRect itemResolutionRect; + QRect itemSizeRect; + QRect itemTagRect; + QRect bannerRect; + + QPixmap itemRegPixmap; + QPixmap itemSelPixmap; + QPixmap bannerPixmap; + + QFont fnReg; + QFont fnCom; + QFont fnXtra; +}; + +ThemedIconView::ThemedIconView(QWidget* 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(), SIGNAL(signalThemeChanged()), + this, SLOT(slotThemeChanged())); +} + +ThemedIconView::~ThemedIconView() +{ + delete d; +} + +QRect ThemedIconView::itemRect() const +{ + return d->itemRect; +} + +QRect ThemedIconView::itemDateRect() const +{ + return d->itemDateRect; +} + +QRect ThemedIconView::itemPixmapRect() const +{ + return d->itemPixmapRect; +} + +QRect ThemedIconView::itemNameRect() const +{ + return d->itemNameRect; +} + +QRect ThemedIconView::itemCommentsRect() const +{ + return d->itemCommentsRect; +} + +QRect ThemedIconView::itemResolutionRect() const +{ + return d->itemResolutionRect; +} + +QRect ThemedIconView::itemTagRect() const +{ + return d->itemTagRect; +} + +QRect ThemedIconView::itemSizeRect() const +{ + return d->itemSizeRect; +} + +QRect ThemedIconView::bannerRect() const +{ + return d->bannerRect; +} + +QPixmap* ThemedIconView::itemBaseRegPixmap() const +{ + return &d->itemRegPixmap; +} + +QPixmap* ThemedIconView::itemBaseSelPixmap() const +{ + return &d->itemSelPixmap; +} + +QPixmap ThemedIconView::bannerPixmap() const +{ + return d->bannerPixmap; +} + +QFont ThemedIconView::itemFontReg() const +{ + return d->fnReg; +} + +QFont ThemedIconView::itemFontCom() const +{ + return d->fnCom; +} + +QFont ThemedIconView::itemFontXtra() const +{ + return d->fnXtra; +} + +void ThemedIconView::slotThemeChanged() +{ + updateBannerRectPixmap(); + updateItemRectsPixmap(); + + viewport()->update(); +} + +void ThemedIconView::resizeEvent(QResizeEvent* e) +{ + IconView::resizeEvent(e); + + if (d->bannerRect.width() != frameRect().width()) + updateBannerRectPixmap(); +} + +void ThemedIconView::updateBannerRectPixmap() +{ + d->bannerRect = QRect(0, 0, 0, 0); + + // Title -------------------------------------------------------- + QFont 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); + QFontMetrics fm(fn); + QRect tr = fm.boundingRect(0, 0, frameRect().width(), + 0xFFFFFFFF, Qt::AlignLeft | Qt::AlignVCenter, + "XXX"); + d->bannerRect.setHeight(tr.height()); + + if (usePointSize) + fn.setPointSize(font().pointSize()); + else + fn.setPixelSize(font().pixelSize()); + + fn.setBold(false); + fm = QFontMetrics(fn); + + tr = fm.boundingRect(0, 0, frameRect().width(), + 0xFFFFFFFF, Qt::AlignLeft | Qt::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 = QRect(0,0,0,0); + d->itemDateRect = QRect(0,0,0,0); + d->itemPixmapRect = QRect(0,0,0,0); + d->itemNameRect = QRect(0,0,0,0); + d->itemCommentsRect = QRect(0,0,0,0); + d->itemResolutionRect = QRect(0,0,0,0); + d->itemSizeRect = QRect(0,0,0,0); + d->itemTagRect = QRect(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; + + QFontMetrics fm(d->fnReg); + QRect oneRowRegRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF, + Qt::AlignTop | Qt::AlignHCenter, + "XXXXXXXXX"); + fm = QFontMetrics(d->fnCom); + QRect oneRowComRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF, + Qt::AlignTop | Qt::AlignHCenter, + "XXXXXXXXX"); + fm = QFontMetrics(d->fnXtra); + QRect oneRowXtraRect = fm.boundingRect(0, 0, w, 0xFFFFFFFF, + Qt::AlignTop | Qt::AlignHCenter, + "XXXXXXXXX"); + + int y = margin; + + d->itemPixmapRect = QRect(margin, y, w, d->thumbSize+margin); + y = d->itemPixmapRect.bottom(); + + { + d->itemNameRect = QRect(margin, y, w, oneRowRegRect.height()); + y = d->itemNameRect.bottom(); + } + + { + d->itemCommentsRect = QRect(margin, y, w, oneRowComRect.height()); + y = d->itemCommentsRect.bottom(); + } + + { + d->itemDateRect = QRect(margin, y, w, oneRowXtraRect.height()); + y = d->itemDateRect.bottom(); + } + + { + d->itemTagRect = QRect(margin, y, w, oneRowComRect.height()); + y = d->itemTagRect.bottom(); + } + + d->itemRect = QRect(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/digikam/themedesigner/themediconview.h b/digikam/themedesigner/themediconview.h new file mode 100644 index 0000000..462b453 --- /dev/null +++ b/digikam/themedesigner/themediconview.h @@ -0,0 +1,85 @@ +/* ============================================================ + * + * 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 + +// Qt includes. + +#include <qpixmap.h> + +// Local includes. + +#include "iconview.h" + +namespace Digikam +{ + +class ThemedIconViewPriv; + +class ThemedIconView : public IconView +{ + Q_OBJECT + +public: + + ThemedIconView(QWidget* parent); + ~ThemedIconView(); + + QRect itemRect() const; + QRect itemDateRect() const; + QRect itemPixmapRect() const; + QRect itemNameRect() const; + QRect itemCommentsRect() const; + QRect itemResolutionRect() const; + QRect itemSizeRect() const; + QRect itemTagRect() const; + QRect bannerRect() const; + + QPixmap* itemBaseRegPixmap() const; + QPixmap* itemBaseSelPixmap() const; + QPixmap bannerPixmap() const; + + QFont itemFontReg() const; + QFont itemFontCom() const; + QFont itemFontXtra() const; + +protected: + + void resizeEvent(QResizeEvent* e); + +private: + + void updateBannerRectPixmap(); + void updateItemRectsPixmap(); + + ThemedIconViewPriv* d; + +private slots: + + void slotThemeChanged(); +}; + +} // NameSpace Digikam + +#endif /* THEMEDICONVIEW_H */ |