]> git.sur5r.net Git - bacula/bacula/commitdiff
Make qt-console compatible to Qt5 (Qt4 still work)
authorNorbert Bizet <norbert.bizet@baculasystems.com>
Fri, 20 Oct 2017 08:29:16 +0000 (10:29 +0200)
committerKern Sibbald <kern@sibbald.com>
Sun, 12 Nov 2017 10:29:38 +0000 (11:29 +0100)
Replace #include <QtGui> with #include <QtWidgets>
Replace toAscii with toLatin1 (deprecated)
Obsolete Plastic theme and SetCodecForCString

46 files changed:
bacula/src/qt-console/RegistrationWizard/RegistrationWizard.pro.in [new file with mode: 0644]
bacula/src/qt-console/bat.h
bacula/src/qt-console/bat.pro.in
bacula/src/qt-console/bcomm/dircomm.h
bacula/src/qt-console/clients/clients.h
bacula/src/qt-console/console/console.h
bacula/src/qt-console/fileset/fileset.h
bacula/src/qt-console/job/job.cpp
bacula/src/qt-console/job/job.h
bacula/src/qt-console/jobgraphs/jobplot.cpp
bacula/src/qt-console/jobgraphs/jobplot.h
bacula/src/qt-console/joblist/joblist.h
bacula/src/qt-console/joblog/joblog.h
bacula/src/qt-console/jobs/jobs.h
bacula/src/qt-console/label/label.h
bacula/src/qt-console/main.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/mediaedit/mediaedit.h
bacula/src/qt-console/mediainfo/mediainfo.cpp
bacula/src/qt-console/mediainfo/mediainfo.h
bacula/src/qt-console/medialist/medialist.h
bacula/src/qt-console/medialist/mediaview.cpp
bacula/src/qt-console/medialist/mediaview.h
bacula/src/qt-console/mount/mount.h
bacula/src/qt-console/pages.cpp
bacula/src/qt-console/pages.h
bacula/src/qt-console/relabel/relabel.h
bacula/src/qt-console/restore/restore.h
bacula/src/qt-console/restore/restoretree.cpp
bacula/src/qt-console/restore/restoretree.h
bacula/src/qt-console/run/run.h
bacula/src/qt-console/select/select.h
bacula/src/qt-console/select/textinput.h
bacula/src/qt-console/status/clientstat.h
bacula/src/qt-console/status/dirstat.h
bacula/src/qt-console/status/storstat.h
bacula/src/qt-console/storage/content.h
bacula/src/qt-console/storage/storage.h
bacula/src/qt-console/testprogs/putz/putz.h
bacula/src/qt-console/tray-monitor/common.h
bacula/src/qt-console/tray-monitor/runjob.h
bacula/src/qt-console/tray-monitor/tray-monitor.pro.in
bacula/src/qt-console/tray-monitor/tray-monitor.pro.mingw32.in
bacula/src/qt-console/tray-monitor/tray-monitor.pro.mingw64.in
bacula/src/qt-console/tray-monitor/tray-ui.h
bacula/src/qt-console/util/fmtwidgetitem.cpp

diff --git a/bacula/src/qt-console/RegistrationWizard/RegistrationWizard.pro.in b/bacula/src/qt-console/RegistrationWizard/RegistrationWizard.pro.in
new file mode 100644 (file)
index 0000000..0468154
--- /dev/null
@@ -0,0 +1,36 @@
+######################################################################
+#
+#  !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+#
+#  Edit only RegistrationWizard.pro.in  -- RegistrationWizard.pro is built by the ./configure program
+#
+#  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+#
+QT       += core gui network widgets
+lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5")
+
+TARGET = RegistrationWizard
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+
+SOURCES += \
+        main.cpp \
+        mainwindow.cpp
+
+HEADERS += \
+        mainwindow.h
+
+FORMS += \
+        mainwindow.ui \
+        authenticationdialog.ui
index ad26ed0a451b189f066490ca04d5a5acb205aff6..65ed2ad2a40a0bc590fbe1f04f9717830d9876de 100644 (file)
 #endif
 #define __CONFIG_H
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include <QtCore>
 #include "bacula.h"
 
index d1bbdb8629c5db5b1f6f8afe988124be93b08464..9728ecc78aedb6f40eb6d291f1e0c5d010425691 100644 (file)
@@ -8,7 +8,7 @@
 #
 CONFIG += qt debug @QWT@
 
-datarootdir = @datarootdir@
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 bins.path = /$(DESTDIR)@sbindir@
 bins.files = bat
index 11ba9706b16bfdf72b2a87e5c0c760448355a220..aca39d2fd1195ac5dc02ebfa65c89394795ae8d1 100644 (file)
  *   Kern Sibbald, January 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "pages.h"
 #include "ui_console.h"
 #include <QObject>
index 4ecdc00260de28e9bd27e3b04e5fb55eeaf4a416..8852fa9db3ff4aa431210fe7067b91e1c6aaad06 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_clients.h"
 #include "console.h"
 #include "pages.h"
index 0468676dad46f56f7b7b1866ecebcd171ab080ac..4f3179c7b1b269775ed0314cb0088000ad057790 100644 (file)
  *   Kern Sibbald, January 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "pages.h"
 #include "ui_console.h"
 #include "bcomm/dircomm.h"
index c6f431af07b4daaeec9615421176b61792c7fa04..03220feff8bafba168ebeddba2a7d0ffebe81d8e 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_fileset.h"
 #include "console.h"
 #include "pages.h"
index 67ad1b4cd2c82e1b8301d6c4228e1eebba5ca626..fce650035f8ca981fd3e27e43ada6e1c5859598e 100644 (file)
@@ -407,7 +407,7 @@ void Job::populateForm()
          label_JobId->setText(fld.next());
          label_Name->setText(fld.next());
          
-         label_Level->setText(job_level_to_str(fld.next()[0].toAscii()));
+         label_Level->setText(job_level_to_str(fld.next()[0].toLatin1()));
 
          m_client = fld.next();
          label_Client->setText(m_client);
@@ -457,7 +457,7 @@ void Job::populateForm()
             }
          }
          label_JobStatus->setPixmap(QPixmap(":/images/" + stat + ".png"));
-         jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf));
+         jobstatus_to_ascii_gui(stat[0].toLatin1(), buf, sizeof(buf));
          stat = buf;
          label_JobStatus->setToolTip(stat);
 
index 7f14463f698cfecb90bb76cdb59ee35dd5680f72..a1c6ab239e67151669807966ffd7dca09179768b 100644 (file)
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_job.h"
 #include "console.h"
 
index abb0b4608d6189430e649af620e4568a67d57e14..f3a938f74c445272b3813b924c43cf6fbf964203 100644 (file)
  */ 
 
 #include "bat.h"
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "util/comboutil.h"
 #include "jobgraphs/jobplot.h"
 
index 86a604890347925d1aa2057165d6703aa81a7e95..b6bea40d7826a2f6000d3d6508c0ea2273813724 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "pages.h"
 #include "ui_jobplotcontrols.h"
 #include <qwt_data.h>
index bc417626eb240649e2e363636e79859f6db963d3..d1033554c47c596ba25f64b4744292b6eb1e720c 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_joblist.h"
 #include "console.h"
 #include "pages.h"
index 255276e4280c4b0f202804bddb88e988bf5f9c8d..3011ea80be7b95dd9e34d5289eccc0c643913bb4 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_joblog.h"
 #include "console.h"
 
index 8622c95e111219854f6f3ebd29add44dd8ab0fb7..96bb5eab22145603b77846b35612e3797520b862 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_jobs.h"
 #include "console.h"
 #include "pages.h"
index 1fa741525603b16b6337d844219c2d0d6b7abe8a..094f6a438cbea28c88a6a36413029396fd3e237b 100644 (file)
 #ifndef _LABEL_H_
 #define _LABEL_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_label.h"
 #include "console.h"
 #include "pages.h"
index 4c94f5128f853eaa4643363dc3734d0b8212866b..cb6dc1c6124a798d08c0b268b40614ec296f84c2 100644 (file)
@@ -63,9 +63,11 @@ int main(int argc, char *argv[])
 
 
    app = new QApplication(argc, argv);        
-   app->setStyle(new QPlastiqueStyle());
    app->setQuitOnLastWindowClosed(true);
+#if QT_VERSION < 0x050000
+   app->setStyle(new QPlastiqueStyle());
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
+#endif
      
    QTranslator qtTranslator;
    qtTranslator.load(QString("qt_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
index a88c79deb246b0325d9c97d7905aa50f6e420836..5fd76c0fdcb06d9e8509d7a9bf304e0457b73313 100644 (file)
 #ifndef _MAINWIN_H_
 #define _MAINWIN_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include <QList>
 #include "ui_main.h"
 
index 5856f3080165e3bde951e68dbe9b5360f3cd9c73..89ed3dba616cfd657b1c892fee1c6d8b002b4112 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_mediaedit.h"
 #include "console.h"
 #include "pages.h"
index e6cb853573402d37f0fe5e6d09225e9072bfa8f0..2a45bdbcb0e3036348547a87a995835d24b0f5b9 100644 (file)
@@ -181,7 +181,7 @@ void MediaInfo::populateForm()
          label_VolRetention->setText(QString(buf));
 
          if (LastWritten != "") {
-            t = str_to_utime(LastWritten.toAscii().data());
+            t = str_to_utime(LastWritten.toLatin1().data());
             t = t + stat.toULongLong();
             ttime = t;
             localtime_r(&ttime, &tm);         
@@ -194,7 +194,7 @@ void MediaInfo::populateForm()
 
 //         stat=fld.next();
 
-//         jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf));
+//         jobstatus_to_ascii_gui(stat[0].toLatin1(), buf, sizeof(buf));
 //         stat = buf;
 //       
       }
index af5d5b8124d36390a943bb1b1ff7f1caa543d53a..7f3c732b08ca9fafa5c307e18c1668ba12d5d340 100644 (file)
  *
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_mediainfo.h"
 #include "console.h"
 #include "pages.h"
index 0c3f674352fa69b3c412050a46fe89ae97d2f540..487742ff2fe4406e02b782d29cd217e66c96ce5e 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_medialist.h"
 #include "console.h"
 #include <qstringlist.h>
index 9aa1db348f96264de8e93074693e12c9bbfdcd87..acc7fd60c5099958e427a399eb9b5c3fc186b986 100644 (file)
@@ -207,7 +207,7 @@ void MediaView::filterExipired(QStringList &list)
 
          } else {
             stat = fieldlist.at(8);
-            t = str_to_utime(LastWritten.toAscii().data());
+            t = str_to_utime(LastWritten.toLatin1().data());
             t = t + stat.toULongLong();
             if (t > now) {
                list.removeAt(i);
@@ -366,7 +366,7 @@ void MediaView::populateTable()
          buf[0] = 0;
          if (LastWritten != "") {
             stat = fld.next();  // VolUseDuration
-            t = str_to_utime(LastWritten.toAscii().data());
+            t = str_to_utime(LastWritten.toLatin1().data());
             t = t + stat.toULongLong();
             ttime = t;
             localtime_r(&ttime, &tm);         
index e2808c0519740417af60a98079e1d5886ae95eae..8b46c7e6165d1795877eb880069ca0824aaeb273 100644 (file)
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_mediaview.h"
 #include "console.h"
 #include <qstringlist.h>
index 4703c981f8a23574775bcbedf6839568d899cb1a..d2886909fc4467dc39f0358ac79bafb8734365fa 100644 (file)
 #ifndef _MOUNT_H_
 #define _MOUNT_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_mount.h"
 #include "console.h"
 
index 05713da4ba7c993ead526c24adf504beeb9d1348..0866817feaea9b963301c34fb2688262d4cdbcc4 100644 (file)
@@ -30,7 +30,7 @@ bool isWin32Path(QString &fullPath)
       return false;
    }
 
-   bool toret = fullPath[1].toAscii() == ':' && fullPath[0].isLetter();
+   bool toret = fullPath[1].toLatin1() == ':' && fullPath[0].isLetter();
    if (mainWin->m_miscDebug) {
       if (toret)
          Pmsg1(000, "returning from isWin32Path true %s\n", fullPath.toUtf8().data());
index 5467797c23f46c55d5080a60d1dbce4170cde161..a7eacf7422a41d1a5dce28ed6a5875f676267457 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include <QList>
 
 /*
index 105d6275706892f0b6b8444771e4855a7121f8b6..c1aeb260d39043623ca3e790aedffa04518af03a 100644 (file)
 #ifndef _RELABEL_H_
 #define _RELABEL_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_relabel.h"
 #include "console.h"
 
index 7ece0af40059afa1db1cc113f4a4ee5ecd493961..542c953a70da6f94ee3d22b8977911319f78cf7d 100644 (file)
 
 #include <stdint.h>
 #include <sys/types.h>     /* Needed for some systems */
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "pages.h"
 #include "ui_runrestore.h"
 
index d32270cf583f0cb44e7e3bfe0230baec84bf3f64..143f3c53bf26f5a158c0b5c79ae75c55157edbc4 100644 (file)
@@ -555,7 +555,7 @@ void restoreTree::fileCurrentItemChanged(QTableWidgetItem *currentFileTableItem,
                foreach (field, fieldlist) {
                   field = field.trimmed();  /* strip leading & trailing spaces */
                   if (column == 5 ) {
-                     QByteArray jtype(field.trimmed().toAscii());
+                     QByteArray jtype(field.trimmed().toLatin1());
                      if (jtype.size()) {
                         field = job_type_to_str(jtype[0]);
                      }
@@ -705,7 +705,7 @@ void restoreTree::populateJobTable()
                field = field.trimmed();  /* strip leading & trailing spaces */
                if (field != "") {
                   if (column == typeIndex) {
-                     QByteArray jtype(field.trimmed().toAscii());
+                     QByteArray jtype(field.trimmed().toLatin1());
                      if (jtype.size()) {
                         field = job_type_to_str(jtype[0]);
                      }
index 74b9f2fe4e9eaf19bc4918fe9c7e58be8aebb7bb..3bbef58947c0474dfcbb62476390db41d5b3befa 100644 (file)
  *  Kern Sibbald, February 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "pages.h"
 #include "ui_restoretree.h"
 
index ad9329c5248fcf9c74e171485784579bfbfff566..edbbcd9012a3d88fba5a36b415fe317135001ad4 100644 (file)
 #ifndef _RUN_H_
 #define _RUN_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_run.h"
 #include "ui_runcmd.h"
 #include "ui_estimate.h"
index 4589cc013a520e5294c7caad68f32ea20c61b5e2..057fa8744295e243140410a35d472387fe7cd059 100644 (file)
 #ifndef _SELECT_H_
 #define _SELECT_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_select.h"
 #include "console.h"
 
index 5165de9c2614b0a2bdba69a34422049e808b247a..68c97c4deceb43b949ec82b9acda922d5543821a 100644 (file)
 #ifndef _TEXTENTRY_H_
 #define _TEXTENTRY_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_textinput.h"
 #include "console.h"
 
index eb44b38e9b06afa1347754210986e437a7e08bbb..895f05900f1111a584f7691a9cc0412db37dbb86 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_clientstat.h"
 #include "console.h"
 #include "pages.h"
index f99634c3bd41da2e9b2acae50397a88a4a362da1..d07b5dfcd8aa4db2e82d7ac81322c5bd0f14e254 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_dirstat.h"
 #include "console.h"
 #include "pages.h"
index 86516c645ada3a331c50488163f67e85aa8b89cc..ab0dbb4eb4cf20a9c21087a50c2f63a2bc58185f 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_storstat.h"
 #include "console.h"
 #include "pages.h"
index 7877095e27ab6ec35c7543df690ef54792b78dac..36fa7b4eeaec7ee537ef590db9cf4c3a2a7771bc 100644 (file)
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_content.h"
 #include "console.h"
 #include "pages.h"
index a747f2aed4c0bc72e69b1a646bd82b256ebdda77..5352c48b3c4f8af8efc105f3d0408f4c749b7c74 100644 (file)
  *   Dirk Bartley, March 2007
  */
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_storage.h"
 #include "console.h"
 #include "pages.h"
index 97e6ba88cccb5fccd975e88c61c5035e860438a2..48675bf6e3ae50397274503e6bad3265da8f110c 100644 (file)
@@ -1,7 +1,11 @@
 #ifndef _PUTZ_H_
 #define _PUTZ_H_
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include "ui_putz.h"
 
 class Putz : public QMainWindow, public Ui::MainWindow
index ee555330cb2a071579235e1a99654370be287e0b..9b09abaa151e5ef43c58f7859ecfaf98f7775a80 100644 (file)
 #define __CONFIG_H
 
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
 #include <QtGui>
+#endif
 #include <QtCore>
 
 #include "bacula.h"
index 6333865bdff9ad4e9bac15800fb7dee1296a6587..f1ab60fa00d2b13092e20ea973cb5a0e40b0e374 100644 (file)
@@ -24,6 +24,7 @@
 #include "ui_run.h"
 #include "tray_conf.h"
 #include "task.h"
+#include <QDialog>
 
 class RunJob: public QDialog
 {
index 265d7e21824da9688e0fc4c31205e10a8a51727e..71da7a09d8abc133b151aa7c7a994d58720fcef2 100644 (file)
@@ -13,6 +13,8 @@
 CONFIG += qt
 #CONFIG += qt debug
 
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
 cross-win32 {
   LIBS       +=  -mwindows -L../../win32/release32 -lbacula
   INCLUDEPATH += ../../win32/compat
index 4ac57c2a9d0a6ac66a233da3dc03da7c083c4b0c..30cacd53d175434ffd987d5c66a35afa4181c59f 100644 (file)
@@ -15,6 +15,8 @@
 CONFIG += qt cross-win32
 #CONFIG += qt debug 
 
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
 cross-win32 {
   LIBS       +=  -mwindows -L../../win32/release32 -lbacula -lpthread
   INCLUDEPATH += ../../win32/compat
index 792c6972653a48aacca71416cfc46405a2aba755..38c8811a331ba86987564a12f1e5299a43a82f1f 100644 (file)
@@ -15,6 +15,8 @@
 CONFIG += qt cross-win32
 #CONFIG += qt debug 
 
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
 cross-win32 {
   LIBS       +=  -mwindows -L../../win32/release64 -lbacula -lpthread
   INCLUDEPATH += ../../win32/compat
index 1efe2ec30f4e7c1653983cd4cd8d828dbd3bea99..57346bdc177f4a5f741f03ef175345f9fd677cb6 100644 (file)
@@ -198,6 +198,21 @@ public:
         tray = new QSystemTrayIcon(TrayMonitor);
         QMenu* stmenu = new QMenu(TrayMonitor);
 
+#if QT_VERSION >= 0x050000
+        QAction *actShow = new QAction(QApplication::translate("TrayMonitor",
+                               "Display", 0),TrayMonitor);
+        QAction* actQuit = new QAction(QApplication::translate("TrayMonitor",
+                               "Quit", 0),TrayMonitor);
+        QAction* actAbout = new QAction(QApplication::translate("TrayMonitor",
+                               "About", 0),TrayMonitor);
+        QAction* actRun = new QAction(QApplication::translate("TrayMonitor",
+                               "Run...", 0),TrayMonitor);
+        QAction* actRes = new QAction(QApplication::translate("TrayMonitor",
+                              "Restore...", 0),TrayMonitor);
+
+        QAction* actConf = new QAction(QApplication::translate("TrayMonitor",
+                               "Configure...", 0),TrayMonitor);
+#else
         QAction *actShow = new QAction(QApplication::translate("TrayMonitor",
                                "Display",
                                 0, QApplication::UnicodeUTF8),TrayMonitor);
@@ -217,6 +232,7 @@ public:
         QAction* actConf = new QAction(QApplication::translate("TrayMonitor",
                                "Configure...",
                                 0, QApplication::UnicodeUTF8),TrayMonitor);
+#endif
         stmenu->addAction(actShow);
         stmenu->addAction(actRun);
         stmenu->addAction(actRes);
@@ -256,7 +272,12 @@ public:
 
     void retranslateUi(QMainWindow *TrayMonitor)
     {
-       TrayMonitor->setWindowTitle(QApplication::translate("TrayMonitor", "Bacula Tray Monitor", 0, QApplication::UnicodeUTF8));
+#if QT_VERSION >= 0x050000
+        TrayMonitor->setWindowTitle(QApplication::translate("TrayMonitor", "Bacula Tray Monitor", 0));
+#else
+        TrayMonitor->setWindowTitle(QApplication::translate("TrayMonitor", "Bacula Tray Monitor", 0, QApplication::UnicodeUTF8));
+#endif
+
     } // retranslateUi
 
 private slots:
index 4426760b70e41afa4c15e9c575063135c6a8ab2c..2642ee382dd57f6dc98cb5026f705e66345b6368 100644 (file)
@@ -32,6 +32,7 @@
 #include <QBrush>
 #include <QString>
 #include <QStringList>
+#include <QLabel>
 #include <math.h>
 #include "fmtwidgetitem.h"
 
@@ -49,7 +50,7 @@ QString convertJobStatus(const QString &sts)
    }
 
    char buf[256];
-   jobstatus_to_ascii_gui( code[0].toAscii(), buf, sizeof(buf));
+   jobstatus_to_ascii_gui( code[0].toLatin1(), buf, sizeof(buf));
    return QString(buf);
 }
 
@@ -386,7 +387,7 @@ void ItemFormatterBase::setJobStatusFld(int index, const QString &status, bool c
 
 void ItemFormatterBase::setJobTypeFld(int index, const QString &fld, bool center)
 {
-   QByteArray jtype(fld.trimmed().toAscii());
+   QByteArray jtype(fld.trimmed().toLatin1());
    if (jtype.size()) {
       setTextFld(index, job_type_to_str(jtype[0]), center);
    } else {
@@ -396,7 +397,7 @@ void ItemFormatterBase::setJobTypeFld(int index, const QString &fld, bool center
 
 void ItemFormatterBase::setJobLevelFld(int index, const QString &fld, bool center)
 {
-   QByteArray lvl(fld.trimmed().toAscii());
+   QByteArray lvl(fld.trimmed().toLatin1());
    if (lvl.size()) {
       setTextFld(index, job_level_to_str(lvl[0]), center);
    } else {