digikam
advancedrenameinput.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-03 00007 * Description : an input widget 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 ADVANCEDRENAMEINPUT_H 00025 #define ADVANCEDRENAMEINPUT_H 00026 00027 // Qt includes 00028 00029 #include <QWidget> 00030 00031 // KDE includes 00032 00033 #include <kcombobox.h> 00034 #include <ktextedit.h> 00035 00036 // Local includes 00037 00038 #include "comboboxutilities.h" 00039 #include "parser.h" 00040 00041 class QMouseEvent; 00042 class QFocusEvent; 00043 class QKeyEvent; 00044 00045 namespace Digikam 00046 { 00047 00048 class AdvancedRenameLineEditProxy : public ProxyLineEdit 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 00054 AdvancedRenameLineEditProxy(QWidget* parent); 00055 virtual void setWidget(QWidget *widget); 00056 00057 protected: 00058 00059 virtual void mousePressEvent(QMouseEvent* event); 00060 virtual void mouseReleaseEvent(QMouseEvent* event); 00061 }; 00062 00063 // -------------------------------------------------------- 00064 00065 class AdvancedRenameLineEditPriv; 00066 00067 class AdvancedRenameLineEdit : public KTextEdit 00068 { 00069 Q_OBJECT 00070 00071 public: 00072 00073 AdvancedRenameLineEdit(QWidget* parent = 0); 00074 ~AdvancedRenameLineEdit(); 00075 00076 void setParser(Parser* parser); 00077 Parser* parser(); 00078 00079 public Q_SLOTS: 00080 00081 void slotSetHistoryItem(const QString&); 00082 void slotCursorPositionChanged(); 00083 00084 Q_SIGNALS: 00085 00086 void signalTextChanged(const QString&); 00087 void signalTokenMarked(bool); 00088 void signalReturnPressed(); 00089 00090 protected: 00091 00092 virtual void keyPressEvent(QKeyEvent* e); 00093 virtual void wheelEvent(QWheelEvent* e); 00094 virtual void scrollContentsBy(int dx, int dy); 00095 00096 private Q_SLOTS: 00097 00098 void slotTextChanged(); 00099 void slotParseTimer(); 00100 00101 private: 00102 00103 AdvancedRenameLineEditPriv* const d; 00104 }; 00105 00106 // -------------------------------------------------------- 00107 00108 class AdvancedRenameInputPriv; 00109 00110 class AdvancedRenameInput : public KComboBox 00111 { 00112 Q_OBJECT 00113 00114 public: 00115 00116 AdvancedRenameInput(QWidget* parent = 0); 00117 ~AdvancedRenameInput(); 00118 00119 void setParser(Parser* parser); 00120 00121 QString text() const; 00122 void setText(const QString& text); 00123 00124 Q_SIGNALS: 00125 00126 void signalTextChanged(const QString&); 00127 void signalTokenMarked(bool); 00128 void signalReturnPressed(); 00129 00130 public Q_SLOTS: 00131 00132 void slotAddToken(const QString&); 00133 void clearText(); 00134 void clearTextAndHistory(); 00135 00136 private: 00137 00138 void readSettings(); 00139 void writeSettings(); 00140 00141 private: 00142 00143 AdvancedRenameInputPriv* const d; 00144 }; 00145 00146 } // namespace Digikam 00147 00148 #endif /* ADVANCEDRENAMEINPUT_H */
KDE 4.4 API Reference