From 389f72e3584851b75551e5e964512a70910ef6b9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 17 Mar 2007 17:30:59 +0000 Subject: [PATCH] Apply Antibes updates git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4349 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 2 + bacula/src/dird/verify.c | 80 +-- bacula/src/qt-console/Makefile | 286 ++++++---- bacula/src/qt-console/bat.pro | 8 +- bacula/src/qt-console/console/console.ui | 127 ++--- bacula/src/qt-console/mainwin.cpp | 74 ++- bacula/src/qt-console/mainwin.h | 7 +- bacula/src/qt-console/medialist/medialist.cpp | 117 ++++ bacula/src/qt-console/medialist/medialist.h | 57 ++ bacula/src/qt-console/medialist/medialist.ui | 29 + bacula/src/qt-console/restore/brestore.ui | 508 +++++++++--------- bacula/src/stored/bacula-sd.conf.in | 1 + bacula/src/version.h | 4 +- 13 files changed, 797 insertions(+), 503 deletions(-) create mode 100644 bacula/src/qt-console/medialist/medialist.cpp create mode 100644 bacula/src/qt-console/medialist/medialist.h create mode 100644 bacula/src/qt-console/medialist/medialist.ui diff --git a/bacula/kernstodo b/bacula/kernstodo index 0bcd308589..a6b935748a 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -43,6 +43,8 @@ Document: Priority: +- Ensure that each device in an Autochanger has a different + Device Index. - Add Catalog = to Pool resource so that pools will exist in only one catalog -- currently Pools are "global". - Look at sg_logs -a /dev/sg0 for getting soft errors. diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 674cdd8c58..1080bf9a28 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -1,22 +1,7 @@ -/* - * - * Bacula Director -- verify.c -- responsible for running file verification - * - * Kern Sibbald, October MM - * - * Basic tasks done here: - * Open DB - * Open connection with File daemon and pass him commands - * to do the verify. - * When the File daemon sends the attributes, compare them to - * what is in the DB. - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -40,6 +25,21 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Bacula Director -- verify.c -- responsible for running file verification + * + * Kern Sibbald, October MM + * + * Basic tasks done here: + * Open DB + * Open connection with File daemon and pass him commands + * to do the verify. + * When the File daemon sends the attributes, compare them to + * what is in the DB. + * + * Version $Id$ + */ #include "bacula.h" @@ -66,6 +66,22 @@ static int missing_handler(void *ctx, int num_fields, char **row); */ bool do_verify_init(JCR *jcr) { + return true; +} + + +/* + * Do a verification of the specified files against the Catlaog + * + * Returns: false on failure + * true on success + */ +bool do_verify(JCR *jcr) +{ + const char *level; + BSOCK *fd; + int stat; + char ed1[100]; JOB_DBR jr; JobId_t verify_jobid = 0; const char *Name; @@ -74,12 +90,16 @@ bool do_verify_init(JCR *jcr) memset(&jcr->previous_jr, 0, sizeof(jcr->previous_jr)); - Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name); - /* - * Find JobId of last job that ran. E.g. - * for VERIFY_CATALOG we want the JobId of the last INIT. - * for VERIFY_VOLUME_TO_CATALOG, we want the JobId of the + * Find JobId of last job that ran. Note, we do this when + * the job actually starts running, not at schedule time, + * so that we find the last job that terminated before + * this job runs rather than before it is scheduled. This + * permits scheduling a Backup and Verify at the same time, + * but with the Verify at a lower priority. + * + * For VERIFY_CATALOG we want the JobId of the last INIT. + * For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the * last backup Job. */ if (jcr->JobLevel == L_VERIFY_CATALOG || @@ -89,7 +109,7 @@ bool do_verify_init(JCR *jcr) if (jcr->verify_job && (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) { - Name = jcr->verify_job->hdr.name; + Name = jcr->verify_job->name(); } else { Name = NULL; } @@ -149,22 +169,6 @@ bool do_verify_init(JCR *jcr) jcr->fileset = jcr->verify_job->fileset; } Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->JobLevel); - return true; -} - - -/* - * Do a verification of the specified files against the Catlaog - * - * Returns: false on failure - * true on success - */ -bool do_verify(JCR *jcr) -{ - const char *level; - BSOCK *fd; - int stat; - char ed1[100]; if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); diff --git a/bacula/src/qt-console/Makefile b/bacula/src/qt-console/Makefile index da4fd113c9..1ff7f57ecb 100644 --- a/bacula/src/qt-console/Makefile +++ b/bacula/src/qt-console/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: bat -# Generated by qmake (2.01a) (Qt 4.2.1) on: Sun Mar 11 11:56:33 2007 +# Generated by qmake (2.01a) (Qt 4.2.1) on: Thu Mar 15 21:12:02 2007 # Project: bat.pro # Template: app # Command: /usr/bin/qmake -unix -o Makefile bat.pro @@ -17,7 +17,7 @@ CFLAGS = -pipe -g -D_REENTRANT -Wall -W $(DEFINES) CXXFLAGS = -pipe -g -D_REENTRANT -Wall -W $(DEFINES) LEXFLAGS = YACCFLAGS = -d -INCPATH = -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -Iconsole -Irestore -Iselect -I.. -Imoc -I. +INCPATH = -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -Iconsole -Irestore -Iselect -I.. -Imoc -Iui LINK = g++ LFLAGS = LIBS = $(SUBLIBS) -L/usr/lib -L../lib -lbac -lssl -lcrypto -lQtGui -L/usr/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread @@ -57,12 +57,14 @@ SOURCES = main.cpp \ label/label.cpp \ run/run.cpp \ run/runcmd.cpp \ - select/select.cpp moc/moc_mainwin.cpp \ + select/select.cpp \ + medialist/medialist.cpp moc/moc_mainwin.cpp \ moc/moc_console.cpp \ moc/moc_restore.cpp \ moc/moc_label.cpp \ moc/moc_run.cpp \ moc/moc_select.cpp \ + moc/moc_medialist.cpp \ qrc_main.cpp OBJECTS = obj/main.o \ obj/bat_conf.o \ @@ -77,12 +79,14 @@ OBJECTS = obj/main.o \ obj/run.o \ obj/runcmd.o \ obj/select.o \ + obj/medialist.o \ obj/moc_mainwin.o \ obj/moc_console.o \ obj/moc_restore.o \ obj/moc_label.o \ obj/moc_run.o \ obj/moc_select.o \ + obj/moc_medialist.o \ obj/qrc_main.o DIST = /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/g++.conf \ @@ -129,7 +133,7 @@ first: all all: Makefile $(TARGET) -$(TARGET): ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_runcmd.h ui_select.h $(OBJECTS) +$(TARGET): ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: bat.pro /usr/share/qt4/mkspecs/default/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \ @@ -174,7 +178,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) obj/bat1.0.0 || $(MKDIR) obj/bat1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h qstd.h console/console.h restore/restore.h label/label.h run/run.h select/select.h obj/bat1.0.0/ && $(COPY_FILE) --parents main.qrc obj/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp qstd.cpp console/authenticate.cpp console/console.cpp restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp label/label.cpp run/run.cpp run/runcmd.cpp select/select.cpp obj/bat1.0.0/ && $(COPY_FILE) --parents main.ui label/label.ui console/console.ui restore/restore.ui restore/prerestore.ui restore/brestore.ui run/run.ui run/runcmd.ui select/select.ui obj/bat1.0.0/ && (cd `dirname obj/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname obj/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r obj/bat1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h qstd.h console/console.h restore/restore.h label/label.h run/run.h select/select.h medialist/medialist.h obj/bat1.0.0/ && $(COPY_FILE) --parents main.qrc obj/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp qstd.cpp console/authenticate.cpp console/console.cpp restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp label/label.cpp run/run.cpp run/runcmd.cpp select/select.cpp medialist/medialist.cpp obj/bat1.0.0/ && $(COPY_FILE) --parents main.ui label/label.ui console/console.ui restore/restore.ui restore/prerestore.ui restore/brestore.ui run/run.ui run/runcmd.ui select/select.ui medialist/medialist.ui obj/bat1.0.0/ && (cd `dirname obj/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname obj/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r obj/bat1.0.0 yaccclean: @@ -198,49 +202,58 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all -compiler_moc_header_make_all: moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp +compiler_moc_header_make_all: moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp -moc/moc_mainwin.cpp: ui_main.h \ + -$(DEL_FILE) moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp +moc/moc_mainwin.cpp: ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ mainwin.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) mainwin.h -o moc/moc_mainwin.cpp -moc/moc_console.cpp: ui_console.h \ +moc/moc_console.cpp: ui/ui_console.h \ console/console.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) console/console.h -o moc/moc_console.cpp -moc/moc_restore.cpp: ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ +moc/moc_restore.cpp: ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ restore/restore.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) restore/restore.h -o moc/moc_restore.cpp -moc/moc_label.cpp: ui_label.h \ +moc/moc_label.cpp: ui/ui_label.h \ label/label.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) label/label.h -o moc/moc_label.cpp -moc/moc_run.cpp: ui_run.h \ +moc/moc_run.cpp: ui/ui_run.h \ + ui/ui_runcmd.h \ run/run.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) run/run.h -o moc/moc_run.cpp -moc/moc_select.cpp: ui_select.h \ +moc/moc_select.cpp: ui/ui_select.h \ select/select.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) $(INCPATH) select/select.h -o moc/moc_select.cpp +moc/moc_medialist.cpp: ui/ui_medialist.h \ + medialist/medialist.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) $(INCPATH) medialist/medialist.h -o moc/moc_medialist.cpp + compiler_rcc_make_all: qrc_main.cpp compiler_rcc_clean: -$(DEL_FILE) qrc_main.cpp @@ -267,35 +280,38 @@ compiler_image_collection_clean: -$(DEL_FILE) qmake_image_collection.cpp compiler_moc_source_make_all: compiler_moc_source_clean: -compiler_uic_make_all: ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_runcmd.h ui_select.h +compiler_uic_make_all: ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h compiler_uic_clean: - -$(DEL_FILE) ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_runcmd.h ui_select.h -ui_main.h: main.ui - /usr/bin/uic main.ui -o ui_main.h + -$(DEL_FILE) ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h +ui/ui_main.h: main.ui + /usr/bin/uic main.ui -o ui/ui_main.h + +ui/ui_label.h: label/label.ui + /usr/bin/uic label/label.ui -o ui/ui_label.h -ui_label.h: label/label.ui - /usr/bin/uic label/label.ui -o ui_label.h +ui/ui_console.h: console/console.ui + /usr/bin/uic console/console.ui -o ui/ui_console.h -ui_console.h: console/console.ui - /usr/bin/uic console/console.ui -o ui_console.h +ui/ui_restore.h: restore/restore.ui + /usr/bin/uic restore/restore.ui -o ui/ui_restore.h -ui_restore.h: restore/restore.ui - /usr/bin/uic restore/restore.ui -o ui_restore.h +ui/ui_prerestore.h: restore/prerestore.ui + /usr/bin/uic restore/prerestore.ui -o ui/ui_prerestore.h -ui_prerestore.h: restore/prerestore.ui - /usr/bin/uic restore/prerestore.ui -o ui_prerestore.h +ui/ui_brestore.h: restore/brestore.ui + /usr/bin/uic restore/brestore.ui -o ui/ui_brestore.h -ui_brestore.h: restore/brestore.ui - /usr/bin/uic restore/brestore.ui -o ui_brestore.h +ui/ui_run.h: run/run.ui + /usr/bin/uic run/run.ui -o ui/ui_run.h -ui_run.h: run/run.ui - /usr/bin/uic run/run.ui -o ui_run.h +ui/ui_runcmd.h: run/runcmd.ui + /usr/bin/uic run/runcmd.ui -o ui/ui_runcmd.h -ui_runcmd.h: run/runcmd.ui - /usr/bin/uic run/runcmd.ui -o ui_runcmd.h +ui/ui_select.h: select/select.ui + /usr/bin/uic select/select.ui -o ui/ui_select.h -ui_select.h: select/select.ui - /usr/bin/uic select/select.ui -o ui_select.h +ui/ui_medialist.h: medialist/medialist.ui + /usr/bin/uic medialist/medialist.ui -o ui/ui_medialist.h compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean @@ -303,15 +319,18 @@ compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_coll obj/main.o: main.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/main.o main.cpp @@ -321,15 +340,18 @@ obj/bat_conf.o: bat_conf.cpp bat_conf.h obj/mainwin.o: mainwin.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/mainwin.o mainwin.cpp @@ -339,143 +361,188 @@ obj/qstd.o: qstd.cpp qstd.h obj/authenticate.o: console/authenticate.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/authenticate.o console/authenticate.cpp obj/console.o: console/console.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h \ console/console.h \ - ui_console.h + ui/ui_console.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/console.o console/console.cpp obj/prerestore.o: restore/prerestore.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/prerestore.o restore/prerestore.cpp obj/restore.o: restore/restore.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/restore.o restore/restore.cpp obj/brestore.o: restore/brestore.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/brestore.o restore/brestore.cpp obj/label.o: label/label.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/label.o label/label.cpp obj/run.o: run/run.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/run.o run/run.cpp obj/runcmd.o: run/runcmd.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/runcmd.o run/runcmd.cpp obj/select.o: select/select.cpp bat.h \ mainwin.h \ - ui_main.h \ + ui/ui_main.h \ label/label.h \ - ui_label.h \ + ui/ui_label.h \ run/run.h \ - ui_run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ restore/restore.h \ - ui_brestore.h \ - ui_restore.h \ - ui_prerestore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ bat_conf.h \ qstd.h \ select/select.h \ - ui_select.h + ui/ui_select.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/select.o select/select.cpp +obj/medialist.o: medialist/medialist.cpp bat.h \ + mainwin.h \ + ui/ui_main.h \ + label/label.h \ + ui/ui_label.h \ + run/run.h \ + ui/ui_run.h \ + ui/ui_runcmd.h \ + restore/restore.h \ + ui/ui_brestore.h \ + ui/ui_restore.h \ + ui/ui_prerestore.h \ + medialist/medialist.h \ + ui/ui_medialist.h \ + bat_conf.h \ + qstd.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/medialist.o medialist/medialist.cpp + obj/moc_mainwin.o: moc/moc_mainwin.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_mainwin.o moc/moc_mainwin.cpp @@ -494,6 +561,9 @@ obj/moc_run.o: moc/moc_run.cpp obj/moc_select.o: moc/moc_select.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_select.o moc/moc_select.cpp +obj/moc_medialist.o: moc/moc_medialist.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_medialist.o moc/moc_medialist.cpp + obj/qrc_main.o: qrc_main.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qrc_main.o qrc_main.cpp diff --git a/bacula/src/qt-console/bat.pro b/bacula/src/qt-console/bat.pro index 271754f6ca..0092b7bd85 100644 --- a/bacula/src/qt-console/bat.pro +++ b/bacula/src/qt-console/bat.pro @@ -14,6 +14,7 @@ LIBS += -lssl -lcrypto RESOURCES = main.qrc MOC_DIR = moc OBJECTS_DIR = obj +UI_DIR = ui # Main window FORMS += main.ui @@ -22,6 +23,7 @@ FORMS += console/console.ui FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui FORMS += run/run.ui run/runcmd.ui FORMS += select/select.ui +FORMS += medialist/medialist.ui HEADERS += mainwin.h bat.h bat_conf.h qstd.h @@ -43,6 +45,10 @@ SOURCES += label/label.cpp HEADERS += run/run.h SOURCES += run/run.cpp run/runcmd.cpp -# Select dialgo +# Select dialog HEADERS += select/select.h SOURCES += select/select.cpp + +## Medialist +HEADERS += medialist/medialist.h +SOURCES += medialist/medialist.cpp diff --git a/bacula/src/qt-console/console/console.ui b/bacula/src/qt-console/console/console.ui index 0f304b9155..ea346108b2 100644 --- a/bacula/src/qt-console/console/console.ui +++ b/bacula/src/qt-console/console/console.ui @@ -6,7 +6,7 @@ 0 0 432 - 422 + 456 @@ -20,89 +20,60 @@ 6 - + + + + 7 + 7 + 200 + 0 + + + + + 0 + 0 + + + + + 1 + 0 + + Qt::StrongFocus - - ../images/print.png + + false + + + + + + + + + + + + Qt::ScrollBarAsNeeded + + + QTextEdit::AutoNone + + + false + + + - - QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures + + QTextEdit::NoWrap - - Qt::NoDockWidgetArea + + true - - - Qt::StrongFocus - - - - 9 - - - 6 - - - - - - 7 - 7 - 200 - 0 - - - - - 0 - 0 - - - - - 1 - 0 - - - - Qt::StrongFocus - - - false - - - - - - - - - - - - Qt::ScrollBarAsNeeded - - - QTextEdit::AutoNone - - - false - - - - - - QTextEdit::NoWrap - - - true - - - - - diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 0ffd4f1344..d8e8cc34bc 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -36,14 +36,19 @@ */ #include "bat.h" +#include "medialist/medialist.h" MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ + treeWidget->clear(); + treeWidget->setColumnCount(1); + treeWidget->setHeaderLabel("Select Page"); - createStackedWidgets(); + m_pages = 0; + createPages(); resetFocus(); @@ -56,8 +61,10 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) m_console->connect(); } -void MainWin::createStackedWidgets() +void MainWin::createPages() { + DIRRES *dir; + QTreeWidgetItem *item, *topItem; m_console = new Console(stackedWidget); stackedWidget->addWidget(m_console); @@ -65,33 +72,56 @@ void MainWin::createStackedWidgets() bRestore *brestore = new bRestore(stackedWidget); stackedWidget->addWidget(brestore); + m_medialist = new MediaList(stackedWidget); + stackedWidget->addWidget(m_medialist); + /* Just take the first Director */ LockRes(); - DIRRES *dir = (DIRRES *)GetNextRes(R_DIRECTOR, NULL); + dir = (DIRRES *)GetNextRes(R_DIRECTOR, NULL); m_console->setDirRes(dir); UnlockRes(); - /* ***FIXME*** Dummy setup of treeWidget */ - treeWidget->clear(); - treeWidget->setColumnCount(1); - treeWidget->setHeaderLabel("Selection"); - topItem = new QTreeWidgetItem(treeWidget); - topItem->setText(0, dir->name()); + topItem = createTopPage(dir->name(), false); topItem->setIcon(0, QIcon(QString::fromUtf8("images/server.png"))); - item = new QTreeWidgetItem(topItem); + + item = createPage("Console", topItem, true); m_console->setTreeItem(item); - item->setText(0, "Console"); - item->setText(1, "0"); QBrush redBrush(Qt::red); item->setForeground(0, redBrush); - item = new QTreeWidgetItem(topItem); - item->setText(0, "brestore"); - item->setText(1, "1"); + + item = createPage("brestore", topItem, true); + item = createPage("MediaList", topItem, true); + treeWidget->expandItem(topItem); stackedWidget->setCurrentIndex(0); } +QTreeWidgetItem *MainWin::createTopPage(char *name, bool canDisplay) +{ + QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget); + item->setText(0, name); + if (canDisplay) { + item->setData(0, Qt::UserRole, QVariant(m_pages++)); + } else { + item->setData(0, Qt::UserRole, QVariant(-1)); + } + return item; +} + +QTreeWidgetItem *MainWin::createPage(char *name, QTreeWidgetItem *parent, bool canDisplay) +{ + QTreeWidgetItem *item = new QTreeWidgetItem(parent); + item->setText(0, name); + if (canDisplay) { + item->setData(0, Qt::UserRole, QVariant(m_pages++)); + } else { + item->setData(0, Qt::UserRole, QVariant(-1)); + } + return item; +} + + /* * Handle up and down arrow keys for the command line * history. @@ -185,9 +215,8 @@ void MainWin::readSettings() void MainWin::treeItemClicked(QTreeWidgetItem *item, int column) { - (void)column; - int index = item->text(1).toInt(); - if (index >= 0 && index < 4) { + int index = item->data(column, Qt::UserRole).toInt(); + if (index >= 0) { stackedWidget->setCurrentIndex(index); } } @@ -196,11 +225,12 @@ void MainWin::treeItemClicked(QTreeWidgetItem *item, int column) */ void MainWin::treeItemDoubleClicked(QTreeWidgetItem *item, int column) { - (void)column; - int index = item->text(1).toInt(); - /* ***FIXME**** make this automatic */ - if (index >= 0 && index < 4) { + int index = item->data(column, Qt::UserRole).toInt(); + if (index >= 0) { stackedWidget->setCurrentIndex(index); + if( index == 2 ){ + m_medialist->DoDisplay(m_console); + } } } diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 8001e9329f..371f36a738 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -42,6 +42,7 @@ #include "label/label.h" #include "run/run.h" #include "restore/restore.h" +#include "medialist/medialist.h" class Console; @@ -74,13 +75,17 @@ protected: private: void createConnections(); - void createStackedWidgets(); + void createPages(); + QTreeWidgetItem *createTopPage(char *name, bool canDisplay); + QTreeWidgetItem *createPage(char *name, QTreeWidgetItem *parent, bool canDisplay); private: QString m_UserInput; Console *m_console; + MediaList *m_medialist; QStringList m_cmd_history; int m_cmd_last; + int m_pages; }; #endif /* _MAINWIN_H_ */ diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp new file mode 100644 index 0000000000..6b1155211b --- /dev/null +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -0,0 +1,117 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* + * Version $Id: medialist.cpp 4230 2007-02-21 20:07:37Z kerns $ + * + * MediaList Class + * + * Kern Sibbald, January MMVI + * + */ + +#include +#include "bat.h" +#include "medialist.h" + +MediaList::MediaList(QStackedWidget *parent) +{ + setupUi(this); + parent->addWidget(this); + poollist = new QStringList(); + + m_treeWidget = treeWidget; /* our medialist screen */ +} + +void MediaList::DoDisplay(Console *console) +{ + int stat; + QTreeWidgetItem *mediatreeitem, *treeitem, *topItem; + + m_console = console; + + m_treeWidget->clear(); + m_treeWidget->setColumnCount(3); + topItem = new QTreeWidgetItem(m_treeWidget); + topItem->setText(0, "Pools"); + + /* Start with a list of pools */ + poollist->clear(); + QString *scmd = new QString(".pools\n"); + m_console->write_dir(scmd->toUtf8().data()); + while ((stat=m_console->read()) > 0) { + poollist->append(m_console->msg()); + } + for ( QStringList::Iterator poolitem = poollist->begin(); poolitem != poollist->end(); ++poolitem ) { + treeitem = new QTreeWidgetItem(topItem); + m_console->setTreeItem(treeitem); + poolitem->replace(QRegExp("\n"), ""); + treeitem->setText(0, poolitem->toUtf8().data()); + + /* iterate through the media in the pool */ + QString *mcmd = new QString("sqlquery\n"); + m_console->write_dir(mcmd->toUtf8().data()); + while ((stat=m_console->read()) > 0) { } + QString *mcmd2 = new QString("select m.volumename, m.mediaid, m.mediatype from media m, pool p where p.name = '"); + mcmd2->append(*poolitem); + mcmd2->append("';\n"); + m_console->write_dir(mcmd2->toUtf8().data()); + QString *mediaread = new QString(); + while ((stat=m_console->read()) > 0) { + *mediaread += m_console->msg(); + } + QStringList sqllinelist = mediaread->split("\n"); + QRegExp regex("^\\|.*\\|$"); + int recordcnter=0; + QStringList *headerlist = new QStringList(); + /* Iterate through lines retuned */ + for ( QStringList::Iterator mediareadline = sqllinelist.begin(); mediareadline != sqllinelist.end(); ++mediareadline ) { + if ( regex.indexIn(*mediareadline) >= 0 ){ + QStringList recorditemlist = mediareadline->split("|"); + int recorditemcnter=0; + /* Iterate through items in the record */ + for ( QStringList::Iterator mediarecorditem = recorditemlist.begin(); mediarecorditem != recorditemlist.end(); ++mediarecorditem ) { + QString trimmeditem = mediarecorditem->trimmed(); + if( trimmeditem != "" ){ + if ( recordcnter == 0 ){ + headerlist->append(trimmeditem); + } else { + if ( recorditemcnter == 0 ){ + mediatreeitem = new QTreeWidgetItem(treeitem); + } + mediatreeitem->setText(recorditemcnter, trimmeditem.toUtf8().data()); + } + recorditemcnter+=1; + } + } + recordcnter+=1; + } + } + m_treeWidget->setHeaderLabels(*headerlist); + } +} diff --git a/bacula/src/qt-console/medialist/medialist.h b/bacula/src/qt-console/medialist/medialist.h new file mode 100644 index 0000000000..cc11e9f4c8 --- /dev/null +++ b/bacula/src/qt-console/medialist/medialist.h @@ -0,0 +1,57 @@ +#ifndef _MEDIALIST_H_ +#define _MEDIALIST_H_ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Version $Id: medialist.h 4230 2007-02-21 20:07:37Z kerns $ + * + * Kern Sibbald, January 2007 + */ + +#include +#include "ui_medialist.h" +#include "console.h" +#include + +class MediaList : public QWidget, public Ui::MediaListForm +{ + Q_OBJECT + +public: + MediaList(QStackedWidget *parent); + void DoDisplay(Console *console); + +public slots: + +private: + Console *m_console; + QTreeWidget *m_treeWidget; + QStringList *poollist; +}; + +#endif /* _MEDIALIST_H_ */ diff --git a/bacula/src/qt-console/medialist/medialist.ui b/bacula/src/qt-console/medialist/medialist.ui new file mode 100644 index 0000000000..e5ca563cfa --- /dev/null +++ b/bacula/src/qt-console/medialist/medialist.ui @@ -0,0 +1,29 @@ + + MediaListForm + + + + 0 + 0 + 636 + 357 + + + + Console + + + + 9 + + + 6 + + + + + + + + + diff --git a/bacula/src/qt-console/restore/brestore.ui b/bacula/src/qt-console/restore/brestore.ui index 5c8b55b7f6..c61d75b97f 100644 --- a/bacula/src/qt-console/restore/brestore.ui +++ b/bacula/src/qt-console/restore/brestore.ui @@ -12,195 +12,141 @@ brestore - - - - 0 - - - 6 - - - - - - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Location - - - - - - - - - - - - 19 - 58 - 920 - 478 - + + + 9 - - Qt::Vertical + + 6 - - - Qt::Horizontal - - - - - 7 - 7 - 0 - 0 - + + + + Qt::Vertical - - File list - - - - 9 - - - 6 + + + Qt::Horizontal - - - - - 7 - 7 - 5 - 5 - + + + + 7 + 7 + 0 + 0 + + + + File list + + + + 9 - - - Type - - - - - File Name - - - - - Size - - - - - Date - - - - - - - - - - 7 - 7 - 0 - 0 - - - - File revisions - - - - 9 - - - 6 - - - - - - 7 - 7 - 0 - 0 - + + 6 - - - InChanger - - - - - Volume - - - - - JobId - - - - - Size - - - - - Date - - - - - Chksum - - - - - - - - - - - 0 - - - 6 - - - + + + + + 7 + 7 + 5 + 5 + + + + + Type + + + + + File Name + + + + + Size + + + + + Date + + + + + + + + + + 7 + 7 + 0 + 0 + + + + File revisions + + + + 9 + + + 6 + + + + + + 7 + 7 + 0 + 0 + + + + + InChanger + + + + + Volume + + + + + JobId + + + + + Size + + + + + Date + + + + + Chksum + + + + + + + + + 0 @@ -208,91 +154,147 @@ 6 - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + + 0 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Restore items list</span></p></body></html> - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Clear - - - - - - - Estimate - - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Clear + + + + + + + Estimate + + + + + + + Restore + + + + - - - Restore + + + true + + + Type + + + + + FileName + + + + + JobId + + + + + FileIndex + + + + + Nb Files + + + + + Size + + + + + + + + + 0 + + + 6 + + + - - - true + + + false - - - Type - - - - - FileName - - - - - JobId - - - - - FileIndex - - - - - Nb Files - - - - - Size - - + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + Location + + + + + + - - + + diff --git a/bacula/src/stored/bacula-sd.conf.in b/bacula/src/stored/bacula-sd.conf.in index 3840520914..367951ecb4 100644 --- a/bacula/src/stored/bacula-sd.conf.in +++ b/bacula/src/stored/bacula-sd.conf.in @@ -162,6 +162,7 @@ Device { #Device { # Name = "DVD-Writer" # Media Type = DVD +# Device Type = DVD # Archive Device = /dev/hdc # LabelMedia = yes; # lets Bacula label unlabeled media # Random Access = Yes; diff --git a/bacula/src/version.h b/bacula/src/version.h index b121031ab2..4c37357735 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.5" -#define BDATE "10 March 2007" -#define LSMDATE "10Mar07" +#define BDATE "16 March 2007" +#define LSMDATE "16Mar07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ -- 2.39.5