Skip to content

Commit 06d9fb0

Browse files
authored
Merge pull request #428 from Zioba/master
implement saving idtf position for contours, fix bug with link border
2 parents d7d5fdb + 7b6da58 commit 06d9fb0

16 files changed

+44
-41
lines changed

README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
Please read readme.html in the docs folder.
22

3+
Knowledge Base Editor (KBE) - specialized tool for knowledge base creation.
4+
5+
to correctly use KBE at linux run scripts/prepare.sh before the first start
6+

scripts/prepare_ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools qtquick1-5-dev qtscript5-dev libqt5xmlpatterns5-dev libqt5svg5-dev libqt5webkit5-dev antlr libantlr3c-dev antlr3
1+
sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools qtscript5-dev libqt5xmlpatterns5-dev libqt5svg5-dev libqt5webkit5-dev antlr libantlr3c-dev antlr3

sources/kbe/mainwindow.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void MainWindow::createActions()
151151
connect(ui->actionSave_all, SIGNAL(triggered()), this, SLOT(onFileSaveAll()));
152152
connect(ui->actionTo_image, SIGNAL(triggered()), this, SLOT(onFileExportToImage()));
153153

154-
connect(ui->actionClose_All, SIGNAL(triggered()), mTabWidget, SLOT(closeAllDocuments()) );
154+
connect(ui->actionClose_All, SIGNAL(triggered()), mTabWidget, SLOT(closeAllDocuments()));
155155
connect(ui->actionClose, SIGNAL(triggered()), mTabWidget, SLOT(close()));
156156
connect(ui->actionClose_Others, SIGNAL(triggered()), mTabWidget, SLOT(closeOtherDocuments()));
157157
connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(onUpdateMenu()));
@@ -600,15 +600,6 @@ void MainWindow::updateDockWidgets(bool visible)
600600
}
601601
}else
602602
{
603-
if(!mStates.contains(windowClassName))
604-
{
605-
// Read window state from settings.
606-
QSettings settings;
607-
mStates[windowClassName] = settings.value(getSettingKeyValueForWindow(windowClassName)).toByteArray();
608-
}
609-
610-
QByteArray b = mStates[windowClassName];
611-
612603
foreach(QWidget* w, mLastActiveWindow->widgetsForDocks())
613604
{
614605
if(!mDockWidgets.contains(w->objectName()))
@@ -618,13 +609,8 @@ void MainWindow::updateDockWidgets(bool visible)
618609
d->setObjectName(w->objectName());
619610
}
620611
mDockWidgets[w->objectName()]->setWidget(w);
621-
622-
if(b.isEmpty())
623612
addDockWidget(Qt::RightDockWidgetArea, mDockWidgets[w->objectName()]);
624613
}
625-
626-
if(!b.isEmpty())
627-
restoreState(b);
628614
}
629615
}
630616

sources/kbe/mainwindow.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<x>0</x>
2121
<y>0</y>
2222
<width>600</width>
23-
<height>25</height>
23+
<height>22</height>
2424
</rect>
2525
</property>
2626
<widget class="QMenu" name="menuFile">
16 Bytes
Binary file not shown.

sources/plugins/scg/gwf/gwfobjectinforeader.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ bool GwfObjectInfoReader::parseNode(const QDomElement &element)
363363
{
364364
std::auto_ptr<SCgNodeInfo> nodeInfo(new SCgNodeInfo());
365365

366-
if(!parseObject(element,nodeInfo.get()))
366+
if(!parseObject(element, nodeInfo.get()))
367367
return false;
368368

369369
qreal& x = nodeInfo->posRef().rx();
@@ -481,12 +481,19 @@ bool GwfObjectInfoReader::parseContour(const QDomElement &element)
481481
{
482482
std::auto_ptr<SCgContourInfo> contourInfo(new SCgContourInfo());
483483

484-
if(!parseObject(element,contourInfo.get()))
484+
if(!parseObject(element, contourInfo.get()))
485485
return false;
486486

487487
if (!getElementPoints(element, contourInfo->pointsRef()))
488488
return false;
489489

490+
qreal& idtfPosX = contourInfo->posRef().rx();
491+
qreal& idtfPosY = contourInfo->posRef().ry();
492+
if (!getAttributeDouble(element, "idtf_pos_x", idtfPosX))
493+
idtfPosX = 0;
494+
if (!getAttributeDouble(element, "idtf_pos_y", idtfPosY))
495+
idtfPosY = 0;
496+
490497
mObjectsInfo[SCgContour::Type].append(contourInfo.release());
491498
return true;
492499
}

sources/plugins/scg/gwf/gwfstreamwriter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ void GwfStreamWriter::writeContour(SCgObject *obj)
192192
writeObjectAttributes(obj);
193193
SCgContour* contour = static_cast<SCgContour*>(obj);
194194

195+
195196
QVector<QPointF> points(contour->scenePoints());
197+
if (contour->idtfValue() != NULL) {
198+
writeAttribute("idtf_pos_x", QString::number((int)contour->idtfPos().x()));
199+
writeAttribute("idtf_pos_y", QString::number((int)contour->idtfPos().y()));
200+
}
196201
writePoints(points);
197202

198203
writeEndElement();

sources/plugins/scg/scgcontentstring.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ void SCgContentStringViewer::setData(const QVariant &data)
3838
mTextLabel->setText(data.toString());
3939
mTextLabel->setWordWrap(true);
4040
mTextLabel->setIndent(5);
41+
QFont font("Times New Roman [Arial]", 10, 10, false);
42+
mTextLabel->setFont(font);
4143
mTextLabel->setFixedSize(mTextLabel->sizeHint()+QSize(10, 10));
4244
setWidget(mTextLabel);
4345
updateGeometry();

sources/plugins/scg/scgdefaultobjectbuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ void DefaultSCgObjectBuilder::buildContour(SCgContourInfo* info)
204204

205205
contour->setPos(QPolygonF(info->points()).boundingRect().center());
206206
contour->setPoints(info->points());
207+
if ((info->pos().x()!= 0) | (info->pos().y()!= 0)) {
208+
contour->setIdtfValue(info->idtfValue());
209+
contour->setIdtfPos(info->pos());
210+
}
207211

208212
setObjectInfo(contour, info);
209213
}

sources/plugins/scg/scgobjectsinfo.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ SCgContourInfo::SCgContourInfo(const SCgContour* obj)
286286
d = new SCgContourInfoData (obj);
287287
}
288288

289+
QPointF SCgContourInfo::pos() const
290+
{
291+
return d->mPos;
292+
}
293+
289294
SCgContourInfo::SCgContourInfo(const SCgContourInfo &other): SCgObjectInfo(other)
290295
{
291296

@@ -311,6 +316,11 @@ const QVector<QPointF>& SCgContourInfo::points() const
311316
return d->mPoints;
312317
}
313318

319+
QPointF& SCgContourInfo::posRef()
320+
{
321+
return d->mPos;
322+
}
323+
314324
QVector<QPointF>& SCgContourInfo::pointsRef()
315325
{
316326
return d->mPoints;

sources/plugins/scg/scgobjectsinfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class SCgContourInfo: public SCgObjectInfo
173173
*/
174174
virtual int objectType() const;
175175

176+
QPointF pos() const;
176177
const QVector<QPointF>& points() const;
177178
/**@}*/
178179

@@ -182,6 +183,7 @@ class SCgContourInfo: public SCgObjectInfo
182183
* @{
183184
*/
184185
QVector<QPointF>& pointsRef();
186+
QPointF& posRef();
185187
/**@}*/
186188

187189
private:

sources/plugins/scg/scgobjectsinfodata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ SCgPairInfoData::~SCgPairInfoData()
105105

106106
//____________________________________________________
107107

108-
SCgContourInfoData::SCgContourInfoData(const SCgContour* obj): mPoints(obj->points())
108+
SCgContourInfoData::SCgContourInfoData(const SCgContour* obj): mPoints(obj->points()), mPos(obj->scenePos())
109109
{
110110

111111
}
112112

113113
SCgContourInfoData::SCgContourInfoData(const SCgContourInfoData &other): QSharedData(other),
114-
mPoints(other.mPoints)
114+
mPoints(other.mPoints), mPos(other.mPos)
115115
{
116116

117117
}

sources/plugins/scg/scgobjectsinfodata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class SCgContourInfoData:public QSharedData
110110
SCgContourInfoData();
111111
virtual ~SCgContourInfoData();
112112
private:
113+
QPointF mPos;
113114
QVector<QPointF> mPoints;
114115
};
115116

sources/plugins/scg/scgplugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"Version": [0, 2, 0]
2+
"Version": [0, 4, 0]
33
}

sources/plugins/scg/scgwindow.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,6 @@ void SCgWindow::createActions()
138138
mActionRedo->setShortcut(QKeySequence::Redo);
139139
this->addAction(mActionRedo);
140140
mActionRedo->setIcon(QIcon::fromTheme("edit-redo", findIcon("edit-redo.png")));
141-
142-
// mActionMinMap = new QAction(tr("Minimap"), this);
143-
// mActionMinMap->setCheckable(true);
144-
// mActionMinMap->setShortcuts();
145-
// fi.setFile();
146-
// mActionMinMap->setIcon(QIcon(fi.absoluteFilePath()));
147-
// connect(mActionMinMap, SIGNAL(triggered(bool)), this, SLOT(setVisibleMinMap(bool)));
148141
}
149142

150143
void SCgWindow::createWidgetsForDocks()
@@ -664,19 +657,13 @@ void SCgWindow::createMenu()
664657
mEditMenu->addAction(mActionFind);
665658

666659
mEditMenu->addActions(mView->actions());
667-
668-
669-
//
670-
// mViewMenu = new QMenu(tr("View"), this);
671-
// mViewMenu ->addAction(mActionMinMap);
672660
}
673661

674662
void SCgWindow::deleteMenu()
675663
{
676664
Q_ASSERT(mEditMenu);
665+
677666
delete mEditMenu;
678-
// delete mViewMenu;
679-
// mViewMenu = 0;
680667
mEditMenu = 0;
681668
}
682669

sources/plugins/scg/scgwindow.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ class SCgWindow : public QWidget,
139139
* \defgroup menu Menu
140140
* @{
141141
*/
142-
// //! View menu
143-
// QMenu* mViewMenu;
144142
//!Edit menu
145143
QMenu* mEditMenu;
146144
//! undo action
@@ -150,9 +148,6 @@ class SCgWindow : public QWidget,
150148
//! Find by identifier action;
151149
QAction* mActionFind;
152150

153-
// //! Show/hide minmap;
154-
// QAction* mActionMinMap;
155-
156151
/*! Creates all actions, handled by this window.
157152
* @see createMenu() for adding actions in menu.
158153
*/

0 commit comments

Comments
 (0)