view ui/mainwindow.h @ 17:c12825a651ed

Read out content-length and use this to skip existing files
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 19 Feb 2014 14:22:26 +0000
parents 225a5ec20dad
children 9af6198deb8e
line wrap: on
line source
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QSystemTrayIcon>
#include <QDialog>
#include <QSettings>

#include "downloader.h"
class QMenu;
class QAction;

class MainWindow : public QDialog
{
    Q_OBJECT

public:
    MainWindow();

    void setMessage(const QString message) {mCurMessage = message;}
    QString getMessage() {return mCurMessage;}

    enum CurrentState {
        BeforeDownload,
        NewListAvailable,
        NewSoftwareAvailable,
        TransferError
    };

    CurrentState getState() {return mCurState;}
    void setState(CurrentState state) {mCurState = state;}

private slots:
    void showMessage();
    void iconActivated(QSystemTrayIcon::ActivationReason reason);
    void checkUpdates();
    void handleNewList(const QString& fileName, const QDateTime& modDate);
    void handleNewSW(const QString& fileName, const QDateTime& modDate);
    void downloaderError(const QString &message, Downloader::ErrorCode error);

private:
    void verifyAvailableData();
    void createTrayIcon();
    void createActions();

    QString mCurMessage;
    QString mInstalledSWVersion;
    QString mInstalledListVersion;

    QSettings mSettings;

    QSystemTrayIcon *mTrayIcon;

    QMenu *mTrayMenu;
    QAction *mCheckUpdates;
    QAction *mQuitAction;
    CurrentState mCurState;
};

#endif // MAINWINDOW_H

http://wald.intevation.org/projects/trustbridge/