Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 765d3af5 authored by Christoph Cullmann's avatar Christoph Cullmann

GIT_SILENT: application of coding style

parent 4843e887
......@@ -23,7 +23,10 @@
#include <QVector>
#include <KTextEditor/Plugin>
namespace KTextEditor { class View; }
namespace KTextEditor
{
class View;
}
class KateExternalToolsMenuAction;
class KateExternalToolsPluginView;
......@@ -36,7 +39,7 @@ class KateExternalToolsPlugin : public KTextEditor::Plugin
Q_OBJECT
public:
explicit KateExternalToolsPlugin(QObject* parent = nullptr, const QList<QVariant>& = QList<QVariant>());
explicit KateExternalToolsPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
virtual ~KateExternalToolsPlugin();
/**
......@@ -47,12 +50,12 @@ public:
/**
* Reimplemented to return the KateExternalToolConfigWidget for number==0.
*/
KTextEditor::ConfigPage* configPage(int number = 0, QWidget* parent = nullptr) override;
KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override;
/**
* Reimplemented to instanciate a PluginView for each MainWindow.
*/
QObject* createView(KTextEditor::MainWindow* mainWindow) override;
QObject *createView(KTextEditor::MainWindow *mainWindow) override;
/**
* Reloads the external tools from disk.
......@@ -69,17 +72,17 @@ public:
/**
* Returns the KateExternalTool for a specific command line command 'cmd.
*/
const KateExternalTool* toolForCommand(const QString& cmd) const;
const KateExternalTool *toolForCommand(const QString &cmd) const;
/**
* Returns a list of all existing external tools.
*/
const QVector<KateExternalTool*> & tools() const;
const QVector<KateExternalTool *> &tools() const;
/**
* Executes the tool based on the view as current document.
*/
void runTool(const KateExternalTool& tool, KTextEditor::View* view);
void runTool(const KateExternalTool &tool, KTextEditor::View *view);
Q_SIGNALS:
/**
......@@ -93,29 +96,31 @@ public:
/**
* Called by the KateExternalToolsPluginView to register itself.
*/
void registerPluginView(KateExternalToolsPluginView * view);
void registerPluginView(KateExternalToolsPluginView *view);
/**
* Called by the KateExternalToolsPluginView to unregister itself.
*/
void unregisterPluginView(KateExternalToolsPluginView * view);
void unregisterPluginView(KateExternalToolsPluginView *view);
/**
* Returns the KateExternalToolsPluginView for the given mainWindow.
*/
KateExternalToolsPluginView* viewForMainWindow(KTextEditor::MainWindow* mainWindow) const;
KateExternalToolsPluginView *viewForMainWindow(KTextEditor::MainWindow *mainWindow) const;
private:
QVector<KateExternalToolsPluginView*> m_views;
QVector<KateExternalTool*> m_tools;
QVector<KateExternalToolsPluginView *> m_views;
QVector<KateExternalTool *> m_tools;
QStringList m_commands;
KateExternalToolsCommand* m_command = nullptr;
private Q_SLOT:
/**
* Called whenever an external tool is done.
*/
void handleToolFinished(KateToolRunner* runner, int exitCode, bool crashed);
KateExternalToolsCommand *m_command = nullptr;
private
Q_SLOT :
/**
* Called whenever an external tool is done.
*/
void
handleToolFinished(KateToolRunner *runner, int exitCode, bool crashed);
};
#endif
......
......@@ -47,15 +47,7 @@ public:
/**
* Defines where to redirect stdout from the tool.
*/
enum class OutputMode {
Ignore,
InsertAtCursor,
ReplaceSelectedText,
ReplaceCurrentDocument,
AppendToCurrentDocument,
InsertInNewDocument,
DisplayInPane
};
enum class OutputMode { Ignore, InsertAtCursor, ReplaceSelectedText, ReplaceCurrentDocument, AppendToCurrentDocument, InsertInNewDocument, DisplayInPane };
public:
/// The category used in the menu to categorize the tool.
......@@ -93,7 +85,7 @@ public:
/**
* @return true if mimetypes is empty, or the @p mimetype matches.
*/
bool matchesMimetype(const QString& mimetype) const;
bool matchesMimetype(const QString &mimetype) const;
/**
* @return true if "executable" exists and has the executable bit set, or is
......@@ -105,21 +97,21 @@ public:
/**
* Load tool data from the config group @p cg.
*/
void load(const KConfigGroup& cg);
void load(const KConfigGroup &cg);
/**
* Save tool data to the config group @p cg.
*/
void save(KConfigGroup& cg) const;
void save(KConfigGroup &cg) const;
};
/**
* Compares for equality. All fields have to match.
*/
bool operator==(const KateExternalTool & lhs, const KateExternalTool & rhs);
bool operator==(const KateExternalTool &lhs, const KateExternalTool &rhs);
// for use in QVariant (QAction::setData() and QAction::data())
Q_DECLARE_METATYPE(KateExternalTool*)
Q_DECLARE_METATYPE(KateExternalTool *)
#endif // KTEXTEDITOR_KATE_EXTERNALTOOL_H
......
......@@ -31,19 +31,18 @@ class KateExternalTool;
class KateExternalToolsCommand : public KTextEditor::Command
{
public:
KateExternalToolsCommand(KateExternalToolsPlugin* plugin);
KateExternalToolsCommand(KateExternalToolsPlugin *plugin);
virtual ~KateExternalToolsCommand() = default;
public:
bool exec(KTextEditor::View* view, const QString& cmd, QString& msg,
const KTextEditor::Range& range = KTextEditor::Range::invalid()) override;
bool help(KTextEditor::View* view, const QString& cmd, QString& msg) override;
bool exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) override;
bool help(KTextEditor::View *view, const QString &cmd, QString &msg) override;
private:
void runTool(KateExternalTool& tool, KTextEditor::View* view);
void runTool(KateExternalTool &tool, KTextEditor::View *view);
private:
KateExternalToolsPlugin* m_plugin;
KateExternalToolsPlugin *m_plugin;
};
#endif // KTEXTEDITOR_KATE_EXTERNALTOOLS_COMMAND_H
......
......@@ -45,7 +45,7 @@ class KateExternalToolsConfigWidget : public KTextEditor::ConfigPage, public Ui:
{
Q_OBJECT
public:
KateExternalToolsConfigWidget(QWidget* parent, KateExternalToolsPlugin* plugin);
KateExternalToolsConfigWidget(QWidget *parent, KateExternalToolsPlugin *plugin);
virtual ~KateExternalToolsConfigWidget();
QString name() const override;
......@@ -55,7 +55,10 @@ public:
public Q_SLOTS:
void apply() override;
void reset() override;
void defaults() override { reset(); }
void defaults() override
{
reset();
}
private Q_SLOTS:
void slotAddCategory();
......@@ -68,17 +71,17 @@ private Q_SLOTS:
* Helper to open the ToolDialog.
* Returns true, if the user clicked OK.
*/
bool editTool(KateExternalTool* tool);
bool editTool(KateExternalTool *tool);
/**
* Creates a new category or returns existing one.
*/
QStandardItem * addCategory(const QString & category);
QStandardItem *addCategory(const QString &category);
/**
* Returns the currently active category. The returned pointer is always valid.
*/
QStandardItem * currentCategory() const;
QStandardItem *currentCategory() const;
/**
* Clears the tools model.
......@@ -89,11 +92,11 @@ private:
QPixmap blankIcon();
private:
KConfig* m_config = nullptr;
KConfig *m_config = nullptr;
bool m_changed = false;
KateExternalToolsPlugin* m_plugin;
KateExternalToolsPlugin *m_plugin;
QStandardItemModel m_toolsModel;
QStandardItem * m_noCategory = nullptr;
QStandardItem *m_noCategory = nullptr;
};
/**
......@@ -104,7 +107,7 @@ class KateExternalToolServiceEditor : public QDialog
Q_OBJECT
public:
explicit KateExternalToolServiceEditor(KateExternalTool* tool = nullptr, QWidget* parent = nullptr);
explicit KateExternalToolServiceEditor(KateExternalTool *tool = nullptr, QWidget *parent = nullptr);
private Q_SLOTS:
/**
......@@ -118,10 +121,10 @@ private Q_SLOTS:
void showMTDlg();
public:
Ui::ToolDialog* ui;
Ui::ToolDialog *ui;
private:
KateExternalTool* m_tool;
KateExternalTool *m_tool;
};
#endif // KTEXTEDITOR_EXTERNALTOOLS_CONFIGWIDGET_H
......
......@@ -20,8 +20,14 @@
#ifndef KTEXTEDITOR_EXTERNALTOOLS_H
#define KTEXTEDITOR_EXTERNALTOOLS_H
namespace KTextEditor { class MainWindow; }
namespace KTextEditor { class View; }
namespace KTextEditor
{
class MainWindow;
}
namespace KTextEditor
{
class View;
}
#include <KActionMenu>
#include <KMacroExpander>
......@@ -33,12 +39,12 @@ class KActionCollection;
class KateExternalToolsPlugin;
class KateExternalTool;
namespace Ui { class ToolView; }
namespace Ui
{
class ToolView;
}
enum class ToolViewFocus {
OutputTab = 0,
StatusTab
};
enum class ToolViewFocus { OutputTab = 0, StatusTab };
/**
* Menu action that displays all KateExternalTool in a submenu.
......@@ -48,8 +54,7 @@ class KateExternalToolsMenuAction : public KActionMenu
{
Q_OBJECT
public:
KateExternalToolsMenuAction(const QString& text, KActionCollection* collection, KateExternalToolsPlugin* plugin,
class KTextEditor::MainWindow* mw = nullptr);
KateExternalToolsMenuAction(const QString &text, KActionCollection *collection, KateExternalToolsPlugin *plugin, class KTextEditor::MainWindow *mw = nullptr);
virtual ~KateExternalToolsMenuAction();
/**
......@@ -57,19 +62,22 @@ public:
*/
void reload();
KActionCollection* actionCollection() const { return m_actionCollection; }
KActionCollection *actionCollection() const
{
return m_actionCollection;
}
private Q_SLOTS:
/**
* Called whenever the current view changed.
* Required to enable/disable the tools that depend on specific mimetypes.
*/
void slotViewChanged(KTextEditor::View* view);
void slotViewChanged(KTextEditor::View *view);
private:
KateExternalToolsPlugin* m_plugin;
KTextEditor::MainWindow* m_mainwindow; // for the actions to access view/doc managers
KActionCollection* m_actionCollection;
KateExternalToolsPlugin *m_plugin;
KTextEditor::MainWindow *m_mainwindow; // for the actions to access view/doc managers
KActionCollection *m_actionCollection;
};
class KateExternalToolsPluginView : public QObject, public KXMLGUIClient
......@@ -80,7 +88,7 @@ public:
/**
* Constructor.
*/
KateExternalToolsPluginView(KTextEditor::MainWindow* mainWindow, KateExternalToolsPlugin* plugin);
KateExternalToolsPluginView(KTextEditor::MainWindow *mainWindow, KateExternalToolsPlugin *plugin);
/**
* Virtual destructor.
......@@ -90,7 +98,7 @@ public:
/**
* Returns the associated mainWindow
*/
KTextEditor::MainWindow* mainWindow() const;
KTextEditor::MainWindow *mainWindow() const;
public Q_SLOTS:
/**
......@@ -117,12 +125,12 @@ public Q_SLOTS:
* Shows the External Tools toolview and points the error message along with
* some more info about the tool.
*/
void addToolStatus(const QString& message);
void addToolStatus(const QString &message);
/**
* Sets the output data to data;
*/
void setOutputData(const QString& data);
void setOutputData(const QString &data);
/**
* Deletes the tool view, if existing.
......@@ -130,13 +138,13 @@ public Q_SLOTS:
void deleteToolView();
private:
KateExternalToolsPlugin* m_plugin;
KTextEditor::MainWindow* m_mainWindow;
KateExternalToolsMenuAction* m_externalToolsMenu = nullptr;
QWidget* m_toolView = nullptr;
Ui::ToolView* m_ui = nullptr;
QTextDocument* m_outputDoc = nullptr;
QTextDocument* m_statusDoc = nullptr;
KateExternalToolsPlugin *m_plugin;
KTextEditor::MainWindow *m_mainWindow;
KateExternalToolsMenuAction *m_externalToolsMenu = nullptr;
QWidget *m_toolView = nullptr;
Ui::ToolView *m_ui = nullptr;
QTextDocument *m_outputDoc = nullptr;
QTextDocument *m_statusDoc = nullptr;
};
#endif // KTEXTEDITOR_EXTERNALTOOLS_H
......
......@@ -31,8 +31,9 @@
class KateExternalTool;
class QProcess;
namespace KTextEditor {
class View;
namespace KTextEditor
{
class View;
}
/**
......@@ -47,10 +48,10 @@ public:
* Constructor that will run @p tool in the run() method.
* The @p view can later be retrieved again with view() to process the data when the tool is finished.
*/
KateToolRunner(std::unique_ptr<KateExternalTool> tool, KTextEditor::View * view, QObject* parent = nullptr);
KateToolRunner(std::unique_ptr<KateExternalTool> tool, KTextEditor::View *view, QObject *parent = nullptr);
KateToolRunner(const KateToolRunner&) = delete;
void operator=(const KateToolRunner&) = delete;
KateToolRunner(const KateToolRunner &) = delete;
void operator=(const KateToolRunner &) = delete;
~KateToolRunner();
......@@ -58,12 +59,12 @@ public:
* Returns the view that was active when running the tool.
* @warning May be a nullptr, since the view could have been closed in the meantime.
*/
KTextEditor::View* view() const;
KTextEditor::View *view() const;
/**
* Returns the tool that was passed in the constructor.
*/
KateExternalTool* tool() const;
KateExternalTool *tool() const;
/**
* Starts a child process that executes the tool.
......@@ -90,7 +91,7 @@ Q_SIGNALS:
/**
* This signal is emitted when the tool is finished.
*/
void toolFinished(KateToolRunner* runner, int exitCode, bool crashed);
void toolFinished(KateToolRunner *runner, int exitCode, bool crashed);
private:
//! Use QPointer here, since the View may be closed in the meantime.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment