Commit 67ffed2e authored by Luigi Toscano's avatar Luigi Toscano

Port away from KCmdLineArgs

- reenable the command line parsing;
- pass the parsed arguments to the "JuK" instance, as they are
  needed later;
- use the global KAboutData information instead of accessing
  it through KCmdLineArgs.
parent caa599f3
......@@ -17,7 +17,6 @@
#include "juk.h"
#include <kcmdlineargs.h>
#include <kstatusbar.h>
#include <kdebug.h>
#include <kmessagebox.h>
......@@ -74,14 +73,15 @@ void deleteAndClear(T *&ptr)
// public members
////////////////////////////////////////////////////////////////////////////////
JuK::JuK(QWidget *parent) :
JuK::JuK(const QStringList &filesToOpen, QWidget *parent) :
KXmlGuiWindow(parent, Qt::WindowFlags(Qt::WA_DeleteOnClose)),
m_splitter(0),
m_statusLabel(0),
m_systemTray(0),
m_player(new PlayerManager),
m_scrobbler(0),
m_shuttingDown(false)
m_shuttingDown(false),
m_filesToOpen(filesToOpen)
{
// Expect segfaults if you change this order.
......@@ -378,14 +378,7 @@ void JuK::setupGlobalAccels()
void JuK::slotProcessArgs()
{
// FIXME cmdline args
/*KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QStringList files;
for(int i = 0; i < args->count(); i++)
files.append(args->arg(i));*/
//CollectionList::instance()->addFiles(files);
CollectionList::instance()->addFiles(m_filesToOpen);
}
void JuK::slotClearOldCovers()
......
......@@ -38,7 +38,7 @@ class JuK : public KXmlGuiWindow
Q_OBJECT
public:
JuK(QWidget* parent = 0);
JuK(const QStringList &filesToOpen, QWidget* parent = 0);
virtual ~JuK();
static JuK* JuKInstance();
......@@ -96,6 +96,7 @@ private:
PlayerManager *m_player;
Scrobbler *m_scrobbler;
QStringList m_filesToOpen;
bool m_startDocked;
bool m_showSplash;
bool m_shuttingDown;
......
......@@ -15,7 +15,7 @@
*/
#include <kuniqueapplication.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <kconfigbase.h>
#include <kconfig.h>
......@@ -24,6 +24,9 @@
#include <kconfiggroup.h>
#include <knotification.h>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "juk.h"
static const char description[] = I18N_NOOP("Jukebox and music manager by KDE");
......@@ -81,15 +84,13 @@ int main(int argc, char *argv[])
aboutData.addCredit(i18n("Eike Hein"), i18n(sho), "hein@kde.org");
KAboutData::setApplicationData(aboutData);
// FIXME cmdline
/*KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("+[file(s)]", ki18n("File(s) to open"));
KCmdLineArgs::addCmdLineOptions(options);
KUniqueApplication::addCmdLineOptions();*/
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addVersionOption();
parser.addHelpOption();
parser.addPositionalArgument(QLatin1String("[file(s)]"), i18n("File(s) to open"));
parser.process(a);
aboutData.processCommandLine(&parser);
// If this flag gets set then JuK will quit if you click the cover on the track
// announcement popup when JuK is only in the system tray (the systray has no widget).
......@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
// Create the main window and such
JuK *juk = new JuK;
JuK *juk = new JuK(parser.positionalArguments());
if(a.isSessionRestored() && KMainWindow::canBeRestored(1))
juk->restore(1, false /* don't show */);
......
......@@ -24,7 +24,6 @@
#include <KAboutData>
#include <KApplication>
#include <KCmdLineArgs>
#include <KWindowSystem>
#include <QDBusConnection>
......@@ -77,9 +76,7 @@ bool MediaPlayer2::HasTrackList() const
QString MediaPlayer2::Identity() const
{
// FIXME cmdline args
//return KCmdLineArgs::aboutData()->programName();
return "JuK";
return KAboutData::applicationData().displayName();
}
QString MediaPlayer2::DesktopEntry() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment