SVN commit 497581 by fjcruz:
Widget to show icc metadata in open file dialogs. Warning: it's still buggy. CCMAIL:[hidden email] M +36 -8 iccpreviewwidget.cpp M +13 -6 iccpreviewwidget.h --- trunk/extragear/graphics/digikam/libs/widgets/iccpreviewwidget.cpp #497580:497581 @@ -35,6 +35,8 @@ #include <klocale.h> #include <kdialog.h> +#include <ksqueezedtextlabel.h> +#include <kdebug.h> // Others @@ -46,34 +48,34 @@ : KPreviewWidgetBase( parent ) { //TODO - QVBoxLayout *layout = new QVBoxLayout(parent, 0, KDialog::spacingHint()); + QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); - QVGroupBox *metaData = new QVGroupBox(parent); + QVGroupBox *metaData = new QVGroupBox(this); QHGroupBox *name = new QHGroupBox(metaData); name->setFrameStyle(QFrame::NoFrame); QLabel *label1 = new QLabel(i18n("Name: "), name); - m_name = new QLabel(0, name); + m_name = new KSqueezedTextLabel(0, name); QHGroupBox *description = new QHGroupBox(metaData); description->setFrameStyle(QFrame::NoFrame); QLabel *label2 = new QLabel(i18n("Description: "), description); - m_description = new QLabel(0, description); + m_description = new KSqueezedTextLabel(0, description); QHGroupBox *colorSpace = new QHGroupBox(metaData); colorSpace->setFrameStyle(QFrame::NoFrame); QLabel *label3 = new QLabel(i18n("Color space: "), colorSpace); - m_colorSpace = new QLabel(0, colorSpace); + m_colorSpace = new KSqueezedTextLabel(0, colorSpace); QHGroupBox *deviceClass = new QHGroupBox(metaData); deviceClass->setFrameStyle(QFrame::NoFrame); QLabel *label4 = new QLabel(i18n("Device class: "), deviceClass); - m_deviceClass = new QLabel(0, deviceClass); + m_deviceClass = new KSqueezedTextLabel(0, deviceClass); QHGroupBox *renderingIntent = new QHGroupBox(metaData); renderingIntent->setFrameStyle(QFrame::NoFrame); QLabel *label5 = new QLabel(i18n("Rendering intent: "), renderingIntent); - m_renderingIntent = new QLabel(0, renderingIntent); + m_renderingIntent = new KSqueezedTextLabel(0, renderingIntent); layout->addWidget(metaData); } @@ -86,12 +88,30 @@ void ICCPreviewWidget::showPreview( const KURL &url) { //TODO - getICCData(url); + if (url.isLocalFile()) + { + kdDebug() << "Is Local file" << endl; + currentUrl = url; + getICCData(currentUrl); + } + else + { + kdDebug() << "Not Local file" << endl; + clearPreview(); + return; + } } void ICCPreviewWidget::clearPreview() { //TODO + m_name->clear(); + m_description->clear(); + m_colorSpace->clear(); + m_deviceClass->clear(); + m_renderingIntent->clear(); + currentUrl = KURL(); + } void ICCPreviewWidget::getICCData( const KURL &url) @@ -99,8 +119,12 @@ //TODO cmsHPROFILE tmpProfile=0; QString space, device, intent; + if (!url.hasPath()) + return; + tmpProfile = cmsOpenProfileFromFile(QFile::encodeName(url.path()), "r"); + m_name->setText(QString(cmsTakeProductName(tmpProfile))); m_description->setText(QString(cmsTakeProductDesc(tmpProfile))); @@ -180,6 +204,10 @@ cmsCloseProfile(tmpProfile); } +void ICCPreviewWidget::virtual_hook( int, void* ) +{ } +} + #include "iccpreviewwidget.moc" --- trunk/extragear/graphics/digikam/libs/widgets/iccpreviewwidget.h #497580:497581 @@ -30,7 +30,8 @@ #include LCMS_HEADER -class QLabel; +class KSqueezedTextLabel; +class KURL; namespace Digikam { @@ -51,14 +52,20 @@ virtual void showPreview(const KURL &url); virtual void clearPreview(); +protected: + + virtual void virtual_hook(int id, void* data); + private: - QLabel *m_name; - QLabel *m_description; - QLabel *m_colorSpace; - QLabel *m_deviceClass; - QLabel *m_renderingIntent; + KSqueezedTextLabel *m_name; + KSqueezedTextLabel *m_description; + KSqueezedTextLabel *m_colorSpace; + KSqueezedTextLabel *m_deviceClass; + KSqueezedTextLabel *m_renderingIntent; + KURL currentUrl; + private: void getICCData(const KURL &url); _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |