utilities/downloadmanager/inc/progressivedownloadserver.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /**
       
     2    This file is part of CWRT package **
       
     3 
       
     4    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
       
     5 
       
     6    This program is free software: you can redistribute it and/or modify
       
     7    it under the terms of the GNU (Lesser) General Public License as 
       
     8    published by the Free Software Foundation, version 2.1 of the License. 
       
     9    This program is distributed in the hope that it will be useful, but
       
    10    WITHOUT ANY WARRANTY; without even the implied warranty of 
       
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
       
    12    (Lesser) General Public License for more details. You should have 
       
    13    received a copy of the GNU (Lesser) General Public License along 
       
    14    with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 */
       
    16 
       
    17 #ifndef PROGRESSIVE_DOWNLOAD_SERVER_H
       
    18 #define PROGRESSIVE_DOWNLOAD_SERVER_H
       
    19 
       
    20 #include "dmpimpl.h"
       
    21 #include <QObject>
       
    22 #include <QTcpServer>
       
    23 
       
    24 typedef QAbstractSocket::SocketError ProgressiveDlServerError;
       
    25 
       
    26 // forward declarations
       
    27 class ProgressiveDownloadServerPrivate;
       
    28 class Download;
       
    29 
       
    30 // class declaration 
       
    31 class ProgressiveDownloadServer : public QObject {
       
    32     Q_OBJECT
       
    33     DM_DECLARE_PRIVATE(ProgressiveDownloadServer);
       
    34 public:
       
    35     Q_DECL_EXPORT ProgressiveDownloadServer(Download* download); 
       
    36     virtual ~ProgressiveDownloadServer();
       
    37 
       
    38     // starts the server
       
    39     Q_DECL_EXPORT int startServer(void);
       
    40     // stops the server
       
    41     Q_DECL_EXPORT int stopServer(void);
       
    42     // returns the port number
       
    43     Q_DECL_EXPORT quint16 serverPort(void);
       
    44     // last error occurred
       
    45     Q_DECL_EXPORT ProgressiveDlServerError lastError(void);
       
    46     // last error occurred
       
    47     Q_DECL_EXPORT QString lastErrorString(void);
       
    48 
       
    49 private: // copy constructor and assaignment operator
       
    50     ProgressiveDownloadServer();
       
    51     ProgressiveDownloadServer(const ProgressiveDownloadServer&);
       
    52     ProgressiveDownloadServer &operator=(const ProgressiveDownloadServer&);
       
    53     bool event(QEvent *event);
       
    54 signals:
       
    55 
       
    56 private slots:
       
    57     void handleConnection(void);
       
    58     void handleRequest(void);
       
    59 
       
    60 };
       
    61 
       
    62 #endif