Commit 2a01527c authored by Halla Rempt's avatar Halla Rempt

Add a mockup for a text editor docker

parent 44fb9384
......@@ -21,3 +21,4 @@ add_subdirectory(colorslider)
add_subdirectory(animation)
add_subdirectory(presethistory)
add_subdirectory(shapedockers)
add_subdirectory(texteditor)
set(KRITA_texteditor_SOURCES texteditor.cpp texteditor_dock.cpp WdgTextEditor.cpp)
ki18n_wrap_ui(KRITA_texteditor_SOURCES WdgTextEditor.ui)
add_library(kritatexteditor MODULE ${KRITA_texteditor_SOURCES})
target_link_libraries(kritatexteditor kritaui)
install(TARGETS kritatexteditor DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR})
#include "WdgTextEditor.h"
#include "ui_WdgTextEditor.h"
WdgTextEditor::WdgTextEditor(QWidget *parent) :
QWidget(parent),
ui(new Ui::WdgTextEditor)
{
ui->setupUi(this);
}
WdgTextEditor::~WdgTextEditor()
{
delete ui;
}
#ifndef WDGTEXTEDITOR_H
#define WDGTEXTEDITOR_H
#include <QWidget>
namespace Ui {
class WdgTextEditor;
}
class WdgTextEditor : public QWidget
{
Q_OBJECT
public:
explicit WdgTextEditor(QWidget *parent = 0);
~WdgTextEditor();
private:
Ui::WdgTextEditor *ui;
};
#endif // WDGTEXTEDITOR_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WdgTextEditor</class>
<widget class="QWidget" name="WdgTextEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QFontComboBox" name="fontComboBox"/>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Laughing Potions&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Mega-hairgrowth Potions&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Stink-bubble Potions&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&amp;quot;Bright-Side&amp;quot; Potions&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Smoke Potions...&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;... to name just a few!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Showe Codes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Render automatically</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Render</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
{
"Id": "Pattern Docker",
"Type": "Service",
"X-KDE-Library": "kritatexteditor",
"X-KDE-ServiceTypes": [
"Krita/Dock"
],
"X-Krita-Version": "28"
}
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "texteditor.h"
#include <stdlib.h>
#include <QTimer>
#include <kpluginfactory.h>
#include <klocalizedstring.h>
#include <KoDockFactoryBase.h>
#include <kis_debug.h>
#include "kis_config.h"
#include "kis_cursor.h"
#include "kis_global.h"
#include "kis_types.h"
#include "KisViewManager.h"
#include "texteditor_dock.h"
#include <KoDockRegistry.h>
K_PLUGIN_FACTORY_WITH_JSON(TextEditorPluginFactory, "krita_texteditor.json", registerPlugin<TextEditorPlugin>();)
class TextEditorDockFactory : public KoDockFactoryBase {
public:
TextEditorDockFactory()
{
}
virtual QString id() const
{
return QString( "TextEditor" );
}
virtual Qt::DockWidgetArea defaultDockWidgetArea() const
{
return Qt::RightDockWidgetArea;
}
virtual QDockWidget* createDockWidget()
{
TextEditorDock * dockWidget = new TextEditorDock();
dockWidget->setObjectName(id());
return dockWidget;
}
DockPosition defaultDockPosition() const
{
return DockMinimized;
}
private:
};
TextEditorPlugin::TextEditorPlugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
KoDockRegistry::instance()->add(new TextEditorDockFactory());
}
TextEditorPlugin::~TextEditorPlugin()
{
m_view = 0;
}
#include "texteditor.moc"
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PATTERN_DOCKER_H_
#define _PATTERN_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class TextEditorPlugin : public QObject
{
Q_OBJECT
public:
TextEditorPlugin(QObject *parent, const QVariantList &);
virtual ~TextEditorPlugin();
private:
KisViewManager* m_view;
};
#endif
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "texteditor_dock.h"
#include <QHBoxLayout>
#include <QPushButton>
#include <klocalizedstring.h>
#include <kis_canvas_resource_provider.h>
#include <KisViewManager.h>
#include <WdgTextEditor.h>
TextEditorDock::TextEditorDock( )
: QDockWidget(i18n("Text Editor"))
{
setWidget(new WdgTextEditor(this));
// m_patternChooser = new KisPatternChooser(this);
// m_patternChooser->setPreviewOrientation(Qt::Vertical);
// m_patternChooser->setCurrentItem(0,0);
// m_patternChooser->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
// setWidget(m_patternChooser);
}
void TextEditorDock::setMainWindow(KisViewManager* kisview)
{
}
void TextEditorDock::setCanvas(KoCanvasBase *canvas)
{
setEnabled(canvas != 0);
}
void TextEditorDock::unsetCanvas()
{
setEnabled(false);
}
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PATTERN_DOCK_H_
#define _PATTERN_DOCK_H_
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
class KoPattern;
class KisPatternChooser;
class TextEditorDock : public QDockWidget, public KisMainwindowObserver {
Q_OBJECT
public:
TextEditorDock( );
virtual void setMainWindow(KisViewManager* kisview);
virtual void setCanvas(KoCanvasBase *canvas);
virtual void unsetCanvas();
QString observerName() { return "TextEditorDock"; }
private:
KisPatternChooser* m_patternChooser;
};
#endif
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