SVN commit 619734 by cgilles:
digiKam from trunk : add a button in Comments & Tags side bar to revert all changes from current image if nothing have been apply by user. CCMAIL: [hidden email] M +39 -4 imagedescedittab.cpp M +3 -0 imagedescedittab.h M +18 -8 navigatebarwidget.cpp M +5 -5 navigatebarwidget.h --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #619733:619734 @@ -92,6 +92,7 @@ ABCMenu = 0; assignedTagsBtn = 0; applyBtn = 0; + revertBtn = 0; } bool modified; @@ -100,6 +101,7 @@ QToolButton *recentTagsBtn; QToolButton *tagsSearchClearBtn; QToolButton *assignedTagsBtn; + QToolButton *revertBtn; QPopupMenu *ABCMenu; @@ -166,7 +168,7 @@ d->tagsSearchEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); d->assignedTagsBtn = new QToolButton(tagsSearch); - QToolTip::add(d->assignedTagsBtn, i18n("Already Assigned Tags")); + QToolTip::add(d->assignedTagsBtn, i18n("Already assigned tags")); d->assignedTagsBtn->setIconSet(kapp->iconLoader()->loadIcon("tag-assigned", KIcon::NoGroup, KIcon::SizeSmall, KIcon::DefaultState, 0, true)); @@ -188,17 +190,29 @@ d->tagsView->setSelectionMode(QListView::Single); d->tagsView->setResizeMode(QListView::LastColumn); - // -------------------------------------------------- + // Buttons ----------------------------------------- - d->applyBtn = new QPushButton(i18n("Apply Changes"), settingsArea); + QHBox *buttonsBox = new QHBox(settingsArea); + buttonsBox->setSpacing(KDialog::spacingHint()); + + d->revertBtn = new QToolButton(buttonsBox); + d->revertBtn->setIconSet(SmallIcon("reload_page")); + QToolTip::add(d->revertBtn, i18n("Revert all changes")); + d->revertBtn->setEnabled(false); + + d->applyBtn = new QPushButton(i18n("Apply Changes"), buttonsBox); + d->applyBtn->setIconSet(SmallIcon("apply")); d->applyBtn->setEnabled(false); + buttonsBox->setStretchFactor(d->applyBtn, 10); + // -------------------------------------------------- + settingsLayout->addMultiCellWidget(commentsBox, 0, 0, 0, 1); settingsLayout->addMultiCellWidget(dateBox, 1, 1, 0, 1); settingsLayout->addMultiCellWidget(ratingBox, 2, 2, 0, 1); settingsLayout->addMultiCellWidget(d->tagsView, 3, 3, 0, 1); settingsLayout->addMultiCellWidget(tagsSearch, 4, 4, 0, 1); - settingsLayout->addMultiCellWidget(d->applyBtn, 5, 5, 0, 1); + settingsLayout->addMultiCellWidget(buttonsBox, 5, 5, 0, 1); settingsLayout->setRowStretch(3, 10); // -------------------------------------------------- @@ -244,6 +258,9 @@ connect(d->applyBtn, SIGNAL(clicked()), this, SLOT(slotApplyAllChanges())); + + connect(d->revertBtn, SIGNAL(clicked()), + this, SLOT(slotRevertAllChanges())); // Initalize --------------------------------------------- @@ -415,14 +432,30 @@ d->modified = false; d->applyBtn->setEnabled(false); + d->revertBtn->setEnabled(false); updateRecentTags(); } +void ImageDescEditTab::slotRevertAllChanges() +{ + if (!d->modified) + return; + + if (!d->currInfo) + return; + + setInfo(d->currInfo, d->navigateBar->getButtonsState()); +} + void ImageDescEditTab::setItem(ImageInfo *info, int itemType) { slotApplyAllChanges(); + setInfo(info, itemType); +} +void ImageDescEditTab::setInfo(ImageInfo *info, int itemType) +{ if (!info) { d->navigateBar->setFileName(); @@ -436,6 +469,7 @@ d->currInfo = info; d->modified = false; d->applyBtn->setEnabled(false); + d->revertBtn->setEnabled(false); KURL fileURL; fileURL.setPath(d->currInfo->filePath()); @@ -497,6 +531,7 @@ { d->modified = true; d->applyBtn->setEnabled(true); + d->revertBtn->setEnabled(true); } void ImageDescEditTab::setFocusToComments() --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #619733:619734 @@ -71,6 +71,8 @@ private: + void setInfo(ImageInfo *info, int itemType); + void updateTagsView(); void updateComments(); void updateRating(); @@ -90,6 +92,7 @@ private slots: void slotApplyAllChanges(); + void slotRevertAllChanges(); void slotModified(); void slotRightButtonClicked(QListViewItem *, const QPoint &, int); void slotTagsSearchChanged(); --- trunk/extragear/graphics/digikam/libs/imageproperties/navigatebarwidget.cpp #619733:619734 @@ -1,9 +1,9 @@ /* ============================================================ - * Author: Gilles Caulier <caulier dot gilles at kdemail dot net> - * Date : 2005-07-07 + * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net> + * Date : 2005-07-07 * Description : A button bar to navigate between album items * - * Copyright 2005-2006 by Gilles Caulier + * Copyright 2005-2007 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -36,6 +36,7 @@ #include "imagepropertiessidebardb.h" #include "navigatebarwidget.h" +#include "navigatebarwidget.moc" namespace Digikam { @@ -51,8 +52,11 @@ prevButton = 0; nextButton = 0; lastButton = 0; + itemType = NavigateBarWidget::ItemCurrent; } + int itemType; + QPushButton *firstButton; QPushButton *prevButton; QPushButton *nextButton; @@ -116,24 +120,26 @@ void NavigateBarWidget::setFileName(QString filename) { - d->filename->setText( filename ); + d->filename->setText(filename); } QString NavigateBarWidget::getFileName() { - return ( d->filename->text() ); + return (d->filename->text()); } void NavigateBarWidget::setButtonsState(int itemType) { - if (itemType == ItemFirst) + d->itemType = itemType; + + if (d->itemType == ItemFirst) { d->firstButton->setEnabled(false); d->prevButton->setEnabled(false); d->nextButton->setEnabled(true); d->lastButton->setEnabled(true); } - else if (itemType == ItemLast) + else if (d->itemType == ItemLast) { d->firstButton->setEnabled(true); d->prevButton->setEnabled(true); @@ -149,6 +155,10 @@ } } +int NavigateBarWidget::getButtonsState() +{ + return (d->itemType); +} + } // namespace Digikam -#include "navigatebarwidget.moc" --- trunk/extragear/graphics/digikam/libs/imageproperties/navigatebarwidget.h #619733:619734 @@ -1,9 +1,9 @@ /* ============================================================ - * Author: Gilles Caulier <caulier dot gilles at kdemail dot net> - * Date : 2005-07-07 + * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net> + * Date : 2005-07-07 * Description : A button bar to navigate between album items * - * Copyright 2005-2006 by Gilles Caulier + * Copyright 2005-2007 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -56,6 +56,7 @@ void setFileName(QString filename=QString::null); QString getFileName(); void setButtonsState(int itemType); + int getButtonsState(); signals: @@ -66,8 +67,7 @@ private : - NavigateBarWidgetPriv* d; - + NavigateBarWidgetPriv* d; }; } // namespace Digikam _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |