Fix parsing non-ascii filenames passed on the commandline (or through a file browser). Fixes issue #773. Fixes issue #752.

This commit is contained in:
David Sansome 2010-12-26 14:54:46 +00:00
parent e3a9bd7b26
commit fd00924f26
2 changed files with 10 additions and 4 deletions

View File

@ -24,6 +24,8 @@
#include <QBuffer>
#include <QFileInfo>
#include <QTextCodec>
#include <QtDebug>
const char* CommandlineOptions::kHelpText =
"%1: clementine [%2] [%3]\n"

View File

@ -180,16 +180,20 @@ int main(int argc, char *argv[]) {
lastfm::ws::SharedSecret = LastFMService::kSecret;
#endif
// Parse commandline options - need to do this before starting the
// QApplication so it works without an X server
CommandlineOptions options(argc, argv);
if (!options.Parse())
return 1;
{
// Only start a core application now so we can check if there's another
// Clementine running without needing an X server.
// This MUST be done before parsing the commandline options so QTextCodec
// gets the right system locale for filenames.
QtSingleCoreApplication a(argc, argv);
// Parse commandline options - need to do this before starting the
// full QApplication so it works without an X server
if (!options.Parse())
return 1;
if (a.isRunning()) {
if (options.is_empty()) {
qDebug() << "Clementine is already running - activating existing window";