Skip to content

Commit ed13356

Browse files
committed
Initial commit
0 parents  commit ed13356

File tree

9 files changed

+309
-0
lines changed

9 files changed

+309
-0
lines changed

.gitignore

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@@ -0,0 +1,79 @@
2+
# C++ objects and libs
3+
4+
*.slo
5+
*.lo
6+
*.o
7+
*.a
8+
*.la
9+
*.lai
10+
*.so
11+
*.dll
12+
*.dylib
13+
14+
# Qt-es
15+
16+
/.qmake.cache
17+
/.qmake.stash
18+
*.pro.user
19+
*.pro.user.*
20+
*.moc
21+
moc_*.cpp
22+
qrc_*.cpp
23+
ui_*.h
24+
Makefile*
25+
*-build-*
26+
27+
# QtCreator
28+
29+
*.autosave
30+
31+
#QtCtreator Qml
32+
*.qmlproject.user
33+
*.qmlproject.user.*
34+
35+
# =========================
36+
# Operating System Files
37+
# =========================
38+
39+
# OSX
40+
# =========================
41+
42+
.DS_Store
43+
.AppleDouble
44+
.LSOverride
45+
46+
# Thumbnails
47+
._*
48+
49+
# Files that might appear on external disk
50+
.Spotlight-V100
51+
.Trashes
52+
53+
# Directories potentially created on remote AFP share
54+
.AppleDB
55+
.AppleDesktop
56+
Network Trash Folder
57+
Temporary Items
58+
.apdisk
59+
60+
# Windows
61+
# =========================
62+
63+
# Windows image file caches
64+
Thumbs.db
65+
ehthumbs.db
66+
67+
# Folder config file
68+
Desktop.ini
69+
70+
# Recycle Bin used on file shares
71+
$RECYCLE.BIN/
72+
73+
# Windows Installer files
74+
*.cab
75+
*.msi
76+
*.msm
77+
*.msp
78+
79+
# Windows shortcuts
80+
*.lnk

GistPlugin.json.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
\"Name\" : \"GistPlugin\",
3+
\"Version\" : \"0.0.1\",
4+
\"CompatVersion\" : \"0.0.1\",
5+
\"Vendor\" : \"JustCxx\",
6+
\"Copyright\" : \"(C) Vasiliy I.Kolesnikov\",
7+
\"License\" : \"The MIT License (MIT)\",
8+
\"Description\" : \"GitHub Gist service integration plugin\",
9+
\"Url\" : \"https://github.com/justCxx\",
10+
$$dependencyList
11+
}
12+

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Vasiliy I.Kolesnikov (re.vkolesnikov@gmail.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#Qt Creator GitHub Gist Integration
2+
3+
##Introduction
4+
Plugin integrates some [Gist](https://gist.github.com/ "Gist") functionality into Qt Creator IDE.
5+
6+
##Features
7+
* Create gist
8+
9+
##Tips
10+
11+
##Downloads
12+
Built plugin can be downloaded [here]
13+
14+
##More info
15+
Additional information can be obtained [here]

gistplugin.pro

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
DEFINES += GISTPLUGIN_LIBRARY
2+
3+
# GistPlugin files
4+
5+
SOURCES += src/gistplugin.cpp
6+
7+
HEADERS += src/gistplugin.h \
8+
src/gistplugin_global.h \
9+
src/gistpluginconstants.h
10+
11+
# Qt Creator linking
12+
13+
## set the QTC_SOURCE environment variable to override the setting here
14+
QTCREATOR_SOURCES = $$(QTC_SOURCE)
15+
isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=/home/dust/dev/tools/qt-builds/qt-creator/qt-creator
16+
17+
## set the QTC_BUILD environment variable to override the setting here
18+
IDE_BUILD_TREE = $$(QTC_BUILD)
19+
isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=/home/dust/dev/tools/qt-builds/qt-creator/qt-creator
20+
21+
## uncomment to build plugin into user config directory
22+
## <localappdata>/plugins/<ideversion>
23+
## where <localappdata> is e.g.
24+
## "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
25+
## "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
26+
## "~/Library/Application Support/QtProject/Qt Creator" on Mac
27+
# USE_USER_DESTDIR = yes
28+
29+
###### If the plugin can be depended upon by other plugins, this code needs to be outsourced to
30+
###### <dirname>_dependencies.pri, where <dirname> is the name of the directory containing the
31+
###### plugin's sources.
32+
33+
QTC_PLUGIN_NAME = GistPlugin
34+
QTC_LIB_DEPENDS += \
35+
# nothing here at this time
36+
37+
QTC_PLUGIN_DEPENDS += \
38+
coreplugin
39+
40+
QTC_PLUGIN_RECOMMENDS += \
41+
# optional plugin dependencies. nothing here at this time
42+
43+
###### End _dependencies.pri contents ######
44+
45+
include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)

src/gistplugin.cpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#include "gistplugin.h"
2+
#include "gistpluginconstants.h"
3+
4+
#include <coreplugin/icore.h>
5+
#include <coreplugin/icontext.h>
6+
#include <coreplugin/actionmanager/actionmanager.h>
7+
#include <coreplugin/actionmanager/command.h>
8+
#include <coreplugin/actionmanager/actioncontainer.h>
9+
#include <coreplugin/coreconstants.h>
10+
11+
#include <QAction>
12+
#include <QMessageBox>
13+
#include <QMainWindow>
14+
#include <QMenu>
15+
16+
#include <QtPlugin>
17+
18+
using namespace GistPlugin::Internal;
19+
20+
GistPluginPlugin::GistPluginPlugin()
21+
{
22+
// Create your members
23+
}
24+
25+
GistPluginPlugin::~GistPluginPlugin()
26+
{
27+
// Unregister objects from the plugin manager's object pool
28+
// Delete members
29+
}
30+
31+
bool GistPluginPlugin::initialize(const QStringList &arguments, QString *errorString)
32+
{
33+
// Register objects in the plugin manager's object pool
34+
// Load settings
35+
// Add actions to menus
36+
// Connect to other plugins' signals
37+
// In the initialize function, a plugin can be sure that the plugins it
38+
// depends on have initialized their members.
39+
40+
Q_UNUSED(arguments)
41+
Q_UNUSED(errorString)
42+
43+
QAction *action = new QAction(tr("GistPlugin action"), this);
44+
Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID,
45+
Core::Context(Core::Constants::C_GLOBAL));
46+
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
47+
connect(action, SIGNAL(triggered()), this, SLOT(triggerAction()));
48+
49+
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
50+
menu->menu()->setTitle(tr("GistPlugin"));
51+
menu->addAction(cmd);
52+
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
53+
54+
return true;
55+
}
56+
57+
void GistPluginPlugin::extensionsInitialized()
58+
{
59+
// Retrieve objects from the plugin manager's object pool
60+
// In the extensionsInitialized function, a plugin can be sure that all
61+
// plugins that depend on it are completely initialized.
62+
}
63+
64+
ExtensionSystem::IPlugin::ShutdownFlag GistPluginPlugin::aboutToShutdown()
65+
{
66+
// Save settings
67+
// Disconnect from signals that are not needed during shutdown
68+
// Hide UI (if you add UI that is not in the main window directly)
69+
return SynchronousShutdown;
70+
}
71+
72+
void GistPluginPlugin::triggerAction()
73+
{
74+
QMessageBox::information(Core::ICore::mainWindow(),
75+
tr("Action triggered"),
76+
tr("This is an action from GistPlugin."));
77+
}

src/gistplugin.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef GISTPLUGIN_H
2+
#define GISTPLUGIN_H
3+
4+
#include "gistplugin_global.h"
5+
6+
#include <extensionsystem/iplugin.h>
7+
8+
namespace GistPlugin {
9+
namespace Internal {
10+
11+
class GistPluginPlugin : public ExtensionSystem::IPlugin
12+
{
13+
Q_OBJECT
14+
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "GistPlugin.json")
15+
16+
public:
17+
GistPluginPlugin();
18+
~GistPluginPlugin();
19+
20+
bool initialize(const QStringList &arguments, QString *errorString);
21+
void extensionsInitialized();
22+
ShutdownFlag aboutToShutdown();
23+
24+
private slots:
25+
void triggerAction();
26+
};
27+
28+
} // namespace Internal
29+
} // namespace GistPlugin
30+
31+
#endif // GISTPLUGIN_H
32+

src/gistplugin_global.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef GISTPLUGIN_GLOBAL_H
2+
#define GISTPLUGIN_GLOBAL_H
3+
4+
#include <QtGlobal>
5+
6+
#if defined(GISTPLUGIN_LIBRARY)
7+
# define GISTPLUGINSHARED_EXPORT Q_DECL_EXPORT
8+
#else
9+
# define GISTPLUGINSHARED_EXPORT Q_DECL_IMPORT
10+
#endif
11+
12+
#endif // GISTPLUGIN_GLOBAL_H
13+

src/gistpluginconstants.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef GISTPLUGINCONSTANTS_H
2+
#define GISTPLUGINCONSTANTS_H
3+
4+
namespace GistPlugin {
5+
namespace Constants {
6+
7+
const char ACTION_ID[] = "GistPlugin.Action";
8+
const char MENU_ID[] = "GistPlugin.Menu";
9+
10+
} // namespace GistPlugin
11+
} // namespace Constants
12+
13+
#endif // GISTPLUGINCONSTANTS_H
14+

0 commit comments

Comments
 (0)