~ubuntu-branches/debian/squeeze/smplayer/squeeze

« back to all changes in this revision

Viewing changes to src/csmanager.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Breuil Cyril
  • Date: 2007-06-24 16:35:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070624163529-hhckbmd24uicada7
Tags: 0.5.20-0ubuntu1
* New upstream release
* Change Maintainer Email

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "client.h"
21
21
#include "server.h"
22
22
 
23
 
CSManager::CSManager( int port, QString file_to_open,  
 
23
CSManager::CSManager( int port, QStringList files_to_open,  
24
24
                      QObject * parent, const char * name)
25
25
        : QObject(parent, name )
26
26
{
27
27
        _port = port;
28
 
        _file_to_open = file_to_open;
 
28
        _files_to_open = files_to_open;
29
29
 
30
30
        // Client which will try to connect to other running instance
31
31
        client = new MyClient( _port, this, "client");
52
52
        qDebug("CSManager::notConnectedToPort");
53
53
 
54
54
        server = new MyServer( _port, this);
 
55
        server->setActionsList( actions_list );
 
56
 
55
57
        connect(server, SIGNAL(receivedOpen(QString)),
56
58
            this, SIGNAL(requestOpen(QString)));
 
59
        connect(server, SIGNAL(receivedOpenFiles(QStringList)),
 
60
            this, SIGNAL(requestOpenFiles(QStringList)));
57
61
        connect(server, SIGNAL(receivedFunction(QString)),
58
62
            this, SIGNAL(requestFunction(QString)));
59
63
 
63
67
void CSManager::connectedToInstance() {
64
68
        qDebug("CSManager::connectedToInstance");
65
69
 
66
 
        if ( ! _file_to_open.isEmpty()) {
67
 
                client->sendToServer("open " + _file_to_open);
68
 
                //client->sendToServer("open_utf8 " + _file_to_open.utf8());
 
70
        if (!_files_to_open.empty()) {
 
71
                if (_files_to_open.count()==1) {
 
72
                        client->sendToServer("open " + _files_to_open[0]);
 
73
                        //client->sendToServer("open_utf8 " + _file_to_open.utf8());
 
74
                } else {
 
75
                        client->sendToServer("open_files_start");
 
76
                        for (int n=0; n < _files_to_open.count(); n++) {
 
77
                                client->sendToServer("open_files " + _files_to_open[n]);
 
78
                        }
 
79
                        client->sendToServer("open_files_end");
 
80
                }
69
81
        }
70
82
 
71
83
        client->closeConnection();