Skip to content

Commit

Permalink
better missing connector in bus message
Browse files Browse the repository at this point in the history
  • Loading branch information
irascible committed Nov 28, 2015
1 parent d691747 commit 526d3a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/connectors/busshared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
#include "connectorshared.h"
#include "../debugdialog.h"
#include "connectoritem.h"
#include "../utils/textutils.h"

BusShared::BusShared(const QString & id)
{
Expand All @@ -53,7 +54,10 @@ void BusShared::initConnector(QDomElement & connector, const QHash<QString, QPoi

ConnectorShared * connectorShared = connectorHash.value(id);
if (connectorShared == NULL) {
DebugDialog::debug(QString("no connector is found for bus nodeMember %1").arg(id));
QDomDocument document = connector.ownerDocument();
DebugDialog::debug(QString("no connector is found for bus nodeMember %1 in %2")
.arg(id)
.arg(TextUtils::elementToString(document.documentElement())));
return;
}

Expand Down
11 changes: 11 additions & 0 deletions src/utils/textutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,3 +1921,14 @@ void TextUtils::resplit(QStringList & names, const QString & split) {
names.append(result);
}

QString TextUtils::elementToString(const QDomElement & element) {
QString string = "<";
string += element.tagName();
QDomNamedNodeMap attributes = element.attributes();
for (int i = 0; i < attributes.count(); i++) {
QDomNode attribute = attributes.item(i);
string += QString(" %1='%2'").arg(attribute.nodeName()).arg(attribute.nodeValue());
}
string +="/>";
return string;
}
1 change: 1 addition & 0 deletions src/utils/textutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class TextUtils
static QString findAnchor(const QDomElement & text);
static double getStrokeWidth(QDomElement &, double defaultValue);
static void resplit(QStringList & names, const QString & split);
static QString elementToString(const QDomElement &);

public:
static const QRegExp FindWhitespace;
Expand Down

0 comments on commit 526d3a2

Please sign in to comment.