"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/krenameimpl.h" between
krename-4.0.9.tar.gz and krename-4.90.90.tar.gz

About: KRename is a batch file-renamer (KDE).

krenameimpl.h  (krename-4.0.9):krenameimpl.h  (krename-4.90.90)
skipping to change at line 22 skipping to change at line 22
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef KRENAMEIMPL_H #ifndef KRENAMEIMPL_H
#define KRENAMEIMPL_H #define KRENAMEIMPL_H
#include <QObject> #include <QObject>
#include <QMutex>
#include <kurl.h> #include <QUrl>
#include <KSharedConfig>
#include "batchrenamer.h" #include "batchrenamer.h"
#include "krenamefile.h" #include "krenamefile.h"
class KRenameModel; class KRenameModel;
class KRenamePreviewModel; class KRenamePreviewModel;
class KRenameWindow; class KRenameWindow;
class ThreadedLister; class ThreadedLister;
class PluginLoader; class PluginLoader;
class QLineEdit; class QLineEdit;
class QCommandLineParser;
class KRenameImpl : public QObject { class KRenameImpl : public QObject
{
Q_OBJECT Q_OBJECT
public: public:
~KRenameImpl(); ~KRenameImpl();
static QWidget* launch( const QRect & rect, const KRenameFile::List & list, bool loadprofile = true ); static QWidget *launch(const QRect &rect, const KRenameFile::List &list, QCo mmandLineParser *commandLine = 0);
public slots: public Q_SLOTS:
/** Updates the preview of the filenames after renaming /** Updates the preview of the filenames after renaming
*/ */
void slotUpdatePreview(); void slotUpdatePreview();
private: private:
KRenameImpl( KRenameWindow* window, const KRenameFile::List & list ); KRenameImpl(KRenameWindow *window, const KRenameFile::List &list , QCommandL
ineParser *commandLine = 0);
/** Creates all menu items and actions.
*/
void setupActions();
/** Connect all gui components with their slots /** Connect all gui components with their slots
*/ */
void setupSlots(); void setupSlots();
/** Adds a single url to the list of files which will /** Adds a single url to the list of files which will
* be renamed. * be renamed.
* *
* If you have a KUrl::List use addFilesOrDirs which is * If you have a QList<QUrl> use addFilesOrDirs which is
* faster. * faster.
* *
* \param url must be an existing file or directory. * \param url must be an existing file or directory.
* *
* \see addFilesOrDirs * \see addFilesOrDirs
*/ */
void addFileOrDir( const KUrl & url ); void addFileOrDir(const QUrl &url);
/** Adds a list of urls to the list of files which will /** Adds a list of urls to the list of files which will
* be renamed. * be renamed.
* *
* Adding a whole list is much faster than adding single * Adding a whole list is much faster than adding single
* files. * files.
* *
* \param list of existing files or directories * \param list of existing files or directories
* \param filter only add files or directories matching this filter * \param filter only add files or directories matching this filter
* \param recursively if true all directories will be added recursively * \param recursively if true all directories will be added recursively
* \param dirsWithFiles add directory names along with their contents * \param dirsWithFiles add directory names along with their contents
* \param dirsOnly add only directories and no files * \param dirsOnly add only directories and no files
* \param hidden add also hidden files and directories * \param hidden add also hidden files and directories
* *
* \see addFileOrDir * \see addFileOrDir
*/ */
void addFilesOrDirs( const KUrl::List & list, const QString & filter = "*", void addFilesOrDirs(const QList<QUrl> &list, const QString &filter = "*",
bool recursively = false, bool dirsWithFiles = false, bool recursively = false, bool dirsWithFiles = false,
bool dirsOnly = false, bool hidden = false ); bool dirsOnly = false, bool hidden = false);
/** Parses commandline options /** Parses commandline options
*/ */
void parseCmdLineOptions(); void parseCmdLineOptions(QCommandLineParser *parser);
/** Load configuration /** Load configuration
*/ */
void loadConfig(); void loadConfig();
private slots: private Q_SLOTS:
/** Save configuration /** Save configuration
*/ */
void saveConfig(); void saveConfig();
/** Start KRename's selftest: /** Start KRename's selftest:
* I.e several unit tests. * I.e several unit tests.
*/ */
void selfTest(); void selfTest();
/** Called when the user clicks the "Add..." button. /** Called when the user clicks the "Add..." button.
skipping to change at line 158 skipping to change at line 157
/** Start the actual renaming /** Start the actual renaming
* with the current settings * with the current settings
*/ */
void slotStart(); void slotStart();
/** Clean's up and deletes the lister after he has done /** Clean's up and deletes the lister after he has done
* all his work. * all his work.
* *
* \param lister a ThreadedLister which has done his work * \param lister a ThreadedLister which has done his work
*/ */
void slotListerDone( ThreadedLister* lister ); void slotListerDone(ThreadedLister *lister);
/** Show a TokenHelpDialog that works on a QLineEdit /** Show a TokenHelpDialog that works on a QLineEdit
* *
* \param edit insert user selected tokens into this linedit * \param edit insert user selected tokens into this linedit
*/ */
void slotTokenHelpDialog(QLineEdit* edit); void slotTokenHelpDialog(QLineEdit *edit);
/** Called when the user selects another extension split mode /** Called when the user selects another extension split mode
* *
* @param splitMode the mode which is used to split filename and extension * @param splitMode the mode which is used to split filename and extension
* @param dot the n-th dot to use for splitting if splitMode = eSplitMode_C ustomDot * @param dot the n-th dot to use for splitting if splitMode = eSplitMode_C ustomDot
*/ */
void slotExtensionSplitModeChanged( ESplitMode splitMode, int dot ); void slotExtensionSplitModeChanged(ESplitMode splitMode, int dot);
private: private:
KRenameWindow* m_window; KRenameWindow *m_window;
KRenameModel* m_model; KRenameModel *m_model;
KRenamePreviewModel* m_previewModel; KRenamePreviewModel *m_previewModel;
KRenameFile::List m_vector; KRenameFile::List m_vector;
BatchRenamer m_renamer; BatchRenamer m_renamer;
ESplitMode m_lastSplitMode; ///< The last used split mode ESplitMode m_lastSplitMode; ///< The last used split mode
int m_lastDot; ///< The last used dot value for spli tmode int m_lastDot; ///< The last used dot value for spli tmode
PluginLoader* m_pluginLoader; ///< Global plugin loader instance PluginLoader *m_pluginLoader; ///< Global plugin loader instance
int m_runningThreadedListersCount; ///< Count of running t hreaded listers int m_runningThreadedListersCount; ///< Count of running t hreaded listers
}; };
#if 0 #if 0
// Own includes // Own includes
/* /*
#include "batchrenamer.h" #include "batchrenamer.h"
#include "krenamedcop.h" #include "krenamedcop.h"
*/ */
class HelpDialog; class HelpDialog;
class HelpDialogData; class HelpDialogData;
class KAction; class KAction;
class KComboBox; class KComboBox;
class KJanusWidget; class KJanusWidget;
class KMyHistoryCombo; class KMyHistoryCombo;
class KMyListBox; class KMyListBox;
class KMyListView; class KMyListView;
class KMenuBar; class KMenuBar;
class KPopupMenu; class KPopupMenu;
class KPushButton; class QPushButton;
class KToggleAction;
class KURL; class KURL;
class KURLRequester; class KURLRequester;
class KIntNumInput; class KIntNumInput;
class MyHelpCombo; class MyHelpCombo;
class MyLabel;
class Plugin; class Plugin;
class PluginLoader; class PluginLoader;
class QButtonGroup; class QButtonGroup;
class QCheckBox; class QCheckBox;
class QGroupBox; class QGroupBox;
class QFileInfo; class QFileInfo;
class QFrame;
class QHBoxLayout; class QHBoxLayout;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
class QListView;
class QPushButton; class QPushButton;
class QRect; class QRect;
class QWidgetStack; class QWidgetStack;
class QRadioButton; class QRadioButton;
class QVBoxLayout; class QVBoxLayout;
class QVGroupBox; class QVGroupBox;
class QWidget; class QWidget;
#include <kguiitem.h> #include <kguiitem.h>
KPushButton* createButton( KGuiItem item, QWidget* parent ); QPushButton *createButton(KGuiItem item, QWidget *parent);
class KRenameImpl : public QObject, public KRenameDCOP { class KRenameImpl : public QObject, public KRenameDCOP
{
Q_OBJECT Q_OBJECT
friend class ProfileManager; friend class ProfileManager;
friend class ProfileDlg; friend class ProfileDlg;
friend class tabs; friend class tabs;
public: public:
KRenameImpl( QWidget* p, KMenuBar* m, QPushButton* finish ); KRenameImpl(QWidget *p, KMenuBar *m, QPushButton *finish);
~KRenameImpl(); ~KRenameImpl();
void setWizardMode( bool mode ); void setWizardMode(bool mode);
/* /*
* public because both get called from KRenameImpl::launch() * public because both get called from KRenameImpl::launch()
*/ */
void updatePre(); void updatePre();
void addFileOrDir( const KURL & name ); void addFileOrDir(const KURL &name);
void setup( bool wizardmode ); void setup(bool wizardmode);
void changeParent( QWidget* p, KMenuBar* m, QPushButton* finish, QRect r void changeParent(QWidget *p, KMenuBar *m, QPushButton *finish, QRect r);
); static QWidget *launch(QRect rect, const KURL::List &list, KRenameImpl *impl
static QWidget* launch( QRect rect, const KURL::List & list, KRenameImpl = 0, bool loadprofile = true);
* impl = 0, bool loadprofile = true );
/** DCOP functions we have to implement
/** DCOP functions we have to implement */
*/ void addFileOrDir(const QString &name);
void addFileOrDir( const QString & name ); const QString fileNameTemplate() const;
const QString fileNameTemplate() const; inline int counterStart() const;
inline int counterStart() const;
void setExtensionTemplate(const QString &t);
void setExtensionTemplate( const QString & t ); const QString extensionTemplate() const;
const QString extensionTemplate() const;
void setUseExtension(bool b);
void setUseExtension( bool b ); bool useExtension() const;
bool useExtension() const;
QStringList tokens() const;
QStringList tokens() const;
QString parseString(const QString &token, const QString &string);
QString parseString( const QString & token, const QString & string ); void addDir(const QString &name, const QString &filter, bool recursive, bool
void addDir( const QString & name, const QString & filter, bool recursiv hidden, bool dirnames);
e, bool hidden, bool dirnames );
const QString title(int index) const;
const QString title( int index ) const;
/** @returns true if the user has specified a profile on the commandline
/** @returns true if the user has specified a profile on the commandline * other wise false is returned
* other wise false is returned */
*/ inline bool hasCommandlineProfile() const;
inline bool hasCommandlineProfile() const;
public Q_SLOTS:
public slots: void setFileNameTemplate(const QString &t);
void setFileNameTemplate( const QString & t ); void setCounterStart(int index);
void setCounterStart( int index );
Q_SIGNALS:
signals: void pageDone(QWidget *page, const QString &title);
void pageDone( QWidget* page, const QString & title ); void showPage(int page);
void showPage( int page ); void enableFinish(bool b);
void enableFinish( bool b );
private Q_SLOTS:
private slots: void about();
void about(); void addFile();
void addFile(); bool checkErrors();
bool checkErrors(); void clearList();
void clearList(); void enableControls();
void enableControls(); void toggleImagePreview();
void toggleImagePreview(); void moveUp();
void moveUp(); void moveDown();
void moveDown(); void help();
void help(); void removeFile();
void removeFile(); void removeFile(int index);
void removeFile( int index ); void preferences();
void preferences(); void replace();
void replace(); void saveConfig();
void saveConfig(); void start();
void start(); void updateCount();
void updateCount(); void undo();
void undo(); void changeUndoScriptName();
void changeUndoScriptName(); void pluginHelpChanged();
void pluginHelpChanged(); void getCoordinates();
void getCoordinates(); void changeNumbers();
void changeNumbers(); void updateDots();
void updateDots(); void updatePreview();
void updatePreview(); void showTokenHelp();
void showTokenHelp(); void toggleName();
void toggleName(); void changed();
void changed(); void loadFilePlugins();
void loadFilePlugins(); void reloadFilePluginData();
void reloadFilePluginData(); void manageProfiles();
void manageProfiles(); QString easyOptions(KComboBox *combo, KMyHistoryCombo *custom);
QString easyOptions( KComboBox* combo, KMyHistoryCombo* custom ); void slotEasy1();
void slotEasy1(); void slotEasy2();
void slotEasy2(); void slotEasy3();
void slotEasy3(); void slotEasy4();
void slotEasy4();
/** Update the preview only if the passed
/** Update the preview only if the passed * plugin is enabled for use.
* plugin is enabled for use. */
*/ void updatePluginPreview(Plugin *p);
void updatePluginPreview( Plugin* p );
private:
private: static int numRealTimePreview;
static int numRealTimePreview;
/** Change the GUI mode according to the current setting of m_wizard
/** Change the GUI mode according to the current setting of m_wizard */
*/ void changeGUIMode();
void changeGUIMode();
/** Returns COPY if optionCopy is checked, RENAME if optionRename is checked
/** Returns COPY if optionCopy is checked, RENAME if optionRename is che * ...
cked */
* ... int currentRenameMode();
*/
int currentRenameMode(); void loadConfig();
void fillStructures(BatchRenamer *b, bool preview);
void loadConfig(); bool setupBatchRenamer(BatchRenamer *b, bool preview);
void fillStructures( BatchRenamer* b, bool preview ); void splitFilename(QFileInfo *fi, QString *base, QString *extension);
bool setupBatchRenamer( BatchRenamer* b, bool preview );
void splitFilename( QFileInfo* fi, QString* base, QString* extension ); void setupPage1();
void setupPage2();
void setupActions(); void setupPage3();
void setupPage1(); void setupPage4();
void setupPage2(); void setupTab1();
void setupPage3(); void setupFileTab1();
void setupPage4(); void setupFileTab2();
void setupTab1(); void setupPages();
void setupFileTab1(); void updateHist();
void setupFileTab2(); void parseCommandline();
void setupPages(); void addTitle(QWidget *p, QVBoxLayout *layout, QString title);
void updateHist();
void parseCommandline(); QValueList<manualchanges> changes;
void addTitle( QWidget* p, QVBoxLayout* layout, QString title ); void refreshColumnMode();
void parseWizardMode();
QValueList<manualchanges> changes; void getHelpDialogString(QLineEdit *edit);
void refreshColumnMode();
void parseWizardMode(); protected:
void getHelpDialogString( QLineEdit* edit ); QWidget *parent;
KMenuBar *menuBar;
protected: KPopupMenu *mnuSort;
QWidget* parent; KAction *loadPlugins;
KMenuBar* menuBar;
KPopupMenu* mnuSort; QPushButton *finishButton;
KAction* loadPlugins;
PluginLoader *plugin;
QPushButton* finishButton;
QWidgetStack *fileTab;
PluginLoader* plugin;
QWidget *page_1;
QWidgetStack* fileTab; QWidget *page_2;
KJanusWidget *page_3;
QWidget* page_1; QWidget *page_4;
QWidget* page_2;
KJanusWidget* page_3; bool m_wizard;
QWidget* page_4; bool m_loadplugins;
bool m_switching;
bool m_wizard; bool m_autosize;
bool m_loadplugins; int m_hist;
bool m_switching; int m_index;
bool m_autosize; int m_step;
int m_hist; bool m_reset;
int m_index;
int m_step; bool m_hasCommandlineProfile;
bool m_reset;
QPushButton *buttonUp;
bool m_hasCommandlineProfile; QPushButton *buttonDown;
QPushButton *buttonUp2;
KPushButton* buttonUp; QPushButton *buttonDown2;
KPushButton* buttonDown; QPushButton *buttonAdd;
KPushButton* buttonUp2; QPushButton *buttonRemove;
KPushButton* buttonDown2; QPushButton *buttonRemoveAll;
KPushButton* buttonAdd; QPushButton *buttonReplace;
KPushButton* buttonRemove; QPushButton *buttonEasyReplace;
KPushButton* buttonRemoveAll; QPushButton *buttonHelp;
KPushButton* buttonReplace; QPushButton *buttonMove;
KPushButton* buttonEasyReplace; QPushButton *buttonCoord;
KPushButton* buttonHelp; QPushButton *buttonNumber;
KPushButton* buttonMove;
KPushButton* buttonCoord; QPushButton *buttonEasy1;
KPushButton* buttonNumber; QPushButton *buttonEasy2;
QPushButton *buttonEasy3;
KPushButton* buttonEasy1; QPushButton *buttonEasy4;
KPushButton* buttonEasy2; KComboBox *comboSort;
KPushButton* buttonEasy3;
KPushButton* buttonEasy4; QLabel *description;
KComboBox* comboSort; QLabel *description2;
QLabel *description3;
QLabel* description; QLabel *description4;
QLabel* description2;
QLabel* description3; QLabel *labelTemplate;
QLabel* description4; QLabel *labelHelp;
QLabel *labelCount;
QLabel* labelTemplate; QLabel *labelPoint;
QLabel* labelHelp;
QLabel* labelCount; KMyListBox *fileList;
QLabel* labelPoint; KMyListView *preview;
QButtonGroup *groupOptions;
KMyListBox* fileList;
KMyListView* preview; QRadioButton *optionCopy;
QButtonGroup* groupOptions; QRadioButton *optionMove;
QRadioButton *optionRename;
QRadioButton* optionCopy; QRadioButton *optionLink;
QRadioButton* optionMove;
QRadioButton* optionRename; QGroupBox *groupExtension;
QRadioButton* optionLink; QVGroupBox *groupUndo;
QGroupBox* groupExtension; KMyHistoryCombo *dirname;
QVGroupBox* groupUndo; KURLRequester *urlrequester;
KURLRequester *undorequester;
KMyHistoryCombo* dirname; KMyHistoryCombo *filename;
KURLRequester* urlrequester; KMyHistoryCombo *extemplate;
KURLRequester* undorequester;
KMyHistoryCombo* filename; QCheckBox *checkName;
KMyHistoryCombo* extemplate; QCheckBox *checkExtension;
QCheckBox *checkOverwrite;
QCheckBox* checkName; QCheckBox *checkPreview;
QCheckBox* checkExtension; QCheckBox *checkUndoScript;
QCheckBox* checkOverwrite;
QCheckBox* checkPreview; KComboBox *comboExtension;
QCheckBox* checkUndoScript;
MyHelpCombo *comboHelp;
KComboBox* comboExtension; HelpDialog *helpDialog;
HelpDialogData *helpDialogData;
MyHelpCombo* comboHelp;
HelpDialog* helpDialog; BatchRenamer *b;
HelpDialogData* helpDialogData; QValueList<int> skip;
QValueList<replacestrings> rep;
BatchRenamer* b;
QValueList<int> skip; // ==========
QValueList<replacestrings> rep; // Easy mode:
// ==========
// ==========
// Easy mode: KComboBox *comboKRenamePrefix;
// ========== KComboBox *comboKRenameSuffix;
KComboBox *comboKRenameFilename;
KComboBox* comboKRenamePrefix; KComboBox *comboKRenameExtension;
KComboBox* comboKRenameSuffix;
KComboBox* comboKRenameFilename; KMyHistoryCombo *comboPrefix;
KComboBox* comboKRenameExtension; KMyHistoryCombo *comboSuffix;
KMyHistoryCombo *comboCustom;
KMyHistoryCombo* comboPrefix; KMyHistoryCombo *comboCustomExtension;
KMyHistoryCombo* comboSuffix;
KMyHistoryCombo* comboCustom; KIntNumInput *spinStart;
KMyHistoryCombo* comboCustomExtension; KIntNumInput *spinNull;
KIntNumInput* spinStart; // ===========
KIntNumInput* spinNull; // Layout:
// ===========
// ===========
// Layout: QHBoxLayout *pageLayout;
// =========== QVBoxLayout *pageLayout_2;
QVBoxLayout *pageLayout_3;
QHBoxLayout* pageLayout; QVBoxLayout *pageLayout_4;
QVBoxLayout* pageLayout_2;
QVBoxLayout* pageLayout_3; QHBoxLayout *tabLayout_0;
QVBoxLayout* pageLayout_4; QHBoxLayout *tabLayout_1;
QHBoxLayout *tabLayout_2;
QHBoxLayout* tabLayout_0; QVBoxLayout *tabLayout_3;
QHBoxLayout* tabLayout_1; QVBoxLayout *groupAdvancedExtensionLayout;
QHBoxLayout* tabLayout_2; QVBoxLayout *groupOptionsLayout;
QVBoxLayout* tabLayout_3; QHBoxLayout *groupDirLayout;
QVBoxLayout* groupAdvancedExtensionLayout; QVBoxLayout *groupNumberLayout;
QVBoxLayout* groupOptionsLayout; QHBoxLayout *groupExtensionLayout;
QHBoxLayout* groupDirLayout;
QVBoxLayout* groupNumberLayout; // page1
QHBoxLayout* groupExtensionLayout; QHBoxLayout *Layout2;
QVBoxLayout *Layout3;
// page1 QHBoxLayout *Layout4;
QHBoxLayout* Layout2; QVBoxLayout *Layout5;
QVBoxLayout* Layout3;
QHBoxLayout* Layout4; // page4
QVBoxLayout* Layout5; QVBoxLayout *Layout10;
QHBoxLayout *Layout15;
// page4 QVBoxLayout *Layout16;
QVBoxLayout* Layout10; QHBoxLayout *Layout22;
QHBoxLayout* Layout15; QVBoxLayout *Layout23;
QVBoxLayout* Layout16;
QHBoxLayout* Layout22; // tab
QVBoxLayout* Layout23; QHBoxLayout *Layout100;
QHBoxLayout *Layout101;
// tab
QHBoxLayout* Layout100;
QHBoxLayout* Layout101;
}; };
int KRenameImpl::counterStart() const int KRenameImpl::counterStart() const
{ {
return m_index; return m_index;
} }
bool KRenameImpl::hasCommandlineProfile() const bool KRenameImpl::hasCommandlineProfile() const
{ {
return m_hasCommandlineProfile; return m_hasCommandlineProfile;
 End of changes. 25 change blocks. 
307 lines changed or deleted 301 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)