File indexing completed on 2024-03-24 04:38:28
0001 /*************************************************************************** 0002 * Copyright 2007 Niko Sams <niko.sams@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 ***************************************************************************/ 0010 0011 #ifndef KDEVUPLOADPLUGIN_H 0012 #define KDEVUPLOADPLUGIN_H 0013 0014 #include <QList> 0015 #include <QtCore/QVariant> 0016 0017 #include <interfaces/iplugin.h> 0018 0019 class QSignalMapper; 0020 class QStandardItemModel; 0021 class KActionMenu; 0022 class QAction; 0023 namespace KDevelop { 0024 class ProjectBaseItem; 0025 class IProject; 0026 class IDocument; 0027 } 0028 class UploadProfileModel; 0029 class FilesTreeViewFactory; 0030 class AllProfilesModel; 0031 0032 class UploadPlugin : public KDevelop::IPlugin 0033 { 0034 Q_OBJECT 0035 public: 0036 UploadPlugin(QObject *parent, const QVariantList & = QVariantList() ); 0037 ~UploadPlugin() override; 0038 0039 /** 0040 * Returns the Upload-Action for the Contextmenu. 0041 */ 0042 KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override; 0043 0044 /** 0045 * Returns (and creates) the outputModel used for UploadPlugin. 0046 * Creates the output-view (only the first time called) 0047 */ 0048 QStandardItemModel* outputModel(); 0049 0050 int perProjectConfigPages() const override; 0051 KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override; 0052 0053 private Q_SLOTS: 0054 /** 0055 * Opens the UploadDialog with the previously selected file as root. 0056 * Executed from context-menu 0057 */ 0058 void upload(); 0059 0060 /** 0061 * Uploads the previously selected file without any futher actions needed by the user. 0062 * Executed from context-menu 0063 */ 0064 void quickUpload(); 0065 0066 /** 0067 * Opens the UploadDialog for the project. 0068 * Executed by the upload-action in the Project-menu 0069 */ 0070 void projectUpload(QObject* project); 0071 0072 void quickUploadCurrentFile(); 0073 0074 /** 0075 * Called when project was opened, adds a upload-action to the project-menu. 0076 */ 0077 void projectOpened(KDevelop::IProject*); 0078 0079 /** 0080 * Called when project was closed, removes the upload-action from the project-menu. 0081 */ 0082 void projectClosed(KDevelop::IProject*); 0083 0084 /** 0085 * Checks if there are any upload profiles, hides the ProfilesFileTree if there are none. 0086 */ 0087 void profilesRowChanged(); 0088 0089 void documentActivated(KDevelop::IDocument*); 0090 void documentClosed(KDevelop::IDocument*); 0091 0092 private: 0093 void setupActions(); 0094 0095 QList<KDevelop::ProjectBaseItem*> m_ctxUrlList; ///< selected files when the contextmenu was requested 0096 0097 KActionMenu* m_projectUploadActionMenu; ///< upload ActionMenu, displayed in the Project-Menu 0098 QAction* m_quickUploadCurrentFile; 0099 QMap<KDevelop::IProject*, QAction*> m_projectUploadActions; ///< upload actions for every open project 0100 QMap<KDevelop::IProject*, UploadProfileModel*> m_projectProfileModels; ///< UploadProfileModels for every open project 0101 QSignalMapper* m_signalMapper; ///< signal mapper for upload actions, to get the correct project 0102 QStandardItemModel* m_outputModel; ///< model for log-output 0103 FilesTreeViewFactory* m_filesTreeViewFactory; ///< factory for ProjectFilesTree 0104 AllProfilesModel* m_allProfilesModel; ///< model for all profiles 0105 }; 0106 0107 #endif 0108 0109 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on