Skip to content

Commit

Permalink
Merge pull request #428 from Zioba/master
Browse files Browse the repository at this point in the history
implement saving idtf position for contours, fix bug with link border
  • Loading branch information
KovalM authored Oct 7, 2020
2 parents d7d5fdb + 7b6da58 commit 06d9fb0
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 41 deletions.
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
Please read readme.html in the docs folder.

Knowledge Base Editor (KBE) - specialized tool for knowledge base creation.

to correctly use KBE at linux run scripts/prepare.sh before the first start

2 changes: 1 addition & 1 deletion scripts/prepare_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -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
sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools qtscript5-dev libqt5xmlpatterns5-dev libqt5svg5-dev libqt5webkit5-dev antlr libantlr3c-dev antlr3
16 changes: 1 addition & 15 deletions sources/kbe/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void MainWindow::createActions()
connect(ui->actionSave_all, SIGNAL(triggered()), this, SLOT(onFileSaveAll()));
connect(ui->actionTo_image, SIGNAL(triggered()), this, SLOT(onFileExportToImage()));

connect(ui->actionClose_All, SIGNAL(triggered()), mTabWidget, SLOT(closeAllDocuments()) );
connect(ui->actionClose_All, SIGNAL(triggered()), mTabWidget, SLOT(closeAllDocuments()));
connect(ui->actionClose, SIGNAL(triggered()), mTabWidget, SLOT(close()));
connect(ui->actionClose_Others, SIGNAL(triggered()), mTabWidget, SLOT(closeOtherDocuments()));
connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(onUpdateMenu()));
Expand Down Expand Up @@ -600,15 +600,6 @@ void MainWindow::updateDockWidgets(bool visible)
}
}else
{
if(!mStates.contains(windowClassName))
{
// Read window state from settings.
QSettings settings;
mStates[windowClassName] = settings.value(getSettingKeyValueForWindow(windowClassName)).toByteArray();
}

QByteArray b = mStates[windowClassName];

foreach(QWidget* w, mLastActiveWindow->widgetsForDocks())
{
if(!mDockWidgets.contains(w->objectName()))
Expand All @@ -618,13 +609,8 @@ void MainWindow::updateDockWidgets(bool visible)
d->setObjectName(w->objectName());
}
mDockWidgets[w->objectName()]->setWidget(w);

if(b.isEmpty())
addDockWidget(Qt::RightDockWidgetArea, mDockWidgets[w->objectName()]);
}

if(!b.isEmpty())
restoreState(b);
}
}

Expand Down
2 changes: 1 addition & 1 deletion sources/kbe/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down
Binary file modified sources/kbe/media/translations/lang_ru_RU.qm
Binary file not shown.
11 changes: 9 additions & 2 deletions sources/plugins/scg/gwf/gwfobjectinforeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ bool GwfObjectInfoReader::parseNode(const QDomElement &element)
{
std::auto_ptr<SCgNodeInfo> nodeInfo(new SCgNodeInfo());

if(!parseObject(element,nodeInfo.get()))
if(!parseObject(element, nodeInfo.get()))
return false;

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

if(!parseObject(element,contourInfo.get()))
if(!parseObject(element, contourInfo.get()))
return false;

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

qreal& idtfPosX = contourInfo->posRef().rx();
qreal& idtfPosY = contourInfo->posRef().ry();
if (!getAttributeDouble(element, "idtf_pos_x", idtfPosX))
idtfPosX = 0;
if (!getAttributeDouble(element, "idtf_pos_y", idtfPosY))
idtfPosY = 0;

mObjectsInfo[SCgContour::Type].append(contourInfo.release());
return true;
}
Expand Down
5 changes: 5 additions & 0 deletions sources/plugins/scg/gwf/gwfstreamwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ void GwfStreamWriter::writeContour(SCgObject *obj)
writeObjectAttributes(obj);
SCgContour* contour = static_cast<SCgContour*>(obj);


QVector<QPointF> points(contour->scenePoints());
if (contour->idtfValue() != NULL) {
writeAttribute("idtf_pos_x", QString::number((int)contour->idtfPos().x()));
writeAttribute("idtf_pos_y", QString::number((int)contour->idtfPos().y()));
}
writePoints(points);

writeEndElement();
Expand Down
2 changes: 2 additions & 0 deletions sources/plugins/scg/scgcontentstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ void SCgContentStringViewer::setData(const QVariant &data)
mTextLabel->setText(data.toString());
mTextLabel->setWordWrap(true);
mTextLabel->setIndent(5);
QFont font("Times New Roman [Arial]", 10, 10, false);
mTextLabel->setFont(font);
mTextLabel->setFixedSize(mTextLabel->sizeHint()+QSize(10, 10));
setWidget(mTextLabel);
updateGeometry();
Expand Down
4 changes: 4 additions & 0 deletions sources/plugins/scg/scgdefaultobjectbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ void DefaultSCgObjectBuilder::buildContour(SCgContourInfo* info)

contour->setPos(QPolygonF(info->points()).boundingRect().center());
contour->setPoints(info->points());
if ((info->pos().x()!= 0) | (info->pos().y()!= 0)) {
contour->setIdtfValue(info->idtfValue());
contour->setIdtfPos(info->pos());
}

setObjectInfo(contour, info);
}
Expand Down
10 changes: 10 additions & 0 deletions sources/plugins/scg/scgobjectsinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ SCgContourInfo::SCgContourInfo(const SCgContour* obj)
d = new SCgContourInfoData (obj);
}

QPointF SCgContourInfo::pos() const
{
return d->mPos;
}

SCgContourInfo::SCgContourInfo(const SCgContourInfo &other): SCgObjectInfo(other)
{

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

QPointF& SCgContourInfo::posRef()
{
return d->mPos;
}

QVector<QPointF>& SCgContourInfo::pointsRef()
{
return d->mPoints;
Expand Down
2 changes: 2 additions & 0 deletions sources/plugins/scg/scgobjectsinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class SCgContourInfo: public SCgObjectInfo
*/
virtual int objectType() const;

QPointF pos() const;
const QVector<QPointF>& points() const;
/**@}*/

Expand All @@ -182,6 +183,7 @@ class SCgContourInfo: public SCgObjectInfo
* @{
*/
QVector<QPointF>& pointsRef();
QPointF& posRef();
/**@}*/

private:
Expand Down
4 changes: 2 additions & 2 deletions sources/plugins/scg/scgobjectsinfodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ SCgPairInfoData::~SCgPairInfoData()

//____________________________________________________

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

}

SCgContourInfoData::SCgContourInfoData(const SCgContourInfoData &other): QSharedData(other),
mPoints(other.mPoints)
mPoints(other.mPoints), mPos(other.mPos)
{

}
Expand Down
1 change: 1 addition & 0 deletions sources/plugins/scg/scgobjectsinfodata.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class SCgContourInfoData:public QSharedData
SCgContourInfoData();
virtual ~SCgContourInfoData();
private:
QPointF mPos;
QVector<QPointF> mPoints;
};

Expand Down
2 changes: 1 addition & 1 deletion sources/plugins/scg/scgplugin.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"Version": [0, 2, 0]
"Version": [0, 4, 0]
}
15 changes: 1 addition & 14 deletions sources/plugins/scg/scgwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ void SCgWindow::createActions()
mActionRedo->setShortcut(QKeySequence::Redo);
this->addAction(mActionRedo);
mActionRedo->setIcon(QIcon::fromTheme("edit-redo", findIcon("edit-redo.png")));

// mActionMinMap = new QAction(tr("Minimap"), this);
// mActionMinMap->setCheckable(true);
// mActionMinMap->setShortcuts();
// fi.setFile();
// mActionMinMap->setIcon(QIcon(fi.absoluteFilePath()));
// connect(mActionMinMap, SIGNAL(triggered(bool)), this, SLOT(setVisibleMinMap(bool)));
}

void SCgWindow::createWidgetsForDocks()
Expand Down Expand Up @@ -664,19 +657,13 @@ void SCgWindow::createMenu()
mEditMenu->addAction(mActionFind);

mEditMenu->addActions(mView->actions());


//
// mViewMenu = new QMenu(tr("View"), this);
// mViewMenu ->addAction(mActionMinMap);
}

void SCgWindow::deleteMenu()
{
Q_ASSERT(mEditMenu);

delete mEditMenu;
// delete mViewMenu;
// mViewMenu = 0;
mEditMenu = 0;
}

Expand Down
5 changes: 0 additions & 5 deletions sources/plugins/scg/scgwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ class SCgWindow : public QWidget,
* \defgroup menu Menu
* @{
*/
// //! View menu
// QMenu* mViewMenu;
//!Edit menu
QMenu* mEditMenu;
//! undo action
Expand All @@ -150,9 +148,6 @@ class SCgWindow : public QWidget,
//! Find by identifier action;
QAction* mActionFind;

// //! Show/hide minmap;
// QAction* mActionMinMap;

/*! Creates all actions, handled by this window.
* @see createMenu() for adding actions in menu.
*/
Expand Down

0 comments on commit 06d9fb0

Please sign in to comment.