Skip to content

Commit

Permalink
Qtc 4.12
Browse files Browse the repository at this point in the history
  • Loading branch information
OneMoreGres committed Apr 23, 2020
1 parent 2589357 commit 4f13ac9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 45 deletions.
39 changes: 15 additions & 24 deletions src/markdowneditorfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,25 @@

#include "markdowntextedit.h"

#include <texteditor/normalindenter.h>
#include <texteditor/textdocument.h>

namespace QtcMarkview {
namespace Internal {
namespace Internal {

MarkdownEditorFactory::MarkdownEditorFactory (QObject *parent) :
TextEditor::TextEditorFactory (parent) {
setId (Constants::MARKDOWN_EDITOR_ID);
setDisplayName (QCoreApplication::translate ("OpenWith::Editors",
Constants::MARKDOWN_EDITOR_NAME));
addMimeType ("text/plain");
addMimeType ("text/markdown");
MarkdownEditorFactory::MarkdownEditorFactory()
: TextEditor::TextEditorFactory() {
setId(Constants::MARKDOWN_EDITOR_ID);
setDisplayName(QCoreApplication::translate("OpenWith::Editors",
Constants::MARKDOWN_EDITOR_NAME));
addMimeType("text/plain");
addMimeType("text/markdown");

setDocumentCreator ([]() {
return new TextEditor::TextDocument (Constants::MARKDOWN_EDITOR_ID);
});
setEditorCreator ([]() {
return new TextEditor::BaseTextEditor;
});
setEditorWidgetCreator ([]() {
return new QMarkdownTextEdit;
});
setIndenterCreator ([](QTextDocument *doc) {
return new TextEditor::NormalIndenter (doc);
});
// setSyntaxHighlighterCreator()
}
setDocumentCreator([]() {
return new TextEditor::TextDocument(Constants::MARKDOWN_EDITOR_ID);
});
setEditorCreator([]() { return new TextEditor::BaseTextEditor; });
setEditorWidgetCreator([]() { return new QMarkdownTextEdit; });
}

} // namespace Internal
} // namespace Internal
} // namespace QtcMarkview
2 changes: 1 addition & 1 deletion src/markdowneditorfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace QtcMarkview {
Q_OBJECT

public:
explicit MarkdownEditorFactory (QObject *parent = nullptr);
explicit MarkdownEditorFactory ();
};

} // namespace Internal
Expand Down
36 changes: 18 additions & 18 deletions src/markviewplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,57 @@

using namespace QtcMarkview::Internal;

MarkviewPlugin::MarkviewPlugin () :
IPlugin () {
MarkviewPlugin::MarkviewPlugin() : IPlugin() {
// Create your members
}

MarkviewPlugin::~MarkviewPlugin () {
MarkviewPlugin::~MarkviewPlugin() {
// Unregister objects from the plugin manager's object pool
// Delete members
}

bool MarkviewPlugin::initialize (const QStringList &arguments, QString *errorString) {
bool MarkviewPlugin::initialize(const QStringList &arguments,
QString *errorString) {
// Register objects in the plugin manager's object pool
// Load settings
// Add actions to menus
// Connect to other plugins' signals
// In the initialize function, a plugin can be sure that the plugins it
// depends on have initialized their members.

Q_UNUSED (arguments)
Q_UNUSED (errorString)
Q_UNUSED(arguments)
Q_UNUSED(errorString)

initLanguage ();
initLanguage();

new MarkdownEditorFactory (this);
new MarkdownEditorFactory();

return true;
}

void MarkviewPlugin::initLanguage () {
const QString &language = Core::ICore::userInterfaceLanguage ();
if (!language.isEmpty ()) {
void MarkviewPlugin::initLanguage() {
const QString &language = Core::ICore::userInterfaceLanguage();
if (!language.isEmpty()) {
QStringList paths;
paths << Core::ICore::resourcePath () << Core::ICore::userResourcePath ();
const QString &trFile = QLatin1String ("QtcMarkview_") + language;
QTranslator *translator = new QTranslator (this);
paths << Core::ICore::resourcePath() << Core::ICore::userResourcePath();
const QString &trFile = QLatin1String("QtcMarkview_") + language;
QTranslator *translator = new QTranslator(this);
foreach (const QString &path, paths) {
if (translator->load (trFile, path + QLatin1String ("/translations"))) {
qApp->installTranslator (translator);
if (translator->load(trFile, path + QLatin1String("/translations"))) {
qApp->installTranslator(translator);
break;
}
}
}
}

void MarkviewPlugin::extensionsInitialized () {
void MarkviewPlugin::extensionsInitialized() {
// Retrieve objects from the plugin manager's object pool
// In the extensionsInitialized function, a plugin can be sure that all
// plugins that depend on it are completely initialized.
}

ExtensionSystem::IPlugin::ShutdownFlag MarkviewPlugin::aboutToShutdown () {
ExtensionSystem::IPlugin::ShutdownFlag MarkviewPlugin::aboutToShutdown() {
// Save settings
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
Expand Down
4 changes: 2 additions & 2 deletions util/ci/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from os import getenv, path

qt_version = "5.14.0"
qtc_version = "4.11.0"
qt_version = "5.14.2"
qtc_version = "4.12.0"
os_name = getenv('OS', 'linux')
qt_modules = ['qtbase', 'qttools', 'icu']
plugin_name = 'QtcMarkview'
Expand Down

0 comments on commit 4f13ac9

Please sign in to comment.