SVN commit 614735 by cgilles:
digikam from trunk : Continue 0.9.1 implementation ! Second stage : adding a new Welcome page on the root album of your pictures collection. The page is inspired of Kmail or Konqueror Welcome page. On root album there is nothing to see/to do. This is the right way to show a resume of digiKam features dedicaced to new users. CCMAIL: [hidden email] M +1 -2 Makefile.am M +146 -9 albumwidgetstack.cpp M +9 -1 albumwidgetstack.h M +4 -0 digikamview.cpp --- trunk/extragear/graphics/digikam/digikam/Makefile.am #614734:614735 @@ -20,7 +20,6 @@ -I$(top_srcdir)/digikam/utilities/splashscreen \ -I$(top_srcdir)/digikam/utilities/setup \ -I$(top_srcdir)/digikam/ \ - -I$(top_builddir)/digikam/libs/dialogs \ $(LIBKIPI_CFLAGS) $(all_includes) @@ -90,7 +89,7 @@ tagspopupmenu.cpp \ upgradedb_sqlite2tosqlite3.cpp -libdigikam_la_LIBADD = $(LIB_KIO) $(LIB_SQLITE3) $(LIB_KABC) \ +libdigikam_la_LIBADD = $(LIB_KIO) $(LIB_SQLITE3) $(LIB_KABC) $(LIB_KHTML) \ $(LIBKIPI_LIBS) $(LIB_KUTILS) $(EXIV2_LIBS) \ $(top_builddir)/digikam/sqlite/libsqlite.la \ $(top_builddir)/digikam/libs/thumbbar/libthumbbar.la \ --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #614734:614735 @@ -25,19 +25,27 @@ #include <qwidget.h> #include <qpushbutton.h> #include <qlayout.h> +#include <qfile.h> +#include <qfileinfo.h> // KDE includes. +#include <kstandarddirs.h> #include <klocale.h> #include <kcursor.h> #include <kdialogbase.h> +#include <khtml_part.h> +#include <khtmlview.h> +#include <kapplication.h> // Local includes. +#include "version.h" #include "themeengine.h" #include "imagepreviewwidget.h" #include "albumiconview.h" #include "albumwidgetstack.h" +#include "albumwidgetstack.moc" namespace Digikam { @@ -54,6 +62,7 @@ previewAlbumWidget = 0; backButton = 0; editButton = 0; + htmlView = 0; } QPushButton *backButton; @@ -61,6 +70,8 @@ QWidget *buttonsArea; + KHTMLPart *htmlView; + ImagePreviewWidget *previewItemWidget; AlbumIconView *previewAlbumWidget; @@ -71,17 +82,21 @@ { d = new AlbumWidgetStackPriv; - d->previewAlbumWidget = new AlbumIconView(this); - QVBox *previewArea = new QVBox(this); - previewArea->setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain); - previewArea->setMargin(0); - previewArea->setLineWidth(1); + // -- Album icon view ----------------------------------------------- + d->previewAlbumWidget = new AlbumIconView(this); + // -- Picture preview ----------------------------------------------- + + QVBox *previewArea = new QVBox(this); d->previewItemWidget = new ImagePreviewWidget(previewArea); d->buttonsArea = new QWidget(previewArea); QHBoxLayout *hlay = new QHBoxLayout(d->buttonsArea); d->backButton = new QPushButton(i18n("Back to Album"), d->buttonsArea); d->editButton = new QPushButton(i18n("Edit..."), d->buttonsArea); + previewArea->setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain); + previewArea->setMargin(0); + previewArea->setLineWidth(1); + hlay->setMargin(KDialogBase::marginHint()); hlay->addStretch(1); hlay->addWidget(d->backButton); @@ -89,12 +104,45 @@ hlay->addWidget(d->editButton); hlay->addStretch(1); + // -- HTML help view ----------------------------------------------- + + d->htmlView = new KHTMLPart(this); + d->htmlView->widget()->setFocusPolicy(WheelFocus); + // Let's better be paranoid and disable plugins (it defaults to enabled): + d->htmlView->setPluginsEnabled(false); + d->htmlView->setJScriptEnabled(false); // just make this explicit. + d->htmlView->setJavaEnabled(false); // just make this explicit. + d->htmlView->setMetaRefreshEnabled(false); + d->htmlView->setURLCursor(KCursor::handCursor()); + + QString location = locate("data", "digikam/about/main.html"); + QString content = fileToString(location); + content = content.arg( locate( "data", "digikam/about/kde_infopage.css" ) ); + content = content.arg( "" ); + + d->htmlView->begin(KURL( location )); + + QString fontSize = QString::number( 12 ); + QString appTitle = i18n("digiKam"); + QString catchPhrase = ""; + QString quickDescription = i18n("A Photo-Management Application for KDE"); + d->htmlView->write(content.arg(fontSize) + .arg(appTitle) + .arg(catchPhrase) + .arg(quickDescription) + .arg(infoPage())); + d->htmlView->end(); + d->htmlView->show(); + + // -- Stack widgets ------------------------------------------------ + addWidget(previewArea, PreviewItemMode); addWidget(d->previewAlbumWidget, PreviewAlbumMode); + addWidget(d->htmlView->view(), HtmlViewMode); setPreviewMode(PreviewAlbumMode); - // ---------------------------------------------------------------------- + // ----------------------------------------------------------------- connect(d->backButton, SIGNAL( clicked() ), this, SIGNAL( backToAlbumSignal() ) ); @@ -112,7 +160,11 @@ this, SLOT( slotPreviewComplete() ) ); connect(d->previewItemWidget, SIGNAL( previewFailed() ), - this, SLOT( slotPreviewFailed() ) ); + this, SLOT( slotPreviewFailed() ) ); + + connect(d->htmlView->browserExtension(), + SIGNAL(openURLRequest(const KURL &, const KParts::URLArgs &)), + this, SLOT(slotUrlOpen(const KURL &))); } AlbumWidgetStack::~AlbumWidgetStack() @@ -120,6 +172,11 @@ delete d; } +void AlbumWidgetStack::slotUrlOpen(const KURL &url) +{ + KApplication::kApplication()->invokeBrowser(url.url()); +} + void AlbumWidgetStack::slotThemeChanged() { d->buttonsArea->setPaletteBackgroundColor(ThemeEngine::instance()->baseColor()); @@ -151,7 +208,7 @@ void AlbumWidgetStack::setPreviewMode(int mode) { - if (mode != PreviewAlbumMode && mode != PreviewItemMode) + if (mode != PreviewAlbumMode && mode != PreviewItemMode && mode != HtmlViewMode) return; raiseWidget(mode); @@ -176,6 +233,86 @@ d->editButton->setEnabled(false); } +QString AlbumWidgetStack::infoPage() +{ + QString info = + i18n("%1: digiKam version; %2: help:// URL; %3: homepage URL; " + "%4: prior KMail version; %5: prior KDE version; " + "%6: generated list of new features; " + "%7: First-time user text (only shown on first start); " + "%8: generated list of important changes; " + "--- end of comment ---", + "<h2 style='margin-top: 0px;'>Welcome to digiKam %1</h2><p>digiKam is a " + "photo-management program for the K Desktop Environment. " + "It is designed to organize your digital photograhs on your computer." + "</p>\n" + "<ul><li>digiKam has many powerful features which are described in the " + "<a href=\"%2\">documentation</a></li>\n" + "<li>The <a href=\"%3\">digiKam homepage</A> offers information about " + "new versions of digiKam</li></ul>\n" + "%8\n" // important changes + "<p>Some of the new features in this release of digiKam include " + "(compared to digiKam %4):</p>\n" + "<ul>\n%5</ul>\n" + "%6\n" + "<p>We hope that you will enjoy digiKam.</p>\n" + "<p>Thank you,</p>\n" + "<p style='margin-bottom: 0px'> The digiKam Team</p>") + .arg(digikam_version) // current digiKam version + .arg("help:/digikam/index.html") // digiKam help:// URL + .arg("http://www.digikam.org/") // digiKam homepage URL + .arg("0.8.2"); // previous digiKam release. + + QStringList newFeatures; + newFeatures << i18n("16 bits/color/pixels image support"); + newFeatures << i18n("Full color management support"); + newFeatures << i18n("Makernote and IPTC metadata support"); + newFeatures << i18n("Geolocalization of photograph"); + newFeatures << i18n("...TODO: add more informations here..."); + + QString featureItems; + for ( uint i = 0 ; i < newFeatures.count() ; i++ ) + featureItems += i18n("<li>%1</li>\n").arg( newFeatures[i] ); + + info = info.arg( featureItems ); + + // Add first-time user text (only shown on first start). + info = info.arg( QString::null ); + + // Generated list of important changes + info = info.arg( QString::null ); + + return info; +} + +QCString AlbumWidgetStack::fileToString(const QString &aFileName) +{ + QCString result; + QFileInfo info(aFileName); + unsigned int readLen; + unsigned int len = info.size(); + QFile file(aFileName); + + if (aFileName.isEmpty() || len <= 0 || + !info.exists() || info.isDir() || !info.isReadable() || + !file.open(IO_Raw|IO_ReadOnly)) + return QCString(); + + result.resize(len + 2); + readLen = file.readBlock(result.data(), len); + if (1 && result[len-1]!='\n') + { + result[len++] = '\n'; + readLen++; + } + result[len] = '\0'; + + if (readLen < len) + return QCString(); + + return result; +} + } // namespace Digikam -#include "albumwidgetstack.moc" + --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #614734:614735 @@ -25,6 +25,7 @@ // KDE includes. #include <qwidgetstack.h> +#include <qcstring.h> #include <qstring.h> // Local includes @@ -47,7 +48,8 @@ enum AlbumWidgetStackMode { PreviewAlbumMode=0, - PreviewItemMode + PreviewItemMode, + HtmlViewMode }; public: @@ -73,9 +75,15 @@ void slotPreviewStarted(); void slotPreviewComplete(); void slotPreviewFailed(); + void slotUrlOpen(const KURL &); private: + QCString fileToString(const QString &aFileName); + QString infoPage(); + +private: + AlbumWidgetStackPriv* d; }; --- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #614734:614735 @@ -588,6 +588,10 @@ d->parent->enableAlbumForwardHistory(!d->albumHistory->isForwardEmpty()); d->iconView->setAlbum(album); + if (album->isRoot()) + d->albumPreviews->setPreviewMode(AlbumWidgetStack::HtmlViewMode); + else + d->albumPreviews->setPreviewMode(AlbumWidgetStack::PreviewAlbumMode); } void DigikamView::slot_albumOpenInKonqui() _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |