1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/***************************************************************************
* Copyright 1999-2001 by Bernd Gehrmann *
* bernd@kdevelop.org *
* Copyright 2010 Julien Desgats <julien.desgats@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KDEVPLATFORM_PLUGIN_GREPVIEWPLUGIN_H
#define KDEVPLATFORM_PLUGIN_GREPVIEWPLUGIN_H
#include <interfaces/iplugin.h>
#include <QVector>
#include <QPointer>
#include <QVariant>
class KJob;
class GrepDialog;
class GrepJob;
class GrepOutputViewFactory;
class GrepViewPlugin : public KDevelop::IPlugin
{
Q_OBJECT
Q_CLASSINFO( "D-Bus Interface", "org.kdevelop.GrepViewPlugin" )
public:
explicit GrepViewPlugin( QObject *parent, const QVariantList & = QVariantList() );
~GrepViewPlugin() override;
void unload() override;
void rememberSearchDirectory(QString const & directory);
KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override;
void showDialog(bool setLastUsed = false, const QString& pattern = QString(), bool show = true);
/**
* Returns a new instance of GrepJob. Since the plugin supports only one job at the same time,
* previous job, if any, is killed before creating a new job.
*/
GrepJob *newGrepJob();
GrepJob *grepJob();
GrepOutputViewFactory* toolViewFactory() const;
public Q_SLOTS:
///@param pattern the pattern to search
///@param directory the directory, or a semicolon-separated list of files
///@param show whether the search dialog should be shown. if false,
/// the parameters of the last search will be used.
Q_SCRIPTABLE void startSearch(const QString& pattern, const QString& directory, bool show);
Q_SIGNALS:
void grepJobFinished(bool success);
private Q_SLOTS:
void showDialogFromMenu();
void showDialogFromProject();
void jobFinished(KJob *job);
private:
GrepJob *m_currentJob;
QVector<QPointer<GrepDialog>> m_currentDialogs;
QString m_directory;
QString m_contextMenuDirectory;
GrepOutputViewFactory* m_factory;
};
#endif
|