~ubuntu-branches/ubuntu/karmic/choqok/karmic

« back to all changes in this revision

Viewing changes to src/statuswidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Stalcup
  • Date: 2009-02-11 20:31:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090211203126-7uqucqt5r2harpds
Tags: 0.4-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
    This file is part of choqoK, the KDE Twitter client
3
 
 
4
 
    Copyright (C) 2008 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5
 
 
6
 
    This program is free software; you can redistribute it and/or modify
7
 
    it under the terms of the GNU General Public License as published by
8
 
    the Free Software Foundation; either version 3 of the License, or
9
 
    (at your option) any later version.
 
2
    This file is part of choqoK, the KDE mono-blogging client
 
3
 
 
4
    Copyright (C) 2008-2009 Mehrdad Momeny <mehrdad.momeny@gmail.com>
 
5
 
 
6
    This program is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU General Public License as
 
8
    published by the Free Software Foundation; either version 2 of
 
9
    the License or (at your option) version 3 or any later version
 
10
    accepted by the membership of KDE e.V. (or its successor approved
 
11
    by the membership of KDE e.V.), which shall act as a proxy
 
12
    defined in Section 14 of version 3 of the license.
 
13
 
10
14
 
11
15
    This program is distributed in the hope that it will be useful,
12
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
18
    GNU General Public License for more details.
15
19
 
16
20
    You should have received a copy of the GNU General Public License
17
 
    along with this program; if not, write to the Free Software
18
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
21
    along with this program; if not, see http://www.gnu.org/licenses/
19
22
 
20
23
*/
21
24
#ifndef STATUSWIDGET_H
23
26
 
24
27
#include <QFrame>
25
28
#include <QTimer>
26
 
#include <ui_status_base.h>
 
29
#include <ui_statuswidget_base.h>
27
30
#include "datacontainers.h"
28
31
#include "constants.h"
29
 
#define UPDATEINTERVAL 2*60000
30
 
#define COLOROFFSET 20
 
32
#include "account.h"
 
33
 
31
34
/**
32
35
Status Widget
33
36
 
34
 
        @author Mehrdad Momeny <mehrdad.momeny@gmail.com>
 
37
    @author Mehrdad Momeny <mehrdad.momeny@gmail.com>
35
38
*/
36
 
class StatusWidget : public QFrame, public Ui_StatusBase
 
39
class StatusWidget : public QFrame, public Ui_StatusWidgetBase
37
40
{
38
 
Q_OBJECT
 
41
    Q_OBJECT
39
42
public:
40
 
        enum Notify{ WithNotify=0, WithoutNotify};
41
 
    
42
 
    explicit StatusWidget(const Account *account, QWidget *parent = 0);
 
43
    enum Notify { WithNotify = 0, WithoutNotify};
 
44
 
 
45
    explicit StatusWidget( const Account *account, QWidget *parent = 0 );
43
46
 
44
47
    ~StatusWidget();
45
 
        
46
 
        static QString formatDateTime(const QDateTime &time);
47
 
        
48
 
        Status currentStatus() const;
49
 
        void setCurrentStatus(const Status newStatus);
50
 
        void setUserImage(const QString &imgPath);
51
 
        void setUserImage(const QPixmap *image);
52
 
        void setUnread(Notify notifyType);
53
 
        void setRead();
54
 
        void updateFavoriteUi();
55
 
        bool isReaded();
56
 
        
 
48
 
 
49
    QString formatDateTime( const QDateTime &time );
 
50
 
 
51
    Status currentStatus() const;
 
52
    void setCurrentStatus( const Status newStatus );
 
53
    void setUserImage( const QString &imgPath );
 
54
    void setUserImage( const QPixmap *image );
 
55
    void setUnread( Notify notifyType );
 
56
    void setRead();
 
57
    void updateFavoriteUi();
 
58
    bool isReaded();
 
59
 
57
60
signals:
58
 
        void sigReply(QString &userName, uint statusId);
59
 
        void sigDestroy(uint statusId);
60
 
        void sigFavorite(uint statusId, bool isFavorite);
61
 
        
 
61
    void sigReply( const QString &userName, uint statusId );
 
62
    void sigDestroy( uint statusId );
 
63
    void sigFavorite( uint statusId, bool isFavorite );
 
64
 
62
65
protected slots:
63
 
        void setFavorite(bool isFavorite);
64
 
        void requestReply();
65
 
        void requestDestroy();
66
 
        void updateSign();
67
 
    void userImageLocalPathFetched(const QString &remotePath, const QString &localPath);
68
 
        
 
66
    void setFavorite( bool isFavorite );
 
67
    void requestReply();
 
68
    void requestDestroy();
 
69
    void updateSign();
 
70
    void userImageLocalPathFetched( const QString &remotePath, const QString &localPath );
 
71
    void missingStatusReceived( uint statusId, Status status );
 
72
 
69
73
private:
70
 
        void setUserImage();
71
 
        QString prepareStatus(const QString &text, const int &replyStatusId);
72
 
        void setUiStyle();
73
 
        QString generateSign();
74
 
        void updateUi();
75
 
        
76
 
        QTimer timer;
77
 
        Status mCurrentStatus;
78
 
        bool mIsReaded;
 
74
    void setUserImage();
 
75
    QString prepareStatus( const QString &text );
 
76
    void setUiStyle();
 
77
    QString generateSign();
 
78
    QString regenerateSign();
 
79
    void updateUi();
 
80
 
 
81
    QTimer timer;
 
82
    Status mCurrentStatus;
 
83
    bool mIsReaded;
79
84
    const Account *mCurrentAccount;
 
85
    QString signPrefix;
 
86
    QString signPostfix;
80
87
};
81
88
 
82
89
#endif