Logo Search packages:      
Sourcecode: kmess version File versions  Download package

transferentry.h

/***************************************************************************
                          transferentry.h  -  description
                             -------------------
    begin                : Wed Nov 3 2004
    copyright            : (C) 2004 by Diederik van der Boor
    email                : vdboor --at-- codingdomain.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TRANSFERENTRY_H
#define TRANSFERENTRY_H

#ifndef TRANSFERENTRYINTERFACE_H
// Weird but it's required, g++ can't find this file
// if it's included from applications/transferfile.cpp
#include "transferentryinterface.h"
#endif

#include <qimage.h>


class TransferEntry : public TransferEntryInterface
{
  Q_OBJECT

public:
    // Constructor
    TransferEntry( QWidget *parent, const QString filename, const uint filesize, bool incoming = false,
                   const QImage preview = QImage() );
    // Destructor
    ~TransferEntry();

    // Returns true is the transfer is either cancelled or completed
    bool isDone() const;
    // Returns the file name
    QString getFileName() const;
    // Set the transfer ID to identify ourselves to the Transfer Window
    void setTransferID( int transferID );

    // Format nicely the byte quantities
    static QString toReadableBytes( uint bytes );

public slots:
    // Mark the transfer as failed
    void failTransfer( const QString &message = QString::null );
    // Mark the transfer as complete
    void finishTransfer();
    // Set a status message
    void setStatusMessage( const QString &message );
    // Update the progress bar
    void updateProgress( uint bytesTransferred );

private slots:
    // The cancel link was pressed
    void cancelClicked();
    // The open link was pressed
    void openClicked();

signals:
    // Emit a request to cancel the transfer
    void cancelTransfer( int transferID );

private:
    // Indicate the transfer is done (cancelled or complete)
    bool    isDone_;
    // Indicate this is an incoming transfer (shows the open label)
    bool    incoming_;
    // The file name
    QString filename_;
    // The file size
    uint    filesize_;
    // The image preview
    QImage  preview_;
    // The previous percentage
    int     previousPercentage_;
    // The ID of this transfer, used by the Transfer Window
    int     transferID_;
};

#endif

Generated by  Doxygen 1.6.0   Back to index