~ubuntu-branches/ubuntu/precise/smplayer/precise

« back to all changes in this revision

Viewing changes to src/smplayer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-11-04 12:45:38 UTC
  • mfrom: (1.1.10 upstream) (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091104124538-hm6jc89qrg3l2sm8
Tags: 0.6.8-1
* New upstream release. (Closes: #543156)
* Added /usr/share/pixmaps to debian/menu. (Closes: #526353)
* debian/control: Bumped Standards-Version to 3.8.3.
* debian/rules:
  - Removed VERSION variables, not relevant anymore.
  - Removed dh_desktop.
* Removed 01_gl_translation.patch, fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        main_window = 0;
50
50
        gui_to_use = "DefaultGui";
51
51
 
 
52
        move_gui = false;
 
53
        resize_gui = false;
 
54
 
52
55
    Paths::setAppPath( qApp->applicationDirPath() );
53
56
 
54
57
#ifndef PORTABLE_APP
80
83
                        main_window = new MpcGui(0);
81
84
                else
82
85
                        main_window = new DefaultGui(0);
 
86
 
 
87
                if (move_gui) {
 
88
                        qDebug("SMPlayer::gui: moving main window to %d %d", gui_position.x(), gui_position.y());
 
89
                        main_window->move(gui_position);
 
90
                }
 
91
                if (resize_gui) {
 
92
                        qDebug("SMPlayer::gui: resizing main window to %dx%d", gui_size.width(), gui_size.height());
 
93
                        main_window->resize(gui_size);
 
94
                }
83
95
        }
 
96
 
84
97
        return main_window;
85
98
}
86
99
 
154
167
                        }
155
168
                }
156
169
                else
 
170
                if (argument == "-pos") {
 
171
                        if (n+2 < args.count()) {
 
172
                                bool ok_x, ok_y;
 
173
                                n++;
 
174
                                gui_position.setX( args[n].toInt(&ok_x) );
 
175
                                n++;
 
176
                                gui_position.setY( args[n].toInt(&ok_y) );
 
177
                                if (ok_x && ok_y) move_gui = true;
 
178
                        } else {
 
179
                                printf("Error: expected parameter for -pos\r\n");
 
180
                                return ErrorArgument;
 
181
                        }
 
182
                }
 
183
                else
 
184
                if (argument == "-size") {
 
185
                        if (n+2 < args.count()) {
 
186
                                bool ok_width, ok_height;
 
187
                                n++;
 
188
                                gui_size.setWidth( args[n].toInt(&ok_width) );
 
189
                                n++;
 
190
                                gui_size.setHeight( args[n].toInt(&ok_height) );
 
191
                                if (ok_width && ok_height) resize_gui = true;
 
192
                        } else {
 
193
                                printf("Error: expected parameter for -resize\r\n");
 
194
                                return ErrorArgument;
 
195
                        }
 
196
                }
 
197
                else
157
198
                if (argument == "-playlist") {
158
199
                        is_playlist = true;
159
200
                }
239
280
                                        return NoAction;
240
281
                                }
241
282
                        }
242
 
                        else    
243
 
                        if (!files_to_play.isEmpty()) {
244
 
                                if (c->sendFiles(files_to_play, add_to_playlist)) {
245
 
                                        qDebug("SMPlayer::processArgs: files sent successfully to the running instance");
246
 
                        qDebug("SMPlayer::processArgs: exiting.");
247
 
                                } else {
248
 
                                        qDebug("SMPlayer::processArgs: files couldn't be sent to another instance");
 
283
                        else {
 
284
                                if (!subtitle_file.isEmpty()) {
 
285
                                        if (c->sendSubtitleFile(subtitle_file)) {
 
286
                                                qDebug("SMPlayer::processArgs: subtitle file sent successfully to the running instance");
 
287
                                        } else {
 
288
                                                qDebug("SMPlayer::processArgs: subtitle file couldn't be sent to another instance");
 
289
                                        }
249
290
                                }
250
 
                        }
251
291
 
 
292
                                if (!files_to_play.isEmpty()) {
 
293
                                        if (c->sendFiles(files_to_play, add_to_playlist)) {
 
294
                                                qDebug("SMPlayer::processArgs: files sent successfully to the running instance");
 
295
                                qDebug("SMPlayer::processArgs: exiting.");
 
296
                                        } else {
 
297
                                                qDebug("SMPlayer::processArgs: files couldn't be sent to another instance");
 
298
                                        }
 
299
                                }
 
300
                        }
 
301
                        c->closeConnection();
252
302
                        return NoError;
253
 
 
254
303
                } else {
255
304
                        if (!action.isEmpty()) {
256
305
                                printf("Error: no running instance found\r\n");
309
358
#endif
310
359
 
311
360
void SMPlayer::showInfo() {
 
361
#ifdef Q_OS_WIN
 
362
        QString win_ver;
 
363
        switch (QSysInfo::WindowsVersion) {
 
364
                case QSysInfo::WV_32s: win_ver = "Windows 3.1"; break;
 
365
                case QSysInfo::WV_95: win_ver = "Windows 95"; break;
 
366
                case QSysInfo::WV_98: win_ver = "Windows 98"; break;
 
367
                case QSysInfo::WV_Me: win_ver = "Windows Me"; break;
 
368
                case QSysInfo::WV_NT: win_ver = "Windows NT"; break;
 
369
                case QSysInfo::WV_2000: win_ver = "Windows 2000"; break;
 
370
                case QSysInfo::WV_XP: win_ver = "Windows XP"; break;
 
371
                case QSysInfo::WV_2003: win_ver = "Windows Server 2003"; break;
 
372
                case QSysInfo::WV_VISTA: win_ver = "Windows Vista"; break;
 
373
                #if QT_VERSION >= 0x040501
 
374
                case QSysInfo::WV_WINDOWS7: win_ver = "Windows 7"; break;
 
375
                #endif
 
376
                default: win_ver = QString("other: %1").arg(QSysInfo::WindowsVersion);
 
377
        }
 
378
#endif
312
379
        QString s = QObject::tr("This is SMPlayer v. %1 running on %2")
313
380
            .arg(smplayerVersion())
314
381
#ifdef Q_OS_LINUX
315
382
           .arg("Linux")
316
383
#else
317
384
#ifdef Q_OS_WIN
318
 
           .arg("Windows")
 
385
           .arg("Windows ("+win_ver+")")
319
386
#else
320
387
                   .arg("Other OS")
321
388
#endif