SVN commit 502751 by cgilles:
digikam from trunk : Showfoto/IE common GUI implementation : IOFileProgressBar give 3 running mode now : filename, progress bar, and progress bar with cancel button. We need to use this widget in image saving implementation instead KProgressDialog from SavingContextContainer ! CCMAIL: [hidden email], [hidden email] M +4 -4 showfoto/showfoto.cpp M +4 -4 utilities/imageeditor/editor/imagewindow.cpp M +46 -13 utilities/imageeditor/editor/iofileprogressbar.cpp M +17 -4 utilities/imageeditor/editor/iofileprogressbar.h --- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #502750:502751 @@ -789,14 +789,14 @@ m_openFilesInFolderAction->setEnabled(false); m_fileOpenAction->setEnabled(false); - m_nameLabel->progressBarVisible(true); + m_nameLabel->progressBarMode(Digikam::IOFileProgressBar::ProgressBarMode); } void ShowFoto::slotLoadingFinished(const QString &filename, bool success, bool isReadOnly) { //TODO: handle success == false - m_nameLabel->progressBarVisible(false); + m_nameLabel->progressBarMode(Digikam::IOFileProgressBar::FileNameMode); m_isReadOnly = isReadOnly; slotUpdateItemInfo(); @@ -820,7 +820,7 @@ m_openFilesInFolderAction->setEnabled(false); m_fileOpenAction->setEnabled(false); - m_nameLabel->progressBarVisible(true); + m_nameLabel->progressBarMode(Digikam::IOFileProgressBar::CancelProgressBarMode); } void ShowFoto::finishSaving(bool success) @@ -838,7 +838,7 @@ m_openFilesInFolderAction->setEnabled(true); m_fileOpenAction->setEnabled(true); - m_nameLabel->progressBarVisible(false); + m_nameLabel->progressBarMode(Digikam::IOFileProgressBar::FileNameMode); } void ShowFoto::slotSavingFinished(const QString &filename, bool success) --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #502750:502751 @@ -552,14 +552,14 @@ m_rightSidebar->noCurrentItem(); toggleActions(false); - m_nameLabel->progressBarVisible(true); + m_nameLabel->progressBarMode(IOFileProgressBar::ProgressBarMode); } void ImageWindow::slotLoadingFinished(const QString &filename, bool success, bool isReadOnly) { //TODO: handle success == false - m_nameLabel->progressBarVisible(false); + m_nameLabel->progressBarMode(IOFileProgressBar::FileNameMode); m_isReadOnly = isReadOnly; slotUpdateItemInfo(); @@ -579,7 +579,7 @@ m_rightSidebar->noCurrentItem(); toggleActions(false); - m_nameLabel->progressBarVisible(true); + m_nameLabel->progressBarMode(IOFileProgressBar::CancelProgressBarMode); } void ImageWindow::finishSaving(bool success) @@ -595,7 +595,7 @@ // TODO updated image propertie side bar! toggleActions(true); - m_nameLabel->progressBarVisible(false); + m_nameLabel->progressBarMode(IOFileProgressBar::FileNameMode); } void ImageWindow::slotSavingFinished(const QString &filename, bool success) --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/iofileprogressbar.cpp #502750:502751 @@ -1,8 +1,8 @@ /* ============================================================ * Author: Gilles Caulier <caulier dot gilles at free.fr> * Date : 2006-01-24 - * Description : a progress bar used to display io file acess - * progressor or the current file name. + * Description : a progress bar used to display io file access + * progress or the current file name. * * Copyright 2006 by Gilles Caulier * @@ -22,10 +22,15 @@ // Qt includes. #include "qlabel.h" +#include <qlayout.h> +#include "qwidget.h" +#include "qpushbutton.h" // KDE includes. #include "kprogress.h" +#include <klocale.h> +#include <kiconloader.h> // Local includes. @@ -39,7 +44,7 @@ public: - enum WidgetVisible + enum WidgetStackEnum { FileNameLabel=0, FileAcessProgressBar @@ -49,24 +54,44 @@ { fileNameLabel = 0; fileAcessProgressBar = 0; + progressWidget = 0; + cancelButton = 0; } - QLabel *fileNameLabel; + QLabel *fileNameLabel; + + QWidget *progressWidget; - KProgress *fileAcessProgressBar; + QPushButton *cancelButton; + + KProgress *fileAcessProgressBar; }; IOFileProgressBar::IOFileProgressBar(QWidget *parent) : QWidgetStack(parent, 0, Qt::WDestructiveClose) { d = new IOFileProgressBarPriv; - d->fileNameLabel = new QLabel(this); - d->fileAcessProgressBar = new KProgress(this); + + d->fileNameLabel = new QLabel(this); + d->progressWidget = new QWidget(this); + QHBoxLayout *hBox = new QHBoxLayout(d->progressWidget); + d->fileAcessProgressBar = new KProgress(d->progressWidget); d->fileAcessProgressBar->setTotalSteps(100); + d->cancelButton = new QPushButton(d->progressWidget); + d->cancelButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + d->cancelButton->setPixmap( SmallIcon( "cancel" ) ); + + hBox->addWidget(d->fileAcessProgressBar); + hBox->addWidget(d->cancelButton); addWidget(d->fileNameLabel, IOFileProgressBarPriv::FileNameLabel); - addWidget(d->fileAcessProgressBar, IOFileProgressBarPriv::FileAcessProgressBar); - progressBarVisible(false); + addWidget(d->progressWidget, IOFileProgressBarPriv::FileAcessProgressBar); + setMaximumHeight( fontMetrics().height() ); + + connect( d->cancelButton, SIGNAL( clicked() ), + this, SIGNAL( signalCancelButtonPressed() ) ); + + progressBarMode(FileNameMode); } IOFileProgressBar::~IOFileProgressBar() @@ -89,14 +114,22 @@ d->fileAcessProgressBar->setProgress(v); } -void IOFileProgressBar::progressBarVisible(bool v) +void IOFileProgressBar::progressBarMode( int mode ) { - if (v) + if ( mode == FileNameMode) { + raiseWidget(IOFileProgressBarPriv::FileNameLabel); + } + else if ( mode == ProgressBarMode ) + { + d->cancelButton->hide(); raiseWidget(IOFileProgressBarPriv::FileAcessProgressBar); } - else - raiseWidget(IOFileProgressBarPriv::FileNameLabel); + else // CancelProgressBarMode + { + d->cancelButton->show(); + raiseWidget(IOFileProgressBarPriv::FileAcessProgressBar); + } } } // namespace Digikam --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/iofileprogressbar.h #502750:502751 @@ -1,9 +1,9 @@ /* ============================================================ * Author: Gilles Caulier <caulier dot gilles at free.fr> * Date : 2006-01-24 - * Description : a progress bar used to display io file acess - * progressor or the current file name. - * + * Description : a progress bar used to display io file access + * progress or the current file name. + * * Copyright 2006 by Gilles Caulier * * This program is free software; you can redistribute it @@ -47,10 +47,23 @@ ~IOFileProgressBar(); void setText(QString text); - void progressBarVisible(bool v); + void progressBarMode(int mode); void setProgressValue( int v ); void setAlignment(int a); +public: + + enum IOFileProgressBarMode + { + FileNameMode=0, + ProgressBarMode, + CancelProgressBarMode + }; + +signals: + + void signalCancelButtonPressed(); + private: IOFileProgressBarPriv* d; _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |