~ari-tczew/ubuntu/natty/clementine/lp-747113

« back to all changes in this revision

Viewing changes to src/core/commandlineoptions.cpp

  • Committer: Artur Rona
  • Date: 2011-04-04 20:05:33 UTC
  • Revision ID: ari-tczew@ubuntu.com-20110404200533-6aclzasj5pp8t1hq
* New upstream release. (LP: #747113)
* Drop all patches, have been applied upstream.
* Update debian/copyright.
* Refresh description in debian/control in order to avoid lintian error.
* Bump debhelper to 8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    "\n"
49
49
    "%20:\n"
50
50
    "  -o, --show-osd            %21\n"
51
 
    "  -e, --engine              %22\n"
52
 
    "  -g, --language <lang>     %23\n";
 
51
    "  -g, --language <lang>     %22\n";
53
52
 
54
53
 
55
54
CommandlineOptions::CommandlineOptions(int argc, char** argv)
62
61
    seek_to_(-1),
63
62
    seek_by_(0),
64
63
    play_track_at_(-1),
65
 
    show_osd_(false),
66
 
#ifdef HAVE_GSTREAMER
67
 
    engine_(Engine::Type_GStreamer)
68
 
#elif defined(HAVE_LIBVLC)
69
 
    engine_(Engine::Type_VLC)
70
 
#elif defined(HAVE_LIBXINE)
71
 
    engine_(Engine::Type_Xine)
72
 
#elif defined(HAVE_QT_PHONON)
73
 
    engine_(Engine::Type_QtPhonon)
74
 
#endif
 
64
    show_osd_(false)
75
65
{
76
66
#ifdef Q_OS_DARWIN
77
67
  // Remove -psn_xxx option that Mac passes when opened from Finder.
116
106
    {"play-track",  required_argument, 0, 'k'},
117
107
 
118
108
    {"show-osd",    no_argument,       0, 'o'},
119
 
    {"engine",      required_argument, 0, 'e'},
120
109
    {"language",    required_argument, 0, 'g'},
121
110
 
122
111
    {0, 0, 0, 0}
125
114
  // Parse the arguments
126
115
  bool ok = false;
127
116
  forever {
128
 
    int c = getopt_long(argc_, argv_, "hptusrfv:alk:oe:g:", kOptions, NULL);
 
117
    int c = getopt_long(argc_, argv_, "hptusrfv:alk:og:", kOptions, NULL);
129
118
 
130
119
    // End of the options
131
120
    if (c == -1)
152
141
            tr("Play the <n>th track in the playlist"),
153
142
            tr("Other options"),
154
143
            tr("Display the on-screen-display"),
155
 
            tr("Select engine"),
156
144
            tr("Change the language"));
157
145
 
158
146
        std::cout << translated_help_text.toLocal8Bit().constData();
192
180
        if (!ok) play_track_at_ = -1;
193
181
        break;
194
182
 
195
 
      case 'e':
196
 
        {
197
 
          ok = true;
198
 
          QString engine = optarg;
199
 
          if(engine == "gst")
200
 
            engine_ = Engine::Type_GStreamer;
201
 
          else if(engine == "vlc")
202
 
            engine_ = Engine::Type_VLC;
203
 
          else if(engine == "xine")
204
 
            engine_ = Engine::Type_Xine;
205
 
          else if(engine == "qt-phonon")
206
 
            engine_ = Engine::Type_QtPhonon;
207
 
          else
208
 
          {
209
 
            qFatal("%s%s",
210
 
                tr("Unknown audio engine \"%1\". Choices are:").arg(engine).toAscii().data(),
211
 
#ifdef HAVE_GSTREAMER
212
 
                " gst"
213
 
#endif
214
 
#ifdef HAVE_LIBVLC
215
 
                " vlc"
216
 
#endif
217
 
#ifdef HAVE_LIBXINE
218
 
                " xine"
219
 
#endif
220
 
#ifdef HAVE_QT_PHONON
221
 
                " qt-phonon"
222
 
#endif
223
 
            );
224
 
          }
225
 
        }
226
 
        break;
227
 
 
228
183
      case '?':
229
184
      default:
230
185
        return false;
237
192
    if (value.contains("://"))
238
193
      urls_ << value;
239
194
    else
240
 
      urls_ << QUrl::fromLocalFile(QFileInfo(value).absoluteFilePath());
 
195
      urls_ << QUrl::fromLocalFile(QFileInfo(value).canonicalFilePath());
241
196
  }
242
197
 
243
198
  return true;