From: Dirk H Bartley Date: Thu, 24 May 2007 21:06:17 +0000 (+0000) Subject: Experimenting with adding icons to a tree widget in the restore class. This X-Git-Tag: Release-7.0.0~6243 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ff01daf6662834a635872c94ab19407b3362c7dd;p=bacula%2Fbacula Experimenting with adding icons to a tree widget in the restore class. This shows a green check if checked and a verrry light grey check if unchecked. I created these icons myself in inkscape. *.svg are also committed. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4902 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/images/check.png b/bacula/src/qt-console/images/check.png new file mode 100644 index 0000000000..84055cc7a6 Binary files /dev/null and b/bacula/src/qt-console/images/check.png differ diff --git a/bacula/src/qt-console/images/check.svg b/bacula/src/qt-console/images/check.svg new file mode 100644 index 0000000000..81095a37c0 --- /dev/null +++ b/bacula/src/qt-console/images/check.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/bacula/src/qt-console/images/unchecked.png b/bacula/src/qt-console/images/unchecked.png new file mode 100644 index 0000000000..ccd9e8b395 Binary files /dev/null and b/bacula/src/qt-console/images/unchecked.png differ diff --git a/bacula/src/qt-console/images/unchecked.svg b/bacula/src/qt-console/images/unchecked.svg new file mode 100644 index 0000000000..a4dc57955e --- /dev/null +++ b/bacula/src/qt-console/images/unchecked.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/bacula/src/qt-console/main.qrc b/bacula/src/qt-console/main.qrc index 862d71edfb..bb946e4485 100644 --- a/bacula/src/qt-console/main.qrc +++ b/bacula/src/qt-console/main.qrc @@ -24,5 +24,7 @@ images/undo.png images/unmark.png images/up.png + images/check.png + images/unchecked.png diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 0b3d252661..d4e2dd1a09 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -132,12 +132,17 @@ void restorePage::fillDirectory() } split_path_and_filename(p, &path, &pnl, &file, &fnl); item.clear(); - item << marked << file << modes << user << group << size << date; + item << "" << file << modes << user << group << size << date; if (item[1].endsWith("/")) { addDirectory(item[1]); - } + } QTreeWidgetItem *ti = new QTreeWidgetItem((QTreeWidget *)0, item); ti->setTextAlignment(5, Qt::AlignRight); /* right align size */ + if (strcmp(marked, "*") == 0) { + ti->setIcon(0,QIcon(QString::fromUtf8(":images/check.png"))); + } else { + ti->setIcon(0,QIcon(QString::fromUtf8(":images/unchecked.png"))); + } treeItemList.append(ti); } fileWidget->clear(); @@ -267,10 +272,10 @@ void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column) if (column == 0) { /* mark/unmark */ if (item->text(0) == "*") { bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data()); - item->setText(0, " "); + item->setIcon(0, QIcon(QString::fromUtf8(":images/unchecked.png"))); } else { bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data()); - item->setText(0, "*"); + item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png"))); } m_console->write_dir(cmd); if (m_console->read() > 0) { @@ -325,7 +330,7 @@ void restorePage::markButtonPushed() char cmd[1000]; foreach (item, treeItemList) { bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data()); - item->setText(0, "*"); + item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png"))); m_console->write_dir(cmd); if (m_console->read() > 0) { strip_trailing_junk(m_console->msg()); @@ -346,7 +351,7 @@ void restorePage::unmarkButtonPushed() char cmd[1000]; foreach (item, treeItemList) { bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data()); - item->setText(0, " "); + item->setIcon(0, QIcon(QString::fromUtf8(":images/unchecked.png"))); m_console->write_dir(cmd); if (m_console->read() > 0) { strip_trailing_junk(m_console->msg());