1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship 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 * (at your option) any later version. *
10 * KWorship 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 KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file KwApplication.cpp
22 * @brief Application global data.
23 * @author James Hogan <james@albanarts.com>
26 #include "KwApplication.h"
28 #include "KwPluginManager.h"
29 #include "KwBiblePlugin.h"
31 #include <KCmdLineArgs>
34 * Static singleton data
37 /// Singleton application.
38 KwApplication
* KwApplication::s_self
= 0;
44 /// Get the singleton application object.
45 KwApplication
* KwApplication::self()
51 * Constructors + destructor
54 /// Primary constructor.
55 KwApplication::KwApplication()
57 , m_mainWindow(0) // soon to be initialised
58 , m_pluginManager(new KwPluginManager())
60 // Application must be lone.
61 Q_ASSERT(0 == s_self
);
64 // Set up the main window
65 kworship
*widget
= new kworship
;
66 m_mainWindow
= widget
;
68 // Set up the plugin manager
69 m_pluginManager
->loadPlugin(new KwBiblePlugin());
71 // see if we are starting with session management
72 if (m_app
.isSessionRestored())
79 // no session.. just start up normally
80 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
81 if (args
->count() > 0)
83 KUrl arg
= args
->arg(0);
84 KUrl url
= KCmdLineArgs::cwd();
87 url
.addPath(arg
.path());
93 widget
->loadPlaylist(url
);
100 KwApplication::~KwApplication()
102 Q_ASSERT(this == s_self
);
105 delete m_pluginManager
;
112 /// Execute the application.
113 int KwApplication::exec()
122 /// Get the main window widget.
123 kworship
* KwApplication::mainWindow()