summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-06 11:01:33 +0200
committerJan Darmochwal2010-10-06 11:01:33 +0200
commit87916ccf71bd35f41a84c1e8f0fe211b5279c558 (patch)
tree1e24297ade776b151d163db7e48081a9fa63a613
parenti18n support and German translation (diff)
downloadvmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.tar.gz
vmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.tar.xz
vmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.zip
Remove debug printfs
-rw-r--r--src/dialog.cpp10
-rw-r--r--src/main.cpp3
-rw-r--r--src/sessiontreemodel.cpp3
-rw-r--r--src/vsession.cpp30
-rw-r--r--src/xsession.cpp9
5 files changed, 1 insertions, 54 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 7ebfbcc..d09ff19 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -48,7 +48,6 @@ void Dialog::changeEvent(QEvent *e)
void Dialog::on_treeView_activated(QModelIndex index)
{
//TODO handle failures
- //printf ("Item %d has been activated\n", index.row());
//TODO get rid of this->entries, storing them in the model should be enough
// alternatively use references instead of copies?
@@ -72,15 +71,6 @@ void Dialog::on_treeView_activated(QModelIndex index)
}
void Dialog::addItems(const QList<Session*>& entries, const QString& section) {
- // TODO: section
- // TODO: this is not the right way to do this
- // we probably do not need a copy of the entries vector in Dialog and Model
- //printf("Dialog::addItems()\n");
- //printf(" before: %d items\n", this->entries_.size());
- //printf(" %d new items\n", entries.size());
- //this->entries_.append(entries);
- //printf(" after: %d items\n", this->entries_.size());
-
this->model_->addItems(entries, section);
// TODO: do this only once?
diff --git a/src/main.cpp b/src/main.cpp
index c44d362..87bb84f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -187,9 +187,6 @@ int main(int argc, char *argv[]) {
QList<Session*> xsessions(XSession::readSessions(lsesspath));
QList<Session*> vsessions(VSession::readXmlDir(xmlpath));
- printf ("%d VSessions\n", vsessions.size());
- printf ("%d XSessions\n", xsessions.size());
-
Dialog w;
w.resize(width, height);
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp
index d3cd7ac..a5088d2 100644
--- a/src/sessiontreemodel.cpp
+++ b/src/sessiontreemodel.cpp
@@ -7,7 +7,6 @@
SessionTreeModel::SessionTreeModel(QObject *parent)
: QAbstractItemModel(parent)
{
- printf("new SessionTreeModel created\n");
root_ = new SessionTreeItem("dummy");
}
@@ -44,8 +43,6 @@ int SessionTreeModel::rowCount(const QModelIndex &parent) const
QVariant SessionTreeModel::data(const QModelIndex &index, int role) const
{
- printf("request for model row %d role %d\n", index.row(), role);
-
if (!index.isValid()) {
return QVariant();
}
diff --git a/src/vsession.cpp b/src/vsession.cpp
index 35292d2..bd86610 100644
--- a/src/vsession.cpp
+++ b/src/vsession.cpp
@@ -15,8 +15,6 @@
#include "vsession.h"
bool VSession::init(const QString& xml, const QString& baseDirPath) {
- printf("VSession::init(xml, %s)\n", baseDirPath.toAscii().data());
- //printf("xml = %s\n", xml.toAscii().data());
this->baseDirPath_ = baseDirPath;
return this->doc_.setContent(xml);
}
@@ -25,24 +23,15 @@ void VSession::addNodeWithAttribute(const QString& nodeName,
const QString& value,
const QString& attribute,
bool replace) {
-
- printf("VSession:addNodeWithAttribute(%s, %s, %s, %d)\n",
- nodeName.toUtf8().data(),
- value.toUtf8().data(),
- attribute.toUtf8().data(),
- replace);
-
QDomElement node =
this->doc_.namedItem("eintrag").namedItem(nodeName).toElement();
if (replace == false || node.isNull()) {
- printf(" creating new node\n");
// create a new node
node = this->doc_.createElement(nodeName);
this->doc_.namedItem("eintrag").appendChild(node);
}
- printf(" setting attribute\n");
node.setAttribute(attribute, value);
}
@@ -52,19 +41,12 @@ QString VSession::toXml() const {
QString VSession::getAttribute(const QString &nodeName,
const QString &attribute) const {
- printf ("VSession::getAttribute(%s, %s)\n", nodeName.toAscii().data(), attribute.toAscii().data());
QDomDocument doc = this->doc_;
- //printf (" doc xml:\n%s\n", doc.toString().toAscii().data());
QDomNode n = doc.namedItem("eintrag").namedItem(nodeName);
if (n.isNull()) {
- printf(" failed to find node\n");
+ // TODO
}
- printf(" node name: %s\n", n.nodeName().toAscii().data());
- printf(" node type: %d\n", n.nodeType());
- printf(" node value: %s\n", n.nodeValue().toAscii().data());
- printf(" attribute %s=%s\n", attribute.toUtf8().data(), this->doc_.namedItem("eintrag").namedItem(nodeName).toElement().attribute(attribute).toUtf8().data());
- //printf (" --> %s\n", this->doc_.namedItem("eintrag").namedItem(nodeName).namedItem(attribute).toAttr().value());
return this->doc_.namedItem("eintrag").namedItem(nodeName).toElement().attribute(attribute);
}
@@ -174,7 +156,6 @@ void VSession::addScanners(const QString& script) {
}
void VSession::addUserAndHostname() {
- printf("VSession::addUserAndHostname()\n");
QString username(getpwuid(geteuid())->pw_name);
this->addNodeWithAttribute("username", username);
@@ -199,8 +180,6 @@ void VSession::addUserAndHostname() {
}
bool VSession::run() const {
-
- printf("VSession::run()\n");
QString command = getAttribute("command");
if (! command.isEmpty()) {
if (QProcess::startDetached(command)) {
@@ -242,19 +221,16 @@ bool VSession::run() const {
}
QList<Session*> VSession::readXmlFile(const QString& filepath) {
- printf("VSession::readXmlFile(%s)\n", filepath.toAscii().data());
QList<Session*> retval;
QDomDocument doc;
QFile file(filepath);
if (!file.open(QIODevice::ReadOnly)) {
// TODO: error message
- printf("error: cannot open file\n");
return retval;
}
if (!doc.setContent(&file)) {
// TODO: error message
- printf("error: cannot parse file\n");
file.close();
return retval;
}
@@ -266,12 +242,10 @@ QList<Session*> VSession::readXmlFile(const QString& filepath) {
for (QDomElement el(settingsNode.firstChildElement("eintrag"));
!el.isNull();
el = el.nextSiblingElement("eintrag")) {
- printf("reading %s node\n", el.tagName().toAscii().data());
QDomDocument dummy;
dummy.appendChild(dummy.importNode(el, true));
VSession* e = new VSession;
if (e->init(dummy.toString(), dirName)) {
- printf("appending node\n");
retval.append(e);
}
}
@@ -284,7 +258,6 @@ QList<Session*> VSession::readXmlFile(const QString& filepath) {
* - reads all xml files and creates for each its own VSession-struct
*/
QList<Session*> VSession::readXmlDir(const QString& path) {
- printf("VSession::readXmlDir(%s)\n", path.toAscii().data());
QList<Session*> retval;
QDir appDir(QApplication::applicationDirPath());
@@ -310,7 +283,6 @@ QList<Session*> VSession::readXmlDir(const QString& path) {
}
}
- printf("VSession::readXmlDir(%s), read %d entries\n", path.toAscii().data(), retval.size());
return retval;
}
diff --git a/src/xsession.cpp b/src/xsession.cpp
index fb274b4..6fc34e3 100644
--- a/src/xsession.cpp
+++ b/src/xsession.cpp
@@ -9,7 +9,6 @@
// TODO: void instead of bool? (or return something useful)
bool XSession::init(const QString& name, const QString& exec,
const QString& comment, const QString& icon) {
- printf("XSession::init()\n");
this->name_ = name;
this->exec_ = exec;
this->comment_ = comment;
@@ -51,10 +50,8 @@ bool XSession::run() const {
}
QList<Session*> XSession::readSessions(const QString& path) {
- printf("XSession::readSessions(%s)\n", path.toAscii().data());
QList<Session*> retval;
foreach (QFileInfo fi, QDir(path).entryInfoList(QStringList("*.desktop"))) {
- printf(" reading %s\n", fi.absoluteFilePath().toAscii().data());
if (fi.baseName().compare("default.desktop") == 0) {
continue;
}
@@ -63,17 +60,14 @@ QList<Session*> XSession::readSessions(const QString& path) {
settings.setIniCodec("UTF-8");
settings.beginGroup("Desktop Entry");
- printf(" keys: %s\n", settings.allKeys().join(",").toAscii().data());
if (settings.value("NoDisplay").toString().compare("true") == 0 ||
settings.value("Hidden").toString().compare("true") == 0) {
continue;
- printf(" session is hidden\n");
}
if (!settings.contains("Exec")) {
// TODO: error message
- printf(" no exec found\n");
continue;
}
QString exec(settings.value("Exec").toString());
@@ -89,7 +83,6 @@ QList<Session*> XSession::readSessions(const QString& path) {
name = settings.value("Name").toString();
} else {
// TODO: error message
- printf(" no name found\n");
continue;
}
@@ -110,8 +103,6 @@ QList<Session*> XSession::readSessions(const QString& path) {
icon = QString();
}
- printf(" adding session %s\n", name.toAscii().data());
-
XSession* session = new XSession;
session->init(name, exec, comment, icon);