shorter lines, less qDebug(), Node::calculateBiggestAngle() works

master
Denes Matetelki 14 years ago
parent 931b8f56e4
commit 6cab47bfae

1
.gitignore vendored

@ -5,3 +5,4 @@ Makefile
moc_* moc_*
qrc_* qrc_*
qtmindmap qtmindmap
*.pro.user

@ -0,0 +1,84 @@
#define private public
#include "algorithmtests.h"
#include <QDebug>
#include "node.h"
#include "edge.h"
static const double Pi = 3.14159265358979323846264338327950288419717;
AlgorithmTests::AlgorithmTests(QObject *parent) :
QObject(parent)
{
}
/** edge->paint() calculates the m_angle of th edge,
* but it is skipped so it must be done manually
*/
double angleOfPoints(const QPointF &a, const QPointF &b)
{
QLineF line(a, b);
double angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
angle = 2 * Pi - angle;
return angle;
}
void AlgorithmTests::calculateBiggestAngle()
{
// no edges
Node *node1 = new Node();
node1->setPos(0,0);
QCOMPARE(node1->calculateBiggestAngle(), Pi * 1.5);
// one egde
// 1
Node *node2 = new Node();
node2->setPos(30,0);
Edge *edge1 = new Edge(node1, node2);
edge1->m_angle = angleOfPoints(node1->pos(), node2->pos());
QCOMPARE(edge1->getAngle(), 2 * Pi);
QCOMPARE(node1->calculateBiggestAngle(), - Pi);
QCOMPARE(node2->calculateBiggestAngle(), double(0));
// 2
node2->setPos(30,30);
edge1->m_angle = angleOfPoints(node1->pos(), node2->pos()); // 45
QCOMPARE(edge1->getAngle(), 1.75 * Pi);
QCOMPARE(node1->calculateBiggestAngle(), - 0.75 * Pi);
QCOMPARE(node2->calculateBiggestAngle(), 0.25 * Pi);
// more edges
node2->setPos(30,0);
edge1->m_angle = angleOfPoints(node1->pos(), node2->pos());
Node *node3 = new Node();
node3->setPos(-30,0);
Edge *edge2 = new Edge(node1, node3);
edge2->m_angle = angleOfPoints(node1->pos(), node3->pos());
Node *node4 = new Node();
node4->setPos(0, -30);
Edge *edge3 = new Edge(node1, node4);
edge3->m_angle = angleOfPoints(node1->pos(), node4->pos());
QCOMPARE(edge1->getAngle(), 2 * Pi);
QCOMPARE(edge2->getAngle(), Pi);
QCOMPARE(edge3->getAngle(), 0.5 * Pi);
QCOMPARE(node1->calculateBiggestAngle(), 0.5 * Pi);
delete node1;
delete node2;
delete node3;
}
QTEST_MAIN(AlgorithmTests)

@ -0,0 +1,18 @@
#ifndef ALGORITHMTESTS_H
#define ALGORITHMTESTS_H
#include <QtTest/QtTest>
class AlgorithmTests : public QObject
{
Q_OBJECT
public:
explicit AlgorithmTests(QObject *parent = 0);
private slots:
void calculateBiggestAngle();
};
#endif // ALGORITHMTESTS_H

@ -3,7 +3,6 @@
#include <QApplication> #include <QApplication>
#include <QStringList> #include <QStringList>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug>
#include <iostream> #include <iostream>
@ -13,30 +12,31 @@ ArgumentParser::ArgumentParser(QObject *parent) :
m_isShowMinimized(false), m_isShowMinimized(false),
m_filePath() m_filePath()
{ {
qDebug() << __PRETTY_FUNCTION__;
} }
void ArgumentParser::printUsage() void ArgumentParser::printUsage()
{ {
qDebug() << __PRETTY_FUNCTION__; std::cout << tr("Usage: ").toStdString() << "qtmindmap [OPTION][FILE]"
<< std::endl
std::cout << tr("Usage: ").toStdString() << "qtmindmap [OPTION][FILE]" << std::endl
<< tr("Mindmap program in QT").toStdString() << std::endl << tr("Mindmap program in QT").toStdString() << std::endl
<< std::endl << std::endl
<< tr("Options:").toStdString() << std::endl << tr("Options:").toStdString() << std::endl
<< "-h, --help\t\t" << tr("Prints this help.").toStdString() << std::endl << "-h, --help\t\t" << tr("Prints this help.").toStdString()
<< "-t, --tray\t\t" << tr("Starts application in system tray.").toStdString() << std::endl << std::endl
<< "-s, --show-minimized\t" << tr("Hide main window, just show systray icon.").toStdString() << std::endl << "-t, --tray\t\t"
<< tr("Starts application in system tray.").toStdString()
<< std::endl << std::endl
<< tr("Report bugs to: ").toStdString() << "denes.matetelki@gmail.com" << std::endl; << "-s, --show-minimized\t"
<< tr("Hide main window, just show systray icon.").toStdString()
<< std::endl << std::endl
<< tr("Report bugs to: ").toStdString()
<< "denes.matetelki@gmail.com" << std::endl;
} }
bool ArgumentParser::parseCmdLineArgs(bool &successful) bool ArgumentParser::parseCmdLineArgs(bool &successful)
{ {
qDebug() << __PRETTY_FUNCTION__;
QStringList cmdlineArgs = QCoreApplication::arguments(); QStringList cmdlineArgs = QCoreApplication::arguments();
cmdlineArgs.removeFirst(); cmdlineArgs.removeFirst();
@ -49,20 +49,26 @@ bool ArgumentParser::parseCmdLineArgs(bool &successful)
} }
QRegExp tray("^-(t|-tray)$"); QRegExp tray("^-(t|-tray)$");
if (!cmdlineArgs.filter(tray).isEmpty()) m_isSystemTray = true; if (!cmdlineArgs.filter(tray).isEmpty())
m_isSystemTray = true;
QRegExp minimized("^-(s|-show-minimized)$"); QRegExp minimized("^-(s|-show-minimized)$");
if (!cmdlineArgs.filter(minimized).isEmpty()) m_isShowMinimized = true; if (!cmdlineArgs.filter(minimized).isEmpty())
m_isShowMinimized = true;
/// @note It is an error? Shall it be handled? /// @note It is an error? Shall it be handled?
// if (isSystemTray && isShowMinimized) return false; // if (isSystemTray && isShowMinimized) return false;
QRegExp all("^-(t|-tray|h|-help|s|-show-minimized)$"); QRegExp all("^-(t|-tray|h|-help|s|-show-minimized)$");
QStringList others; QStringList others;
foreach (QString arg, cmdlineArgs) if (all.indexIn(arg)==-1) others.append(arg); foreach (QString arg, cmdlineArgs)
if (all.indexIn(arg)==-1)
others.append(arg);
if (others.size() > 1) if (others.size() > 1)
{ {
std::cerr << tr("Unkown options: ").toStdString() << others.join(" ").toStdString() << std::endl; std::cerr << tr("Unkown options: ").toStdString()
<< others.join(" ").toStdString() << std::endl;
printUsage(); printUsage();
successful = false; successful = false;
return false; return false;
@ -81,25 +87,33 @@ bool ArgumentParser::parseCmdLineArgs(bool &successful)
QFileInfo fileInfo(m_filePath); QFileInfo fileInfo(m_filePath);
if (!fileInfo.exists()) if (!fileInfo.exists())
{ {
std::cerr << tr("File: ").toStdString() << m_filePath.toStdString() << tr(" does not exists.").toStdString() << std::endl; std::cerr << tr("File: ").toStdString() <<
m_filePath.toStdString() <<
tr(" does not exists.").toStdString() << std::endl;
successful = false; successful = false;
return false; return false;
} }
if (!fileInfo.isFile()) if (!fileInfo.isFile())
{ {
std::cerr << tr("File: ").toStdString() << m_filePath.toStdString() << tr(" is not a file.").toStdString() << std::endl; std::cerr << tr("File: ").toStdString() <<
m_filePath.toStdString() <<
tr(" is not a file.").toStdString() << std::endl;
successful = false; successful = false;
return false; return false;
} }
if (!fileInfo.isReadable()) if (!fileInfo.isReadable())
{ {
std::cerr << tr("File: ").toStdString() << m_filePath.toStdString() << tr(" is not readable.").toStdString() << std::endl; std::cerr << tr("File: ").toStdString() <<
m_filePath.toStdString() <<
tr(" is not readable.").toStdString() << std::endl;
successful = false; successful = false;
return false; return false;
} }
if (!fileInfo.isWritable()) if (!fileInfo.isWritable())
{ {
std::cout << tr("File: ").toStdString() << m_filePath.toStdString() << tr(" is not writeable.").toStdString() << std::endl; std::cout << tr("File: ").toStdString() <<
m_filePath.toStdString() <<
tr(" is not writeable.").toStdString() << std::endl;
} }
} }
return true; return true;

@ -12,7 +12,7 @@ public:
explicit ArgumentParser(QObject *parent = 0); explicit ArgumentParser(QObject *parent = 0);
/*** /***
* @param successful is true is the program needs to stop but its not an error. * @param successful is true if the program needs to stop but its not error
* @return true is program can continue * @return true is program can continue
*/ */
bool parseCmdLineArgs(bool &successful); bool parseCmdLineArgs(bool &successful);

@ -11,7 +11,8 @@ static const double Pi = 3.14159265358979323846264338327950288419717;
static double TwoPi = 2.0 * Pi; static double TwoPi = 2.0 * Pi;
Edge::Edge(Node *sourceNode, Node *destNode) Edge::Edge(Node *sourceNode, Node *destNode)
: m_arrowSize(7) : m_arrowSize(7),
m_angle(-1)
{ {
setAcceptedMouseButtons(0); setAcceptedMouseButtons(0);
m_sourceNode = sourceNode; m_sourceNode = sourceNode;
@ -102,6 +103,10 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
QLineF line(m_sourcePoint, m_destPoint); QLineF line(m_sourcePoint, m_destPoint);
m_angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
m_angle = TwoPi - m_angle;
if (sourceNode()->collidesWithItem(destNode())) if (sourceNode()->collidesWithItem(destNode()))
return; return;
@ -113,12 +118,6 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
return; return;
// Draw the arrows // Draw the arrows
m_angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
m_angle = TwoPi - m_angle;
qDebug() << m_angle;
QPointF destArrowP1 = m_destPoint + QPointF(sin(m_angle - Pi / 3) * m_arrowSize, QPointF destArrowP1 = m_destPoint + QPointF(sin(m_angle - Pi / 3) * m_arrowSize,
cos(m_angle - Pi / 3) * m_arrowSize); cos(m_angle - Pi / 3) * m_arrowSize);
QPointF destArrowP2 = m_destPoint + QPointF(sin(m_angle - Pi + Pi / 3) * m_arrowSize, QPointF destArrowP2 = m_destPoint + QPointF(sin(m_angle - Pi + Pi / 3) * m_arrowSize,
@ -130,9 +129,5 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
double Edge::getAngle() const double Edge::getAngle() const
{ {
qDebug() << __PRETTY_FUNCTION__;
qDebug() << m_angle;
return m_angle; return m_angle;
} }

@ -21,7 +21,8 @@ public:
protected: protected:
QRectF boundingRect() const; QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
private: private:

@ -17,8 +17,6 @@ GraphWidget::GraphWidget(QWidget *parent) :
m_showingNodeNumbers(false), m_showingNodeNumbers(false),
m_followNode(0) m_followNode(0)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_scene = new QGraphicsScene(this); m_scene = new QGraphicsScene(this);
m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
m_scene->setSceneRect(-400, -400, 800, 800); m_scene->setSceneRect(-400, -400, 800, 800);
@ -127,9 +125,6 @@ QGraphicsScene *GraphWidget::getScene()
void GraphWidget::keyPressEvent(QKeyEvent *event) void GraphWidget::keyPressEvent(QKeyEvent *event)
{ {
qDebug() << __PRETTY_FUNCTION__;
qDebug() << event->key();
switch (event->key()) { switch (event->key()) {
case Qt::Key_Up: case Qt::Key_Up:
if (m_activeNode) if (m_activeNode)
@ -224,8 +219,6 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_Enter: case Qt::Key_Enter:
if (m_followNode && m_showingNodeNumbers) if (m_followNode && m_showingNodeNumbers)
{ {
qDebug() << m_activeNode;
qDebug() << m_followNode;
showingAllNodeNumbers(false); showingAllNodeNumbers(false);
if (m_activeNode) if (m_activeNode)
m_activeNode->setActive(false); m_activeNode->setActive(false);
@ -289,7 +282,8 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
void GraphWidget::scaleView(qreal scaleFactor) void GraphWidget::scaleView(qreal scaleFactor)
{ {
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width(); qreal factor = transform().scale(scaleFactor, scaleFactor).
mapRect(QRectF(0, 0, 1, 1)).width();
if (factor < 0.2 || factor > 10) return; if (factor < 0.2 || factor > 10) return;
scale(scaleFactor, scaleFactor); scale(scaleFactor, scaleFactor);
@ -297,8 +291,6 @@ void GraphWidget::scaleView(qreal scaleFactor)
void GraphWidget::setActiveNode(Node *node) void GraphWidget::setActiveNode(Node *node)
{ {
qDebug() << __PRETTY_FUNCTION__;
if (m_activeNode!=0) if (m_activeNode!=0)
m_activeNode->setActive(false); m_activeNode->setActive(false);
@ -308,26 +300,21 @@ void GraphWidget::setActiveNode(Node *node)
void GraphWidget::insertNode() void GraphWidget::insertNode()
{ {
qDebug() << __PRETTY_FUNCTION__;
double angle(m_activeNode->calculateBiggestAngle()); double angle(m_activeNode->calculateBiggestAngle());
qreal length(100); qDebug() << "got angle: " << angle;
qDebug() << "angle: "; qreal length(100);
qDebug() << angle;
QPointF pos(length * cos(angle), length * sin(angle)); QPointF pos(length * cos(angle), length * sin(angle));
qDebug() << pos;
Node *node = new Node(this); Node *node = new Node(this);
node->setHtml(QString("new node")); node->setHtml(QString("new node"));
m_scene->addItem(node); m_scene->addItem(node);
node->setPos(m_activeNode->pos() + node->setPos(m_activeNode->sceneBoundingRect().center() +
// m_activeNode->boundingRect().center() + pos -
pos); node->boundingRect().center()
);
m_nodeList.append(node); m_nodeList.append(node);
m_scene->addItem(new Edge(m_activeNode, node)); m_scene->addItem(new Edge(m_activeNode, node));
@ -336,15 +323,18 @@ void GraphWidget::insertNode()
void GraphWidget::showingAllNodeNumbers(const bool &show) void GraphWidget::showingAllNodeNumbers(const bool &show)
{ {
int i =0; int i =0;
for (QList<Node *>::const_iterator it = m_nodeList.begin(); it != m_nodeList.end(); it++, i++) for (QList<Node *>::const_iterator it = m_nodeList.begin();
it != m_nodeList.end(); it++, i++)
dynamic_cast<Node*>(*it)->showNumber(i,show); dynamic_cast<Node*>(*it)->showNumber(i,show);
} }
void GraphWidget::showingNodeNumbersBeginWithNumber(const int &number, const bool &show) void GraphWidget::showingNodeNumbersBeginWithNumber(const int &number,
const bool &show)
{ {
int i(0); int i(0);
int hit(0); int hit(0);
for (QList<Node *>::const_iterator it = m_nodeList.begin(); it != m_nodeList.end(); it++, i++) for (QList<Node *>::const_iterator it = m_nodeList.begin();
it != m_nodeList.end(); it++, i++)
{ {
if (i == number) if (i == number)
{ {

@ -31,7 +31,8 @@ protected:
private: private:
void showingAllNodeNumbers(const bool &show = true); void showingAllNodeNumbers(const bool &show = true);
void showingNodeNumbersBeginWithNumber(const int &number, const bool &show = true); void showingNodeNumbersBeginWithNumber(const int &number,
const bool &show = true);
bool numberStartsWithNumber(const int &number, const int &prefix); bool numberStartsWithNumber(const int &number, const int &prefix);
qreal calculateBiggestAngle(Node *node); qreal calculateBiggestAngle(Node *node);

@ -2,7 +2,6 @@
#include <iostream> // cout #include <iostream> // cout
#include <QtGui> #include <QtGui>
#include <QDebug>
#include <QRegExp> #include <QRegExp>
#include <QTranslator> #include <QTranslator>
@ -25,7 +24,9 @@ int main(int argc, char *argv[])
QTranslator translator; QTranslator translator;
if (!translator.load(QString("qtmindmap_") + locale)) if (!translator.load(QString("qtmindmap_") + locale))
{ {
std::cerr << "No translation file for locale: " << locale.toStdString() << std::endl; std::cerr << "No translation file for locale: "
<< locale.toStdString()
<< std::endl;
} }
else else
{ {

@ -35,7 +35,6 @@ MainWindow::MainWindow(QWidget *parent) :
m_ui(new Ui::MainWindow), m_ui(new Ui::MainWindow),
m_aboutDialog(0) m_aboutDialog(0)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_ui->setupUi(this); m_ui->setupUi(this);
connect(m_ui->actionNew, SIGNAL(activated()), this, SLOT(klakk())); connect(m_ui->actionNew, SIGNAL(activated()), this, SLOT(klakk()));
connect(m_ui->actionOpen, SIGNAL(activated()), this, SLOT(klakk())); connect(m_ui->actionOpen, SIGNAL(activated()), this, SLOT(klakk()));
@ -53,7 +52,6 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
qDebug() << __PRETTY_FUNCTION__;
delete m_ui; delete m_ui;
if (m_aboutDialog) delete m_aboutDialog; if (m_aboutDialog) delete m_aboutDialog;
} }
@ -65,8 +63,6 @@ void MainWindow::klakk()
void MainWindow::exportScene() void MainWindow::exportScene()
{ {
qDebug() << __PRETTY_FUNCTION__;
QFileDialog dialog(this, QFileDialog dialog(this,
tr("Export MindMap to image"), tr("Export MindMap to image"),
"/home/cs0rbagomba", "/home/cs0rbagomba",
@ -105,8 +101,6 @@ void MainWindow::exportScene()
void MainWindow::about() void MainWindow::about()
{ {
qDebug() << __PRETTY_FUNCTION__;
setDisabled(true); setDisabled(true);
if (m_aboutDialog == 0) m_aboutDialog = new AboutDialog(this); if (m_aboutDialog == 0) m_aboutDialog = new AboutDialog(this);
m_aboutDialog->setEnabled(true); // children inherits enabled status m_aboutDialog->setEnabled(true); // children inherits enabled status
@ -115,10 +109,7 @@ void MainWindow::about()
void MainWindow::aboutDestroyed() void MainWindow::aboutDestroyed()
{ {
qDebug() << __PRETTY_FUNCTION__;
qDebug() << m_aboutDialog;
setEnabled(true); setEnabled(true);
} }
QStatusBar * MainWindow::getStatusBar() QStatusBar * MainWindow::getStatusBar()

@ -14,11 +14,9 @@ Node::Node(GraphWidget *parent) :
m_hasBorder(true), m_hasBorder(true),
m_numberIsSpecial(false) m_numberIsSpecial(false)
{ {
qDebug() << __PRETTY_FUNCTION__;
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsGeometryChanges);
setTextInteractionFlags(Qt::TextBrowserInteraction); // setTextInteractionFlags(Qt::TextBrowserInteraction);
// setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); // setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
@ -33,34 +31,30 @@ Node::Node(GraphWidget *parent) :
Node::~Node() Node::~Node()
{ {
qDebug() << __PRETTY_FUNCTION__;
foreach (EdgeElement element, m_edgeList) delete element.edge; foreach (EdgeElement element, m_edgeList) delete element.edge;
} }
void Node::addEdge(Edge *edge, bool startsFromThisNode) void Node::addEdge(Edge *edge, bool startsFromThisNode)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_edgeList.push_back(EdgeElement(edge, startsFromThisNode)); m_edgeList.push_back(EdgeElement(edge, startsFromThisNode));
edge->adjust(); edge->adjust();
} }
void Node::removeEdge(Edge *edge) void Node::removeEdge(Edge *edge)
{ {
qDebug() << __PRETTY_FUNCTION__; for(QList<EdgeElement>::iterator it = m_edgeList.begin();
it != m_edgeList.end(); it++)
for(QList<EdgeElement>::iterator it = m_edgeList.begin(); it != m_edgeList.end(); it++) {
if (it->edge == edge) if (it->edge == edge)
{ {
m_edgeList.erase(it); m_edgeList.erase(it);
return; return;
} }
}
} }
QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value) QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
// qDebug() << __PRETTY_FUNCTION__;
switch (change) { switch (change) {
case ItemPositionChange: case ItemPositionChange:
@ -95,8 +89,6 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w) void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w)
{ {
// qDebug() << __PRETTY_FUNCTION__;
if (m_number != -1) if (m_number != -1)
{ {
painter->setBackground(m_numberIsSpecial ? Qt::green : Qt::yellow); painter->setBackground(m_numberIsSpecial ? Qt::green : Qt::yellow);
@ -117,14 +109,13 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
painter->setPen(Qt::white); painter->setPen(Qt::white);
painter->setBackground(Qt::red); painter->setBackground(Qt::red);
painter->setBackgroundMode(Qt::OpaqueMode); painter->setBackgroundMode(Qt::OpaqueMode);
painter->drawText(boundingRect().topLeft()+QPointF(0,11), QString("%1").arg(m_number)); painter->drawText(boundingRect().topLeft()+QPointF(0,11),
QString("%1").arg(m_number));
} }
} }
void Node::setActive(const bool &active) void Node::setActive(const bool &active)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_isActive = active; m_isActive = active;
update(); update();
} }
@ -133,8 +124,6 @@ void Node::setActive(const bool &active)
/// @note who shall set active: press or release? /// @note who shall set active: press or release?
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_graph->setActiveNode(this); m_graph->setActiveNode(this);
QGraphicsItem::mousePressEvent(event); QGraphicsItem::mousePressEvent(event);
@ -142,8 +131,6 @@ void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
void Node::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) void Node::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{ {
qDebug() << __PRETTY_FUNCTION__;
m_graph->insertNode(); m_graph->insertNode();
QGraphicsItem::mouseDoubleClickEvent(event); QGraphicsItem::mouseDoubleClickEvent(event);
@ -151,22 +138,18 @@ void Node::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
qDebug() << __PRETTY_FUNCTION__;
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
// qDebug() << __PRETTY_FUNCTION__;
QGraphicsItem::mouseMoveEvent(event); QGraphicsItem::mouseMoveEvent(event);
} }
void Node::showNumber(const int &number, const bool& show, const bool &numberIsSpecial) void Node::showNumber(const int &number,
const bool& show,
const bool &numberIsSpecial)
{ {
// qDebug() << __PRETTY_FUNCTION__;
m_number = show ? number : -1; m_number = show ? number : -1;
m_numberIsSpecial = numberIsSpecial; m_numberIsSpecial = numberIsSpecial;
update(); update();
@ -180,8 +163,6 @@ void Node::setBorder(const bool &hasBorder)
double Node::calculateBiggestAngle() double Node::calculateBiggestAngle()
{ {
qDebug() << __PRETTY_FUNCTION__;
if (m_edgeList.empty()) if (m_edgeList.empty())
return 1.5 * Pi; return 1.5 * Pi;
@ -198,30 +179,23 @@ double Node::calculateBiggestAngle()
} }
QList<double> tmp; QList<double> tmp;
for(QList<EdgeElement>::iterator it = m_edgeList.begin(); it != m_edgeList.end(); it++) for(QList<EdgeElement>::iterator it = m_edgeList.begin();
{ it != m_edgeList.end(); it++)
if (it->startsFromThisNode)
{
tmp.push_back(Pi - it->edge->getAngle());
}
else
{ {
tmp.push_back(2 * Pi - it->edge->getAngle()); tmp.push_back(it->startsFromThisNode ?
} it->edge->getAngle() :
doubleModulo(Pi + it->edge->getAngle(), 2 * Pi));
} }
qSort(tmp.begin(), tmp.end()); qSort(tmp.begin(), tmp.end());
qDebug() << tmp; double prev(tmp.first());
double prev(tmp.last());
double max_prev(tmp.last()); double max_prev(tmp.last());
double max(0); double max(2 * Pi - tmp.last() + tmp.first());
/// @bug algorith is baaad for(QList<double>::const_iterator it = ++tmp.begin(); it!=tmp.end(); it++)
for(QList<double>::const_iterator it = tmp.begin(); it!=tmp.end(); it++)
{ {
if (abs(*it - prev) > abs(max) ) if (*it - prev > max )
{ {
max = *it - prev; max = *it - prev;
max_prev = prev; max_prev = prev;
@ -229,10 +203,7 @@ double Node::calculateBiggestAngle()
prev = *it; prev = *it;
} }
qDebug() << max; return 2 * Pi - doubleModulo(max_prev + max / 2, 2 * Pi);
qDebug() << max_prev;
return max_prev + max / 2 ;
} }
void Node::linkActivated(const QString &link) void Node::linkActivated(const QString &link)
@ -241,3 +212,8 @@ void Node::linkActivated(const QString &link)
qDebug() << link; qDebug() << link;
} }
double Node::doubleModulo(const double &devided, const double &devisor)
{
return devided - static_cast<double>(devisor * static_cast<int>(devided / devisor));
}

@ -17,15 +17,16 @@ public:
void addEdge(Edge *edge, bool startsFromThisNode); void addEdge(Edge *edge, bool startsFromThisNode);
void removeEdge(Edge *edge); void removeEdge(Edge *edge);
// QList<Edge *> edges() const;
void setBorder(const bool &hasBorder); void setBorder(const bool &hasBorder);
void setActive(const bool &active = true); void setActive(const bool &active = true);
void showNumber(const int &number, const bool& show = true, const bool &numberIsSpecial = false); void showNumber(const int &number, const bool& show = true,
const bool &numberIsSpecial = false);
double calculateBiggestAngle(); double calculateBiggestAngle();
protected: protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
@ -35,25 +36,18 @@ protected:
private: private:
double doubleModulo(const double &devided, const double &devisor);
struct EdgeElement struct EdgeElement
{ {
Edge *edge; Edge *edge;
bool startsFromThisNode; bool startsFromThisNode;
EdgeElement(Edge *e, bool s) : edge(e), startsFromThisNode(s) {} EdgeElement(Edge *e, bool s) : edge(e), startsFromThisNode(s) {}
}; };
// class EdgeList : public QList<EdgeElement>
// {
// public:
// int compareItems(QCollection::Item a, QCollection::Item b)
// {
// return (EdgeElement)a.edge = (EdgeElement)b.edge;
// }
// };
QList<EdgeElement> m_edgeList; QList<EdgeElement> m_edgeList;
GraphWidget *m_graph; GraphWidget *m_graph;
bool m_isActive; bool m_isActive;
// Edge *m_activeEdge;
int m_number; int m_number;
bool m_hasBorder; bool m_hasBorder;
bool m_numberIsSpecial; bool m_numberIsSpecial;

@ -1,244 +0,0 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.AutoIndent" type="bool">true</value>
<value key="EditorConfiguration.AutoSpacesForTabs" type="bool">false</value>
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
<value key="EditorConfiguration.DoubleIndentBlocks" type="bool">false</value>
<value key="EditorConfiguration.IndentBraces" type="bool">false</value>
<value key="EditorConfiguration.IndentSize" type="int">4</value>
<value key="EditorConfiguration.MouseNavigation" type="bool">true</value>
<value key="EditorConfiguration.PaddingMode" type="int">1</value>
<value key="EditorConfiguration.ScrollWheelZooming" type="bool">true</value>
<value key="EditorConfiguration.SmartBackspace" type="bool">false</value>
<value key="EditorConfiguration.SpacesForTabs" type="bool">true</value>
<value key="EditorConfiguration.TabKeyBehavior" type="int">0</value>
<value key="EditorConfiguration.TabSize" type="int">8</value>
<value key="EditorConfiguration.UseGlobal" type="bool">true</value>
<value key="EditorConfiguration.Utf8BomBehavior" type="int">1</value>
<value key="EditorConfiguration.addFinalNewLine" type="bool">true</value>
<value key="EditorConfiguration.cleanIndentation" type="bool">true</value>
<value key="EditorConfiguration.cleanWhitespace" type="bool">true</value>
<value key="EditorConfiguration.inEntireDocument" type="bool">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
<value key="ProjectExplorer.Target.ActiveDeployConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Release</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/cs0rbagomba/projects/qtmindmap-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString"></value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.DeployConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">0</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Deploy</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">No deployment</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value key="ProjectExplorer.Target.DeployConfigurationCount" type="int">1</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<valuelist key="Analyzer.Valgrind.AddedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.FilterExternalIssues" type="bool">true</value>
<value key="Analyzer.Valgrind.NumCallers" type="int">25</value>
<valuelist key="Analyzer.Valgrind.RemovedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.TrackOrigins" type="bool">true</value>
<value key="Analyzer.Valgrind.ValgrindExecutable" type="QString">valgrind</value>
<valuelist key="Analyzer.Valgrind.VisibleErrorKinds" type="QVariantList">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qtmindmap</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QString"></value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qtmindmap.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">true</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.RunConfiguration.1" type="QVariantMap">
<valuelist key="Analyzer.Valgrind.AddedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.FilterExternalIssues" type="bool">true</value>
<value key="Analyzer.Valgrind.NumCallers" type="int">25</value>
<valuelist key="Analyzer.Valgrind.RemovedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.TrackOrigins" type="bool">true</value>
<value key="Analyzer.Valgrind.ValgrindExecutable" type="QString">valgrind</value>
<valuelist key="Analyzer.Valgrind.VisibleErrorKinds" type="QVariantList">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QString">-q --tool=memcheck --leak-check=full --leak-resolution=low --suppressions=../qtmindmap/Qt47supp.txt ./qtmindmap</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.Executable" type="QString">valgrind</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory" type="QString">/home/cs0rbagomba/projects/qtmindmap-build-desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Run valgrind</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{75e4e232-a182-46a5-bb12-10bf44c99a73}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">9</value>
</data>
</qtcreator>

@ -0,0 +1,26 @@
QT += core gui svg
CONFIG += qtestlib
TARGET = qtmindmap_test
SOURCES += mainwindow.cpp \
aboutdialog.cpp \
graphwidget.cpp \
node.cpp \
edge.cpp \
systemtray.cpp \
argumentparser.cpp \
algorithmtests.cpp
HEADERS += mainwindow.h \
aboutdialog.h \
graphwidget.h \
node.h \
edge.h \
systemtray.h \
argumentparser.h \
algorithmtests.h
FORMS += mainwindow.ui \
aboutdialog.ui

@ -1,26 +1,26 @@
#include "systemtray.h" #include "systemtray.h"
#include <QApplication> #include <QApplication>
#include <QDebug>
void SystemTray::setup() void SystemTray::setup()
{ {
qDebug() << __PRETTY_FUNCTION__;
m_systemTrayIcon = new QSystemTrayIcon(0); m_systemTrayIcon = new QSystemTrayIcon(0);
m_minimizeAction = new QAction(tr("Mi&nimize"), m_systemTrayIcon); m_minimizeAction = new QAction(tr("Mi&nimize"), m_systemTrayIcon);
connect(m_minimizeAction, SIGNAL(triggered()), m_mainWindow, SLOT(hide())); connect(m_minimizeAction, SIGNAL(triggered()), m_mainWindow,
SLOT(hide()));
m_maximizeAction = new QAction(tr("Ma&ximize"), m_systemTrayIcon); m_maximizeAction = new QAction(tr("Ma&ximize"), m_systemTrayIcon);
connect(m_maximizeAction, SIGNAL(triggered()), m_mainWindow, SLOT(showMaximized())); connect(m_maximizeAction, SIGNAL(triggered()), m_mainWindow,
SLOT(showMaximized()));
m_restoreAction = new QAction(tr("&Restore"), m_systemTrayIcon); m_restoreAction = new QAction(tr("&Restore"), m_systemTrayIcon);
connect(m_restoreAction, SIGNAL(triggered()), m_mainWindow, SLOT(showNormal())); connect(m_restoreAction, SIGNAL(triggered()), m_mainWindow,
SLOT(showNormal()));
m_quitAction = new QAction(tr("&Quit"), m_systemTrayIcon); m_quitAction = new QAction(tr("&Quit"), m_systemTrayIcon);
connect(m_quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(m_quitAction, SIGNAL(triggered()), qApp,
SLOT(quit()));
m_trayIconMenu = new QMenu(this); m_trayIconMenu = new QMenu(this);
m_trayIconMenu->addAction(m_minimizeAction); m_trayIconMenu->addAction(m_minimizeAction);
@ -39,13 +39,10 @@ SystemTray::SystemTray(MainWindow *mainWindow, QWidget *parent) :
QWidget(parent), QWidget(parent),
m_mainWindow(mainWindow) m_mainWindow(mainWindow)
{ {
qDebug() << __PRETTY_FUNCTION__;
} }
void SystemTray::show() void SystemTray::show()
{ {
qDebug() << __PRETTY_FUNCTION__;
m_systemTrayIcon->show(); m_systemTrayIcon->show();
} }

Loading…
Cancel
Save