[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bacula-devel] patch: smoother refresh for bat


Hello,
the attached patch freezes grids and trees during refresh to avoid unpleasant artifacts and gain a bit of speed.

Greetings,
Riccardo
Index: bacula/src/qt-console/fileset/fileset.cpp
===================================================================
--- bacula/src/qt-console/fileset/fileset.cpp	(revision 7942)
+++ bacula/src/qt-console/fileset/fileset.cpp	(working copy)
@@ -75,7 +75,7 @@
        return;
    m_populated = true;
 
-   QBrush blackBrush(Qt::black);
+   Freeze frz(*tableWidget); /* disable updating*/
 
    m_checkcurwidget = false;
    tableWidget->clear();
Index: bacula/src/qt-console/clients/clients.cpp
===================================================================
--- bacula/src/qt-console/clients/clients.cpp	(revision 7942)
+++ bacula/src/qt-console/clients/clients.cpp	(working copy)
@@ -76,7 +76,7 @@
       return;
    m_populated = true;
 
-   QBrush blackBrush(Qt::black);
+   Freeze frz(*tableWidget); /* disable updating*/
 
    QStringList headerlist = (QStringList() << tr("Client Name") << tr("File Retention")
        << tr("Job Retention") << tr("AutoPrune") << tr("ClientId") << tr("Uname") );
Index: bacula/src/qt-console/storage/storage.cpp
===================================================================
--- bacula/src/qt-console/storage/storage.cpp	(revision 7942)
+++ bacula/src/qt-console/storage/storage.cpp	(working copy)
@@ -81,6 +81,8 @@
       writeExpandedSettings();
    m_populated = true;
 
+   Freeze frz(*mp_treeWidget); /* disable updating*/
+
    m_checkcurwidget = false;
    mp_treeWidget->clear();
    m_checkcurwidget = true;
Index: bacula/src/qt-console/medialist/medialist.cpp
===================================================================
--- bacula/src/qt-console/medialist/medialist.cpp	(revision 7942)
+++ bacula/src/qt-console/medialist/medialist.cpp	(working copy)
@@ -80,11 +80,11 @@
       writeExpandedSettings();
    m_populated = true;
 
-   QTreeWidgetItem *pooltreeitem;
-
    if (!m_console->preventInUseConnect())
        return;
 
+   Freeze frz(*mp_treeWidget); /* disable updating*/
+
    QStringList headerlist = (QStringList()
       << tr("Volume Name") << tr("Id") << tr("Status") << tr("Enabled") << tr("Bytes") << tr("Files")
       << tr("Jobs") << tr("Retention") << tr("Media Type") << tr("Slot") << tr("Use Duration")
@@ -106,6 +106,7 @@
    settings.beginGroup("MediaListTreeExpanded");
    QString query;
 
+   QTreeWidgetItem *pooltreeitem;
    foreach (QString pool_listItem, m_console->pool_list) {
       pooltreeitem = new QTreeWidgetItem(m_topItem);
       pooltreeitem->setText(0, pool_listItem);
Index: bacula/src/qt-console/jobs/jobs.cpp
===================================================================
--- bacula/src/qt-console/jobs/jobs.cpp	(revision 7942)
+++ bacula/src/qt-console/jobs/jobs.cpp	(working copy)
@@ -72,6 +72,9 @@
    if (!m_console->preventInUseConnect())
       return;
    m_populated = true;
+
+   Freeze frz(*tableWidget); /* disable updating*/
+
    QBrush blackBrush(Qt::black);
    m_checkcurwidget = false;
    tableWidget->clear();
Index: bacula/src/qt-console/joblist/joblist.cpp
===================================================================
--- bacula/src/qt-console/joblist/joblist.cpp	(revision 7942)
+++ bacula/src/qt-console/joblist/joblist.cpp	(working copy)
@@ -115,6 +115,8 @@
    prepareFilterWidgets();
    m_populated = true;
 
+   Freeze frz(*mp_tableWidget); /* disable updating*/
+
    /* Set up query */
    QString query;
    fillQueryString(query);
Index: bacula/src/qt-console/util/fmtwidgetitem.h
===================================================================
--- bacula/src/qt-console/util/fmtwidgetitem.h	(revision 7942)
+++ bacula/src/qt-console/util/fmtwidgetitem.h	(working copy)
@@ -33,6 +33,7 @@
  *   TreeView formatting helpers - Riccardo Ghetta, May 2008 
  */
 
+class QWidget;
 class QTreeWidgetItem;
 class QTableWidget;
 class QTableWidgetItem;
@@ -46,7 +47,21 @@
  */
 QString convertJobStatus(const QString &sts);
 
+/*
+ * disable widget updating
+ */
+class Freeze
+{
+private:
+   QWidget *qw;
 
+ public:
+   Freeze(QWidget &q);
+   ~Freeze();
+};
+
+
+
 /*
  * base class for formatters
  *
Index: bacula/src/qt-console/util/fmtwidgetitem.cpp
===================================================================
--- bacula/src/qt-console/util/fmtwidgetitem.cpp	(revision 7942)
+++ bacula/src/qt-console/util/fmtwidgetitem.cpp	(working copy)
@@ -63,6 +63,24 @@
    return QString(buf);
 }
 
+/*
+ * disable widget updating
+ */
+Freeze::Freeze(QWidget &q):
+qw(&q)
+{
+   QApplication::setOverrideCursor(Qt::WaitCursor);
+   qw->setUpdatesEnabled(false); 
+}
+
+Freeze::~Freeze()
+{
+   if (qw) {
+      qw->setUpdatesEnabled(true); 
+      QApplication::restoreOverrideCursor();
+   }
+}
+
 /***********************************************
  *
  * ItemFormatterBase static members
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.