digikam
advancedrenamedialog.h
Go to the documentation of this file.00001 /* ============================================================ 00002 * 00003 * This file is a part of digiKam project 00004 * http://www.digikam.org 00005 * 00006 * Date : 2009-09-14 00007 * Description : a rename dialog for the AdvancedRename utility 00008 * 00009 * Copyright (C) 2009 by Andi Clemens <andi dot clemens at gmx dot net> 00010 * 00011 * This program is free software; you can redistribute it 00012 * and/or modify it under the terms of the GNU General 00013 * Public License as published by the Free Software Foundation; 00014 * either version 2, or (at your option) 00015 * any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * ============================================================ */ 00023 00024 #ifndef ADVANCEDRENAMEDIALOG_H 00025 #define ADVANCEDRENAMEDIALOG_H 00026 00027 // Qt includes 00028 00029 #include <QList> 00030 #include <QPair> 00031 #include <QTreeWidgetItem> 00032 00033 // KDE includes 00034 00035 #include <kdialog.h> 00036 #include <kurl.h> 00037 00038 // Local includes 00039 00040 #include "imageinfo.h" 00041 00042 class QEvent; 00043 class QMoveEvent; 00044 class QString; 00045 class QTreeWidget; 00046 00047 namespace Digikam 00048 { 00049 00050 class AdvancedRenameListItemPriv; 00051 00052 class AdvancedRenameListItem : public QTreeWidgetItem 00053 { 00054 public: 00055 00056 enum Column 00057 { 00058 OldName = 0, 00059 NewName 00060 }; 00061 00062 public: 00063 00064 AdvancedRenameListItem(QTreeWidget* view); 00065 AdvancedRenameListItem(QTreeWidget* view, const KUrl& info); 00066 virtual ~AdvancedRenameListItem(); 00067 00068 void setImageUrl(const KUrl& url); 00069 KUrl imageUrl() const; 00070 00071 void setName(const QString& name, bool check = true); 00072 QString name() const; 00073 00074 void setNewName(const QString& name, bool check = true); 00075 QString newName() const; 00076 00077 void markInvalid(bool invalid); 00078 bool isInvalid(); 00079 00080 private: 00081 00082 AdvancedRenameListItemPriv* const d; 00083 }; 00084 00085 // -------------------------------------------------------- 00086 00087 typedef QPair<KUrl, QString> NewNameInfo; 00088 typedef QList<NewNameInfo> NewNamesList; 00089 00090 class AdvancedRenameDialogPriv; 00091 00092 class AdvancedRenameDialog : public KDialog 00093 { 00094 Q_OBJECT 00095 00096 public: 00097 00098 AdvancedRenameDialog(QWidget* parent = 0); 00099 ~AdvancedRenameDialog(); 00100 00101 NewNamesList newNames(); 00102 00103 Q_SIGNALS: 00104 00105 void signalWindowHasMoved(); 00106 void signalWindowLostFocus(); 00107 00108 public Q_SLOTS: 00109 00110 void slotAddImages(const KUrl::List& urls); 00111 00112 protected: 00113 00114 void moveEvent(QMoveEvent* e); 00115 bool event(QEvent* e); 00116 00117 private Q_SLOTS: 00118 00119 void slotParseStringChanged(const QString&); 00120 void slotReturnPressed(); 00121 00122 private: 00123 00124 void initDialog(int count = 1); 00125 void readSettings(); 00126 void writeSettings(); 00127 bool checkNewNames(); 00128 00129 private: 00130 00131 AdvancedRenameDialogPriv* const d; 00132 }; 00133 00134 } // namespace Digikam 00135 00136 #endif /* ADVANCEDRENAMEDIALOG_H */
KDE 4.4 API Reference