/*
- Bacula® - The Network Backup Solution
-
- Copyright (C) 2007-2009 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 and included
- 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 Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
+ Bacula(R) - The Network Backup Solution
+
+ Copyright (C) 2000-2015 Kern Sibbald
+ Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
+
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
+
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
+
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
*/
/*
- * Version $Id$
- *
* Main program for bat (qt-console)
*
- * Kern Sibbald, January MMVII
+ * Written by Kern Sibbald, January MMVII
*
*/
#include <QApplication>
#include <QTranslator>
+/*
+ * We need Qt version 4.8.4 or later to be able to comple correctly
+ */
+#if QT_VERSION < 0x040804
+#error "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+#error "You need Qt version 4.8.4 or later to build Bat"
+#error "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+#endif
+
MainWin *mainWin;
QApplication *app;
static int check_resources();
extern bool parse_bat_config(CONFIG *config, const char *configfile, int exit_code);
+extern void message_callback(int /* type */, char *msg);
+
#define CONFIG_FILE "bat.conf" /* default configuration file */
app = new QApplication(argc, argv);
+ app->setStyle(new QPlastiqueStyle());
app->setQuitOnLastWindowClosed(true);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTranslator qtTranslator;
- qtTranslator.load(QString("qt_") + QLocale::system().name());
+ qtTranslator.load(QString("qt_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app->installTranslator(&qtTranslator);
QTranslator batTranslator;
- batTranslator.load(QString("bat_") + QLocale::system().name());
+ batTranslator.load(QString("bat_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app->installTranslator(&batTranslator);
-
+ register_message_callback(message_callback);
#ifdef xENABLE_NLS
setlocale(LC_ALL, "");
textdomain("bacula");
#endif
+#ifdef HAVE_WIN32
+ set_trace(true); /* output to trace file */
+#endif
+
init_stack_dump();
my_name_is(argc, argv, "bat");
lmgr_init_thread();
init_msg(NULL, NULL);
working_directory = "/tmp";
+#ifndef HAVE_WIN32
struct sigaction sigignore;
sigignore.sa_flags = 0;
sigignore.sa_handler = SIG_IGN;
sigfillset(&sigignore.sa_mask);
sigaction(SIGPIPE, &sigignore, NULL);
sigaction(SIGUSR2, &sigignore, NULL);
-
+#endif
while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
switch (ch) {
if (!check_resources()) {
Emsg1(M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
}
+ if (test_config) {
+ exit(0);
+ }
mainWin = new MainWin;
mainWin->show();
void terminate_console(int /*sig*/)
{
-// WSA_Cleanup(); /* TODO: check when we have to call it */
+#ifdef HAVE_WIN32
+ WSACleanup(); /* TODO: check when we have to call it */
+#endif
exit(0);
}