Verified Commit 8fa36f47 authored by ita1024's avatar ita1024

Make the canvas picture display optional

Add a touchpad mode
Add per-document color settings
parent 504d5dc8
Semantik 1.0.9
--------------
* Display picture and diagram thumbnails on the main map
* Add a touchpad mode for laptop users
Semantik 1.0.8
--------------
......
Semantik 1.0.8, Thomas Nagy tnagy at waf.io
Semantik 1.0.9, Thomas Nagy tnagy at waf.io
Project page: https://waf.io/semantik.html
Source code: https://gitlab.com/ita1024/semantik
-----------------------------------------------
......
......@@ -296,6 +296,7 @@ void mem_doc_open::init_data(sem_mediator* i_oOld, sem_mediator* i_oNew)
m_oFlagSchemesNew = i_oNew->m_oFlagSchemes;
m_oItemsNew = i_oNew->m_oItems;
m_oLinksNew = i_oNew->m_oLinks;
m_bShowPicsNew = i_oNew->m_bShowPics;
m_sOutDirOld = i_oOld->m_sOutDir;
m_sOutProjectOld = i_oOld->m_sOutProject;
......@@ -314,6 +315,7 @@ void mem_doc_open::init_data(sem_mediator* i_oOld, sem_mediator* i_oNew)
m_oItemsOld = i_oOld->m_oItems;
m_oLinksOld = i_oOld->m_oLinks;
m_sLastSavedOld = i_oOld->m_sLastSaved;
m_bShowPicsOld = i_oOld->m_bShowPics;
}
void mem_doc_open::redo()
......@@ -339,6 +341,7 @@ void mem_doc_open::redo()
model->m_oItems = m_oItemsNew;
model->m_oLinks = m_oLinksNew;
model->m_sLastSaved = m_sLastSavedNew;
model->m_bShowPics = m_bShowPicsNew;
model->notify_colors();
model->notify_flags();
......@@ -356,6 +359,7 @@ void mem_doc_open::redo()
model->notify_open_map();
model->set_dirty(false);
model->init_timer();
model->notify_background_color();
}
void mem_doc_open::undo()
......@@ -388,8 +392,10 @@ void mem_doc_open::undo()
model->m_oItems.clear();
model->m_oLinks.clear();
model->m_sLastSaved = m_sLastSavedOld;
model->m_bShowPics = m_bShowPicsOld;
model->notify_colors();
model->notify_background_color();
model->notify_flags();
model->notify_font();
......
......@@ -94,6 +94,7 @@ class mem_doc_open : public mem_command {
QString m_sOutProjectNew;
QString m_sOutTemplateNew;
bool m_bExportIsWidthNew;
bool m_bShowPicsNew;
int m_iExportWidthNew;
int m_iExportHeightNew;
QString m_sExportUrlNew;
......@@ -112,6 +113,7 @@ class mem_doc_open : public mem_command {
QString m_sOutProjectOld;
QString m_sOutTemplateOld;
bool m_bExportIsWidthOld;
bool m_bShowPicsOld;
int m_iExportWidthOld;
int m_iExportHeightOld;
QString m_sExportUrlOld;
......
......@@ -22,6 +22,7 @@
%: include<QCoreApplication>
#include <QXmlDefaultHandler>
#include<KConfig>
#include <windef.h>
#include <KConfigGroup>
#include <QProcess>
#include <QDir>
......@@ -76,6 +77,7 @@ bool semantik_reader::startElement(const QString&, const QString&, const QString
m_oMediator->m_sHints = i_oAttrs.value(notr("hints"));
m_iVersion = i_oAttrs.value(notr("version")).toInt();
m_oMediator->m_bExportIsWidth = i_oAttrs.value(notr("export_is_width")) != notr("false");
m_oMediator->m_bShowPics = notr("true") == i_oAttrs.value(notr("show_pics"));
QString l_s = i_oAttrs.value(notr("font"));
if (!l_s.isEmpty()) {
......@@ -102,6 +104,15 @@ bool semantik_reader::startElement(const QString&, const QString&, const QString
m_oMediator->m_sExportUrl = i_oAttrs.value(notr("export_url"));
if (i_oAttrs.index(notr("bgcolor")) > -1)
{
m_oMediator->m_oColor = QColor(i_oAttrs.value(notr("bgcolor")));
}
else
{
m_oMediator->m_oColor = notr("#FFFDE8");
}
if (i_oAttrs.value(notr("location")).size()) m_oMediator->m_sOutDir = i_oAttrs.value(notr("location"));
if (i_oAttrs.value(notr("dir")).size()) m_oMediator->m_sOutProject = i_oAttrs.value(notr("dir"));
if (i_oAttrs.value(notr("output")).size()) m_oMediator->m_sOutTemplate = i_oAttrs.value(notr("output"));
......@@ -319,11 +330,12 @@ void sem_mediator::init_colors()
KConfig l_oCfg("semantik");
KConfigGroup l_oSettings( &l_oCfg, notr("General Options"));
m_iConnType = l_oSettings.readEntry(notr("conn"), 0);
m_iReorgType = l_oSettings.readEntry(notr("reorg"), 0);
m_dTriSize = l_oSettings.readEntry(notr("trisize"), (double) 4.5);
m_iTimerValue = l_oSettings.readEntry(notr("auto"), 0);
m_iAutoReorg = l_oSettings.readEntry(notr("autoReorg"), 1);
m_oWindef->m_iReorgType = l_oSettings.readEntry(notr("reorg"), 0);
emit sync_colors();
}
......@@ -491,11 +503,13 @@ QString sem_mediator::doc_to_xml()
l_oS<<notr(" dir=\"%1\"").arg(bind_node::protectXML(m_sOutProject));
l_oS<<notr(" output=\"%1\"").arg(bind_node::protectXML(m_sOutTemplate));
l_oS<<notr(" hints=\"%1\"").arg(bind_node::protectXML(m_sHints));
l_oS<<notr(" show_pics=\"%1\"").arg(m_bShowPics ? notr("true") : notr("false"));
l_oS<<notr(" export_is_width=\"%1\"").arg(m_bExportIsWidth ? notr("true") : notr("false"));
l_oS<<notr(" export_width=\"%1\"").arg(QString::number(m_iExportWidth));
l_oS<<notr(" export_height=\"%1\"").arg(QString::number(m_iExportHeight));
l_oS<<notr(" export_url=\"%1\"").arg(bind_node::protectXML(m_sExportUrl));
l_oS<<notr(" bgcolor=\"%1\"").arg(bind_node::protectXML(m_oColor.name()));
l_oS<<notr(" spelling_language=\"%1\"").arg(bind_node::protectXML(m_sSpellingLanguage));
l_oS<<notr(" font=\"%1\"").arg(m_oFont.toString());
......@@ -1323,6 +1337,7 @@ sem_mediator::sem_mediator(QObject* i_oParent) : QObject(i_oParent)
num_seq = 1;
pic_seq = 1;
m_bShowPics = true;
m_iSortId = NO_ITEM;
m_iSortCursor = 0;
......@@ -1467,6 +1482,22 @@ bool sem_mediator::load_picture(const QString & i_sPath, int id)
return true;
}
void sem_mediator::set_show_pics(bool i_b)
{
if (i_b != m_bShowPics)
{
m_bShowPics = i_b;
foreach (int l_iVal, m_oItems.keys())
{
data_item& l_oItem = m_oItems[l_iVal];
if (l_oItem.m_iDataType == VIEW_IMG || l_oItem.m_iDataType == VIEW_DIAG)
{
emit notify_pic(l_iVal);
}
}
}
}
void sem_mediator::notify_add_item(int id)
{
emit sig_add_item(id);
......@@ -1627,6 +1658,13 @@ void sem_mediator::notify_font()
emit sync_font();
}
void sem_mediator::notify_text_align(int id, const QList<data_box>& items) {
void sem_mediator::notify_text_align(int id, const QList<data_box>& items)
{
emit sig_text_align(id, items);
}
void sem_mediator::notify_background_color()
{
emit sync_background_color();
}
......@@ -36,6 +36,7 @@ class html_converter : public QXmlDefaultHandler
class semantik_reader;
class data_item;
class windef;
class bind_node;
class data_link;
class sem_mediator: public QObject
......@@ -54,6 +55,7 @@ class sem_mediator: public QObject
void sig_unlink_items(int id1, int id2);
void sync_flags();
void sync_colors();
void sync_background_color();
void sync_font();
void sig_select(const QList<int>& unsel, const QList<int>& sel);
void sig_move(const QList<int>&sel, const QList<QPointF>&pos);
......@@ -92,10 +94,15 @@ class sem_mediator: public QObject
sem_mediator(QObject *i_oParent);
~sem_mediator();
windef *m_oWindef;
QString m_sOutDir;
QString m_sOutProject;
QString m_sOutTemplate;
void set_show_pics(bool);
bool m_bShowPics;
bool m_bExportIsWidth;
int m_iExportWidth;
int m_iExportHeight;
......@@ -189,6 +196,7 @@ class sem_mediator: public QObject
void notify_sequence_box(int id, int);
void notify_change_properties(void*);
void notify_colors();
void notify_background_color();
void notify_flags();
void notify_font();
void notify_open_map();
......
// Thomas Nagy 2018 GPLV3
// window definitions
class windef
{
public:
bool m_bUseTouchpad;
int m_iReorgType;
};
......@@ -129,7 +129,7 @@ void canvas_item::update_data()
l_oItem.m_iYY = m_oGraph->m_oLastPoint.y();
}
if (l_oItem.m_iDataType == VIEW_IMG || l_oItem.m_iDataType == VIEW_DIAG)
if (m_oGraph->m_oMediator->m_bShowPics && (l_oItem.m_iDataType == VIEW_IMG || l_oItem.m_iDataType == VIEW_DIAG))
{
m_oPic->setVisible(true);
}
......@@ -347,7 +347,7 @@ void canvas_item::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
qreal canvas_item::reorgHeight()
{
data_item& l_oItem = m_oGraph->m_oMediator->m_oItems[Id()];
if (l_oItem.m_iDataType == VIEW_IMG || l_oItem.m_iDataType == VIEW_DIAG)
if (m_oGraph->m_oMediator->m_bShowPics && (l_oItem.m_iDataType == VIEW_IMG || l_oItem.m_iDataType == VIEW_DIAG))
{
return boundingRect().height() + m_oPic->m_iOffset;
}
......
......@@ -36,8 +36,8 @@ canvas_pic::canvas_pic(canvas_view *i_oGraphWidget, int i_iId) : QGraphicsRectIt
m_iId = i_iId;
setZValue(98);
setFlags(QGraphicsItem::ItemStacksBehindParent);
setVisible(false);
i_oGraphWidget->scene()->addItem(this);
setVisible(false);
m_iOffset = pad;
}
......
......@@ -23,6 +23,7 @@
#include <QSet>
#include <QPrintDialog>
#include "canvas_sort.h"
#include <windef.h>
#include <QRadioButton>
#include "canvas_sort_toggle.h"
#include "semantik.h"
......@@ -163,6 +164,8 @@ canvas_view::canvas_view(QWidget *i_oWidget, sem_mediator *i_oControl, QMenu* i_
setDragMode(QGraphicsView::RubberBandDrag);
scene()->setFont(m_oMediator->m_oFont);
setBackgroundBrush(m_oMediator->m_oColor);
}
void canvas_view::resizeEvent(QResizeEvent* e)
......@@ -517,6 +520,13 @@ void canvas_view::zoom_out()
void canvas_view::wheelEvent(QWheelEvent *i_oEvent)
{
bool l_bCtrl = i_oEvent->modifiers() & Qt::ControlModifier;
if (m_oMediator->m_oWindef->m_bUseTouchpad xor l_bCtrl)
{
QGraphicsView::wheelEvent(i_oEvent);
return;
}
QPointF l_o = mapToScene(i_oEvent->pos());
qreal i_iScaleFactor = pow(2.0, i_oEvent->delta() / 440.0);
qreal i_rFactor = matrix().scale(i_iScaleFactor, i_iScaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
......@@ -1370,7 +1380,7 @@ void canvas_view::mouseMoveEvent(QMouseEvent *i_oEv)
QGraphicsView::mouseMoveEvent(i_oEv);
QList<QGraphicsItem*> sel = scene()->selectedItems();
if (sel.size() > 4) { // does not solve the repainting problem
/*if (sel.size() > 4) { // does not solve the repainting problem
QSet<canvas_link*> lst;
foreach (QGraphicsItem*tmp, sel) {
if (tmp->type() == CANVAS_ITEM_T && tmp->isSelected()) {
......@@ -1383,7 +1393,7 @@ void canvas_view::mouseMoveEvent(QMouseEvent *i_oEv)
foreach (canvas_link* tmp, lst) {
tmp->update_pos();
}
} else {
} else*/ {
foreach (QGraphicsItem*tmp, sel) {
if (tmp->type() == CANVAS_ITEM_T && tmp->isSelected()) {
((canvas_item*) tmp)->update_links();
......@@ -1665,3 +1675,8 @@ void canvas_view::notify_font()
{
scene()->setFont(m_oMediator->m_oFont);
}
void canvas_view::slot_background_color()
{
setBackgroundBrush(m_oMediator->m_oColor);
}
......@@ -124,6 +124,7 @@ class canvas_view : public QGraphicsView
void zoom_out();
void toggle_fullscreen();
void slot_select_subtree();
void slot_background_color();
void notify_focus(void* ptr);
void notify_pic(int id);
......
......@@ -3,6 +3,7 @@
#include <QVariant>
#include <QAction>
#include <QSpinBox>
#include <QCheckBox>
#include <QApplication>
#include <QButtonGroup>
#include <QGridLayout>
......@@ -15,8 +16,11 @@
#include <QDirModel>
#include <QCompleter>
#include <QPushButton>
#include <QGroupBox>
#include <QTabWidget>
#include <QCoreApplication>
#include <QtDebug>
#include <QSpacerItem>
#include <QColorDialog>
#include "config_dialog.h"
......@@ -24,58 +28,92 @@
config_dialog::config_dialog(QWidget *i_oParent):
KDialog(i_oParent)
{
QWidget *widget = new QWidget(this);
setCaption(i18n("Document settings"));
setCaption(i18n("Settings"));
setButtons(KDialog::Ok | KDialog::Cancel);
QGridLayout *l_oGridLayout = new QGridLayout(widget);
QLabel *l_sLabel;
l_sLabel = new QLabel(widget);
QTabWidget *l_oTabWidget = new QTabWidget(this);
QWidget *l_oDocumentGroupBox = new QGroupBox(l_oTabWidget);
l_oTabWidget->addTab(l_oDocumentGroupBox, i18n("Document settings"));
QWidget *l_oGlobalGroupBox = new QGroupBox(l_oTabWidget);
l_oTabWidget->addTab(l_oGlobalGroupBox, i18n("Global settings"));
QGridLayout *l_oDocumentGridLayout = new QGridLayout(l_oDocumentGroupBox);
l_sLabel = new QLabel(l_oDocumentGroupBox);
l_sLabel->setText(i18n("Background color"));
l_oDocumentGridLayout->addWidget(l_sLabel, 0, 0, 1, 1);
l_sLabel = new QLabel(l_oDocumentGroupBox);
l_sLabel->setText(i18n("Preview pictures"));
l_oDocumentGridLayout->addWidget(l_sLabel, 1, 0, 1, 1);
m_oColorWidget = new QPushButton(l_oDocumentGroupBox);
l_oDocumentGridLayout->addWidget(m_oColorWidget, 0, 1, 1, 1);
connect(m_oColorWidget, SIGNAL(clicked()), this, SLOT(select_color()));
m_oPreviewPics = new QCheckBox(l_oDocumentGroupBox);
l_oDocumentGridLayout->addWidget(m_oPreviewPics, 1, 1, 1, 1);
QSpacerItem *l_oSpacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
l_oDocumentGridLayout->addItem(l_oSpacer, 2, 1, 2);
QGridLayout *l_oGlobalGridLayout = new QGridLayout(l_oGlobalGroupBox);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Reorganization type"));
l_oGridLayout->addWidget(l_sLabel, 0, 0, 1, 1);
l_oGlobalGridLayout->addWidget(l_sLabel, 0, 0, 1, 1);
l_sLabel = new QLabel(widget);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Item position after keyboard insertion"));
l_oGridLayout->addWidget(l_sLabel, 1, 0, 1, 1);
l_oGlobalGridLayout->addWidget(l_sLabel, 1, 0, 1, 1);
l_sLabel = new QLabel(widget);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Connection type"));
l_oGridLayout->addWidget(l_sLabel, 2, 0, 1, 1);
l_oGlobalGridLayout->addWidget(l_sLabel, 2, 0, 1, 1);
l_sLabel = new QLabel(widget);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Save document automatically"));
l_oGridLayout->addWidget(l_sLabel, 3, 0, 1, 1);
l_oGlobalGridLayout->addWidget(l_sLabel, 3, 0, 1, 1);
l_sLabel = new QLabel(widget);
l_sLabel->setText(i18n("Background color"));
l_oGridLayout->addWidget(l_sLabel, 4, 0, 1, 1);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Touchpad mode"));
l_oGlobalGridLayout->addWidget(l_sLabel, 4, 0, 1, 1);
m_oReorgType = new QComboBox(widget);
m_oReorgType->addItems(QStringList()<<i18n("Fixed")<<i18n("Force-based")<<i18n("Incremental"));
l_oGridLayout->addWidget(m_oReorgType, 0, 1, 1, 1);
m_oReorgType = new QComboBox(l_oGlobalGroupBox);
m_oReorgType->addItems(QStringList()<<i18n("Fixed")); //<<i18n("Force-based")<<i18n("Incremental"));
l_oGlobalGridLayout->addWidget(m_oReorgType, 0, 1, 1, 1);
m_oAutoReorg = new QComboBox(widget);
m_oAutoReorg = new QComboBox(l_oGlobalGroupBox);
m_oAutoReorg->addItems(QStringList()<<i18n("Close to parent")<<i18n("Reorganize map"));
l_oGridLayout->addWidget(m_oAutoReorg, 1, 1, 1, 1);
l_oGlobalGridLayout->addWidget(m_oAutoReorg, 1, 1, 1, 1);
m_oConnType = new QComboBox(widget);
m_oConnType = new QComboBox(l_oGlobalGroupBox);
m_oConnType->addItems(QStringList()<<i18n("Lines")<<i18n("Splines"));
l_oGridLayout->addWidget(m_oConnType, 2, 1, 1, 1);
l_oGlobalGridLayout->addWidget(m_oConnType, 2, 1, 1, 1);
m_oAutoSave = new QSpinBox(widget);
m_oAutoSave = new QSpinBox(l_oGlobalGroupBox);
m_oAutoSave->setSuffix(i18n(" min"));
m_oAutoSave->setRange(0, 69 /* 69 hmmm */);
l_oGridLayout->addWidget(m_oAutoSave, 3, 1, 1, 1);
l_oGlobalGridLayout->addWidget(m_oAutoSave, 3, 1, 1, 1);
m_oAutoSave->setToolTip(i18n("Interval in minutes for saving the document automatically, 0 for disabling this feature"));
m_oColorWidget = new QPushButton(widget);
l_oGridLayout->addWidget(m_oColorWidget, 4, 1, 1, 1);
connect(m_oColorWidget, SIGNAL(clicked()), this, SLOT(select_color()));
m_oUseTouchpad = new QCheckBox(l_oGlobalGroupBox);
l_oGlobalGridLayout->addWidget(m_oUseTouchpad, 4, 1, 1, 1);
l_oSpacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
l_oGlobalGridLayout->addItem(l_oSpacer, 5, 1, 2);
setMainWidget(widget);
setMainWidget(l_oTabWidget);
QSize size(321, 120);
size = size.expandedTo(minimumSizeHint());
......
......@@ -6,6 +6,7 @@
#include <KDE/KDialog>
#include <con.h>
class QCheckBox;
class QComboBox;
class QSpinBox;
class QTreeWidgetItem;
......@@ -19,6 +20,8 @@ class config_dialog : public KDialog
QComboBox *m_oAutoReorg;
QComboBox *m_oConnType;
QSpinBox *m_oAutoSave;
QCheckBox *m_oUseTouchpad;
QCheckBox *m_oPreviewPics;
QPushButton *m_oColorWidget;
QColor m_oColor;
......
......@@ -7,7 +7,7 @@
#include <KStandardAction>
#include <KRecentFilesAction>
#include <KDE/KActionCollection>
#include <windef.h>
#include <QClipboard>
#include <QMouseEvent>
#include <QAction>
......@@ -1300,6 +1300,13 @@ void box_view::notify_change_link_box(int id, data_link*link)
void box_view::wheelEvent(QWheelEvent *i_oEvent)
{
bool l_bCtrl = i_oEvent->modifiers() & Qt::ControlModifier;
if (m_oMediator->m_oWindef->m_bUseTouchpad xor l_bCtrl)
{
QGraphicsView::wheelEvent(i_oEvent);
return;
}
QPointF l_o = mapToScene(i_oEvent->pos());
qreal i_iScaleFactor = pow(2.0, i_oEvent->delta() / 440.0);
qreal i_rFactor = matrix().scale(i_iScaleFactor, i_iScaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
......
......@@ -19,18 +19,20 @@
#include <ktip.h>
#include <QFrame>
#include "windef.h"
#include "diagram_document.h"
#include "sem_mediator.h"
#include "box_view.h"
# include "sembind.h"
#include "mem_base.h"
diagram_document::diagram_document(QWidget *i_oParent) : QFrame(i_oParent)
diagram_document::diagram_document(QWidget *i_oParent, windef *i_oWindef) : QFrame(i_oParent), m_oWindef(i_oWindef)
{
setLineWidth(0);
setFrameStyle(QFrame::NoFrame);
m_oMediator = new sem_mediator(this);
m_oMediator->m_oWindef = i_oWindef;
m_oDiagramView = new box_view(this, m_oMediator);
QGridLayout *ll = new QGridLayout(this);
......
......@@ -14,15 +14,17 @@ lude <QFrame>
class box_view;
class sem_mediator;
class windef;
class diagram_document : public QFrame
{
Q_OBJECT
public:
diagram_document(QWidget *i_oParent=0);
diagram_document(QWidget *i_oParent=0, windef* i_oWindef=0);
virtual ~diagram_document();
void init();
windef *m_oWindef;
box_view *m_oDiagramView;
sem_mediator *m_oMediator;
......
// Thomas Nagy 2013-2018 GPLV3
#include "semantik_d_win.h"
#include "windef.h"
#include "diagram_document.h"
#include "sem_mediator.h"
#include "box_view.h"
#include "sembind.h"
#include "filetree.h"
#include "semd_config_dialog.h"
#include <KConfigGroup>
#include <QCheckBox>
#include <QtGui>
#include <QFile>
#include <QTextBrowser>
......@@ -24,13 +34,6 @@
#include <KDirModel>
#include <QStandardPaths>
#include "semantik_d_win.h"
#include "diagram_document.h"
#include "sem_mediator.h"
#include "box_view.h"
#include "sembind.h"
#include "filetree.h"
semantik_d_win::semantik_d_win(QWidget *i_oParent) : KXmlGuiWindow(i_oParent)
{
setObjectName("semantik_d_win");
......@@ -99,8 +102,11 @@ semantik_d_win::semantik_d_win(QWidget *i_oParent) : KXmlGuiWindow(i_oParent)
m_oColorGroup->setExclusive(true);
actionCollection()->addAction(notr("color_custom"), m_oCustomColorAct);
KStandardAction::preferences(this, SLOT(slot_properties()), actionCollection());
setupGUI(QSize(1000, 800), Default, notr("semantik-dui.rc"));
m_oWindef = new windef();
read_config();
setAutoSaveSettings();
statusBar()->showMessage(i18n("This is Semantik-d"), 2000);
......@@ -213,7 +219,7 @@ void semantik_d_win::slot_enable_undo(bool i_bUndo, bool i_bRedo)
void semantik_d_win::slot_add_tab()
{
m_oActiveDocument = new diagram_document(m_oTabWidget);
m_oActiveDocument = new diagram_document(m_oTabWidget, m_oWindef);
m_oActiveDocument->m_oDiagramView->m_oColorMenu = m_oColorMenu;
m_oActiveDocument->init();
int l_iIndex = m_oTabWidget->addTab(m_oActiveDocument, i18n("[Untitled]"));
......@@ -251,6 +257,8 @@ void semantik_d_win::read_config()
KConfigGroup l_oSaveConfig(&l_oCfg, notr("Recent Files"));
m_oRecentFilesAct->loadEntries(l_oSaveConfig);
m_oWindef->m_bUseTouchpad = l_oConfig.readEntry(notr("touchpad"), false);
move(l_oConfig.readEntry(notr("winpos"), QPoint(0, 0)));
//m_oMediator->m_sOutDir = l_oConfig.readEntry(notr("outdir"), notr("/tmp/"));
//bind_node::set_var(notr("outdir"), m_oMediator->m_sOutDir);
......@@ -337,7 +345,7 @@ void semantik_d_win::slot_open()
// just open a new tab
diagram_document *l_oTmp = m_oActiveDocument;
m_oActiveDocument = new diagram_document(m_oTabWidget);
m_oActiveDocument = new diagram_document(m_oTabWidget, m_oWindef);
m_oActiveDocument->m_oDiagramView->m_oColorMenu = m_oColorMenu;
m_oActiveDocument->init();
if (m_oActiveDocument->m_oDiagramView->import_from_file(l_o))
......@@ -380,7 +388,7 @@ void semantik_d_win::slot_recent(const QUrl& i_oUrl)
}
diagram_document *l_oTmp = m_oActiveDocument;
m_oActiveDocument = new diagram_document(m_oTabWidget);
m_oActiveDocument = new diagram_document(m_oTabWidget, m_oWindef);
m_oActiveDocument->m_oDiagramView->m_oColorMenu = m_oColorMenu;
m_oActiveDocument->init();
if (m_oActiveDocument->m_oDiagramView->import_from_file(i_oUrl))
......@@ -407,7 +415,18 @@ void semantik_d_win::record_open_url(const QUrl & i_oUrl)
m_oFileTree->m_oModel->expandToUrl(i_oUrl);
}
void semantik_d_win::slot_properties() {
void semantik_d_win::slot_properties()
{
semd_config_dialog l_oGen(this);
KConfig l_oConfig("semantik-d");
KConfigGroup l_oSettings(&l_oConfig, notr("General Options"));
l_oGen.m_oUseTouchpad->setChecked(l_oSettings.readEntry(notr("touchpad"), false));
if (l_oGen.exec() == QDialog::Accepted)
{
l_oSettings.writeEntry(notr("touchpad"), m_oWindef->m_bUseTouchpad = l_oGen.m_oUseTouchpad->isChecked());
l_oConfig.sync();
}
}
void semantik_d_win::slot_generate() {
......
......@@ -18,6 +18,7 @@ class QAction;
class QActionGroup;
class QListWidget;
class QMenu;
class windef;
class QActionGroup;
class QTextEdit;
class KTabWidget;
......@@ -43,6 +44,7 @@ class semantik_d_win : public KXmlGuiWindow
QAction *m_oExportSizeAct;
QMenu *m_oColorMenu;
QActionGroup *m_oColorGroup;
windef *m_oWindef;
void read_config();
void write_config();
......
// Thomas Nagy 2007-2018 GPLV3
#include <QVariant>
#include <QAction>
#include <QSpinBox>
#include <QCheckBox>
#include <QApplication>
#include <QButtonGroup>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QSpacerItem>
#include <QTreeWidget>
#include <QComboBox>
#include <QHeaderView>
#include <QDirModel>
#include <QCompleter>
#include <QPushButton>
#include <QGroupBox>
#include <QTabWidget>
#include <QCoreApplication>
#include <QtDebug>
#include <QSpacerItem>
#include <QColorDialog>
#include "semd_config_dialog.h"
semd_config_dialog::semd_config_dialog(QWidget *i_oParent):
KDialog(i_oParent)
{
setCaption(i18n("Settings"));
setButtons(KDialog::Ok | KDialog::Cancel);
QLabel *l_sLabel;
QTabWidget *l_oTabWidget = new QTabWidget(this);
//QWidget *l_oDocumentGroupBox = new QGroupBox(l_oTabWidget);
//l_oTabWidget->addTab(l_oDocumentGroupBox, i18n("Document settings and defaults"));
QWidget *l_oGlobalGroupBox = new QGroupBox(l_oTabWidget);
l_oTabWidget->addTab(l_oGlobalGroupBox, i18n("Global settings"));
//QGridLayout *l_oDocumentGridLayout = new QGridLayout(l_oDocumentGroupBox);
QGridLayout *l_oGlobalGridLayout = new QGridLayout(l_oGlobalGroupBox);
l_sLabel = new QLabel(l_oGlobalGroupBox);
l_sLabel->setText(i18n("Touchpad mode"));
l_oGlobalGridLayout->addWidget(l_sLabel, 0, 0, 1, 1);
m_oUseTouchpad = new QCheckBox(l_oGlobalGroupBox);
l_oGlobalGridLayout->addWidget(m_oUseTouchpad, 0, 1, 1, 1);
QSpacerItem *l_oSpacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
l_oGlobalGridLayout->addItem(l_oSpacer, 1, 1, 2);
setMainWidget(l_oTabWidget);
QSize size(321, 120);
size = size.expandedTo(minimumSizeHint());
resize(size);
}
// Thomas Nagy 2007-2018 GPLV3
#ifndef SEMD_CONFIG_DIALOG_H
#define SEMD_CONFIG_DIALOG_H
#include <KDE/KDialog>
#include <con.h>