3 // Baulk - Copyright (C) 2008 - Jacob Alexander
5 // Baulk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // any later version, including version 3 of the License.
10 // Baulk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 // Constructor ************************************************************************************
21 Baulk::Baulk( QWidget
*parent
) : QMainWindow( parent
) {
22 QString serverListenName
= "BaulkServ"; // TODO Put in config
24 // Start Daemon - Automatically closes if Daemon is already running
26 if ( QFile::exists("./baulkServ") )
27 program
= QString("./baulkServ %1").arg( serverListenName
);
29 program
= QString("baulkServ %1").arg( serverListenName
);
31 QProcess::startDetached( program
);
32 QTest::qSleep(100); // Leave Time for the Daemon to start
34 // Setup Controller Instance
35 LibraryLoader
*library
= new LibraryLoader( "BaulkControl", this );
36 controller
= library
->loadBaulkWidget( "mainWidget", (BaulkWidget
*)this );
37 controller
->setServerListenName( serverListenName
);
38 setCentralWidget( controller
);
41 setWindowTitle( tr("Baulk - %1").arg( serverListenName
) );
42 connect( controller
, SIGNAL( windowTitleNameSet( QString
) ), this, SLOT( setWindowTitleName( QString
) ) );
45 // Window Close Event *****************************************************************************
46 void Baulk::closeEvent( QCloseEvent
*event
) {
49 // TODO - Send Event to Controller for quit/save message
50 // Use controller infoClient inorder to determine whether or not to kill the server
56 // Log Update *************************************************************************************
57 bool Baulk::updateMsgLogs( QStringList msgLogs
) {
58 if ( controller
!= 0 ) {
59 controller
->setMsgLogs( msgLogs
);
66 // SLOTS ******************************************************************************************
67 void Baulk::setWindowTitleName( QString windowTitle
) {
68 setWindowTitle( windowTitle
);