~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to clientgui/ViewTransfers.h

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Berkeley Open Infrastructure for Network Computing
2
 
// http://boinc.berkeley.edu
3
 
// Copyright (C) 2005 University of California
4
 
//
5
 
// This is free software; you can redistribute it and/or
6
 
// modify it under the terms of the GNU Lesser General Public
7
 
// License as published by the Free Software Foundation;
8
 
// either version 2.1 of the License, or (at your option) any later version.
9
 
//
10
 
// This software is distributed in the hope that it will be useful,
11
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 
// See the GNU Lesser General Public License for more details.
14
 
//
15
 
// To view the GNU Lesser General Public License visit
16
 
// http://www.gnu.org/copyleft/lesser.html
17
 
// or write to the Free Software Foundation, Inc.,
18
 
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 
20
 
#ifndef _VIEWTRANSFERS_H_
21
 
#define _VIEWTRANSFERS_H_
22
 
 
23
 
#if defined(__GNUG__) && !defined(__APPLE__)
24
 
#pragma interface "ViewTransfers.cpp"
25
 
#endif
26
 
 
27
 
 
28
 
#include "BOINCBaseView.h"
29
 
 
30
 
 
31
 
class CTransfer : public wxObject {
32
 
public:
33
 
        CTransfer();
34
 
        ~CTransfer();
35
 
 
36
 
        wxString m_strProjectName;
37
 
    wxString m_strFileName;
38
 
    wxString m_strProgress;
39
 
    wxString m_strSize;
40
 
    wxString m_strTime;
41
 
    wxString m_strSpeed;
42
 
    wxString m_strStatus;
43
 
};
44
 
 
45
 
 
46
 
class CViewTransfers : public CBOINCBaseView {
47
 
    DECLARE_DYNAMIC_CLASS( CViewTransfers )
48
 
 
49
 
public:
50
 
    CViewTransfers();
51
 
    CViewTransfers(wxNotebook* pNotebook);
52
 
 
53
 
    ~CViewTransfers();
54
 
 
55
 
    virtual wxString&       GetViewName();
56
 
    virtual wxString&       GetViewDisplayName();
57
 
    virtual const char**    GetViewIcon();
58
 
 
59
 
    void                    OnTransfersRetryNow( wxCommandEvent& event );
60
 
    void                    OnTransfersAbort( wxCommandEvent& event );
61
 
 
62
 
protected:
63
 
    std::vector<CTransfer*> m_TransferCache;
64
 
 
65
 
    virtual wxInt32         GetDocCount();
66
 
 
67
 
    virtual wxString        OnListGetItemText( long item, long column ) const;
68
 
 
69
 
    virtual wxString        OnDocGetItemText( long item, long column ) const;
70
 
 
71
 
    virtual wxInt32         AddCacheElement();
72
 
    virtual wxInt32         EmptyCache();
73
 
    virtual wxInt32         GetCacheCount();
74
 
    virtual wxInt32         RemoveCacheElement();
75
 
    virtual wxInt32         UpdateCache( long item, long column, wxString& strNewData );
76
 
 
77
 
    virtual void            UpdateSelection();
78
 
 
79
 
    wxInt32                 FormatProjectName( wxInt32 item, wxString& strBuffer ) const;
80
 
    wxInt32                 FormatFileName( wxInt32 item, wxString& strBuffer ) const;
81
 
    wxInt32                 FormatProgress( wxInt32 item, wxString& strBuffer ) const;
82
 
    wxInt32                 FormatSize( wxInt32 item, wxString& strBuffer ) const;
83
 
    wxInt32                 FormatTime( wxInt32 item, wxString& strBuffer ) const;
84
 
    wxInt32                 FormatSpeed( wxInt32 item, wxString& strBuffer ) const;
85
 
    wxInt32                 FormatStatus( wxInt32 item, wxString& strBuffer ) const;
86
 
 
87
 
    DECLARE_EVENT_TABLE()
88
 
};
89
 
 
90
 
 
91
 
#endif
92
 
 
 
1
// This file is part of BOINC.
 
2
// http://boinc.berkeley.edu
 
3
// Copyright (C) 2008 University of California
 
4
//
 
5
// BOINC is free software; you can redistribute it and/or modify it
 
6
// under the terms of the GNU Lesser General Public License
 
7
// as published by the Free Software Foundation,
 
8
// either version 3 of the License, or (at your option) any later version.
 
9
//
 
10
// BOINC is distributed in the hope that it will be useful,
 
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
// See the GNU Lesser General Public License for more details.
 
14
//
 
15
// You should have received a copy of the GNU Lesser General Public License
 
16
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
#ifndef _VIEWTRANSFERS_H_
 
19
#define _VIEWTRANSFERS_H_
 
20
 
 
21
#if defined(__GNUG__) && !defined(__APPLE__)
 
22
#pragma interface "ViewTransfers.cpp"
 
23
#endif
 
24
 
 
25
 
 
26
#include "BOINCBaseView.h"
 
27
 
 
28
 
 
29
class CTransfer : public wxObject {
 
30
public:
 
31
        CTransfer();
 
32
        ~CTransfer();
 
33
 
 
34
        wxString m_strProjectName;
 
35
    wxString m_strFileName;
 
36
    float m_fProgress;
 
37
    double m_fBytesXferred;
 
38
    double m_fTotalBytes;
 
39
    double m_dTime;
 
40
    double m_dSpeed;
 
41
    wxString m_strStatus;
 
42
    wxString m_strProjectURL;   // Used internally, not displayed
 
43
    wxString m_strProgress;
 
44
    wxString m_strSize;
 
45
    wxString m_strTime;
 
46
    wxString m_strSpeed;
 
47
};
 
48
 
 
49
 
 
50
class CViewTransfers : public CBOINCBaseView {
 
51
    DECLARE_DYNAMIC_CLASS( CViewTransfers )
 
52
 
 
53
public:
 
54
    CViewTransfers();
 
55
    CViewTransfers(wxNotebook* pNotebook);
 
56
 
 
57
    ~CViewTransfers();
 
58
 
 
59
    virtual wxString&       GetViewName();
 
60
    virtual wxString&       GetViewDisplayName();
 
61
    virtual const char**    GetViewIcon();
 
62
    virtual const int       GetViewCurrentViewPage();
 
63
 
 
64
    virtual wxString        GetKeyValue1(int iRowIndex);
 
65
    virtual wxString        GetKeyValue2(int iRowIndex);
 
66
    virtual int             FindRowIndexByKeyValues(wxString& key1, wxString& key2);
 
67
 
 
68
    void                    OnTransfersRetryNow( wxCommandEvent& event );
 
69
    void                    OnTransfersAbort( wxCommandEvent& event );
 
70
 
 
71
    std::vector<CTransfer*> m_TransferCache;
 
72
 
 
73
protected:
 
74
    virtual wxInt32         GetDocCount();
 
75
 
 
76
    virtual wxString        OnListGetItemText( long item, long column ) const;
 
77
 
 
78
    virtual wxInt32         AddCacheElement();
 
79
    virtual wxInt32         EmptyCache();
 
80
    virtual wxInt32         GetCacheCount();
 
81
    virtual wxInt32         RemoveCacheElement();
 
82
    virtual bool            SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex);
 
83
 
 
84
    virtual bool            IsSelectionManagementNeeded();
 
85
 
 
86
    virtual void            UpdateSelection();
 
87
 
 
88
    void                    GetDocProjectName(wxInt32 item, wxString& strBuffer) const;
 
89
    void                    GetDocFileName(wxInt32 item, wxString& strBuffer) const;
 
90
    void                    GetDocProgress(wxInt32 item, float& fBuffer) const;
 
91
    wxInt32                 FormatProgress( float fBuffer, wxString& strBuffer ) const;
 
92
    void                    GetDocBytesXferred(wxInt32 item, double& fBuffer) const;
 
93
    void                    GetDocTotalBytes(wxInt32 item, double& fBuffer) const;
 
94
    wxInt32                 FormatSize( double fBytesSent, double fFileSize, wxString& strBuffer ) const;
 
95
    void                    GetDocTime(wxInt32 item, double& fBuffer) const;
 
96
    wxInt32                 FormatTime( double fBuffer, wxString& strBuffer ) const;
 
97
    void                    GetDocSpeed(wxInt32 item, double& fBuffer) const;
 
98
    wxInt32                 FormatSpeed( double fBuffer, wxString& strBuffer ) const;
 
99
    void                    GetDocStatus(wxInt32 item, wxString& strBuffer) const;
 
100
    void                    GetDocProjectURL(wxInt32 item, wxString& strBuffer) const;
 
101
 
 
102
    virtual double          GetProgressValue(long item);
 
103
    virtual wxString        GetProgressText( long item);
 
104
    
 
105
    int                     GetTransferCacheAtIndex(CTransfer*& transferPtr, int index);
 
106
 
 
107
    DECLARE_EVENT_TABLE()
 
108
};
 
109
 
 
110
 
 
111
#endif
 
112