Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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 @@ ...@@ -17,7 +17,6 @@
#include "juk.h" #include "juk.h"
#include <kcmdlineargs.h>
#include <kstatusbar.h> #include <kstatusbar.h>
#include <kdebug.h> #include <kdebug.h>
#include <kmessagebox.h> #include <kmessagebox.h>
...@@ -74,14 +73,15 @@ void deleteAndClear(T *&ptr) ...@@ -74,14 +73,15 @@ void deleteAndClear(T *&ptr)
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
JuK::JuK(QWidget *parent) : JuK::JuK(const QStringList &filesToOpen, QWidget *parent) :
KXmlGuiWindow(parent, Qt::WindowFlags(Qt::WA_DeleteOnClose)), KXmlGuiWindow(parent, Qt::WindowFlags(Qt::WA_DeleteOnClose)),
m_splitter(0), m_splitter(0),
m_statusLabel(0), m_statusLabel(0),
m_systemTray(0), m_systemTray(0),
m_player(new PlayerManager), m_player(new PlayerManager),
m_scrobbler(0), m_scrobbler(0),
m_shuttingDown(false) m_shuttingDown(false),
m_filesToOpen(filesToOpen)
{ {
// Expect segfaults if you change this order. // Expect segfaults if you change this order.
...@@ -378,14 +378,7 @@ void JuK::setupGlobalAccels() ...@@ -378,14 +378,7 @@ void JuK::setupGlobalAccels()
void JuK::slotProcessArgs() void JuK::slotProcessArgs()
{ {
// FIXME cmdline args CollectionList::instance()->addFiles(m_filesToOpen);
/*KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QStringList files;
for(int i = 0; i < args->count(); i++)
files.append(args->arg(i));*/
//CollectionList::instance()->addFiles(files);
} }
void JuK::slotClearOldCovers() void JuK::slotClearOldCovers()
......
...@@ -38,7 +38,7 @@ class JuK : public KXmlGuiWindow ...@@ -38,7 +38,7 @@ class JuK : public KXmlGuiWindow
Q_OBJECT Q_OBJECT
public: public:
JuK(QWidget* parent = 0); JuK(const QStringList &filesToOpen, QWidget* parent = 0);
virtual ~JuK(); virtual ~JuK();
static JuK* JuKInstance(); static JuK* JuKInstance();
...@@ -96,6 +96,7 @@ private: ...@@ -96,6 +96,7 @@ private:
PlayerManager *m_player; PlayerManager *m_player;
Scrobbler *m_scrobbler; Scrobbler *m_scrobbler;
QStringList m_filesToOpen;
bool m_startDocked; bool m_startDocked;
bool m_showSplash; bool m_showSplash;
bool m_shuttingDown; bool m_shuttingDown;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
#include <kuniqueapplication.h> #include <kuniqueapplication.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h> #include <kaboutdata.h>
#include <kconfigbase.h> #include <kconfigbase.h>
#include <kconfig.h> #include <kconfig.h>
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <knotification.h> #include <knotification.h>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "juk.h" #include "juk.h"
static const char description[] = I18N_NOOP("Jukebox and music manager by KDE"); static const char description[] = I18N_NOOP("Jukebox and music manager by KDE");
...@@ -81,15 +84,13 @@ int main(int argc, char *argv[]) ...@@ -81,15 +84,13 @@ int main(int argc, char *argv[])
aboutData.addCredit(i18n("Eike Hein"), i18n(sho), "hein@kde.org"); aboutData.addCredit(i18n("Eike Hein"), i18n(sho), "hein@kde.org");
KAboutData::setApplicationData(aboutData); KAboutData::setApplicationData(aboutData);
// FIXME cmdline QCommandLineParser parser;
/*KCmdLineArgs::init(argc, argv, &aboutData); aboutData.setupCommandLine(&parser);
parser.addVersionOption();
KCmdLineOptions options; parser.addHelpOption();
options.add("+[file(s)]", ki18n("File(s) to open")); parser.addPositionalArgument(QLatin1String("[file(s)]"), i18n("File(s) to open"));
KCmdLineArgs::addCmdLineOptions(options); parser.process(a);
aboutData.processCommandLine(&parser);
KUniqueApplication::addCmdLineOptions();*/
// If this flag gets set then JuK will quit if you click the cover on the track // 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). // 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[]) ...@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
// Create the main window and such // Create the main window and such
JuK *juk = new JuK; JuK *juk = new JuK(parser.positionalArguments());
if(a.isSessionRestored() && KMainWindow::canBeRestored(1)) if(a.isSessionRestored() && KMainWindow::canBeRestored(1))
juk->restore(1, false /* don't show */); juk->restore(1, false /* don't show */);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <KAboutData> #include <KAboutData>
#include <KApplication> #include <KApplication>
#include <KCmdLineArgs>
#include <KWindowSystem> #include <KWindowSystem>
#include <QDBusConnection> #include <QDBusConnection>
...@@ -77,9 +76,7 @@ bool MediaPlayer2::HasTrackList() const ...@@ -77,9 +76,7 @@ bool MediaPlayer2::HasTrackList() const
QString MediaPlayer2::Identity() const QString MediaPlayer2::Identity() const
{ {
// FIXME cmdline args return KAboutData::applicationData().displayName();
//return KCmdLineArgs::aboutData()->programName();
return "JuK";
} }
QString MediaPlayer2::DesktopEntry() const 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