summaryrefslogtreecommitdiffstats
path: root/smb4k/core/smb4ksynchronizationinfo.h
blob: f254dd1b5a5ed84370beae0633306369503d49e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/***************************************************************************
    smb4ksynchronizationinfo  -  This is a container that holds
    information about progress of the synchronization
                             -------------------
    begin                : So Mai 20 2007
    copyright            : (C) 2007 by Alexander Reinholdt
    email                : dustpuppy@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *   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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful, but   *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,   *
 *   MA  02110-1301 USA                                                    *
 ***************************************************************************/

#ifndef SMB4KSYNCHRONIZATIONINFO_H
#define SMB4KSYNCHRONIZATIONINFO_H

// Qt includes
#include <qstring.h>

class Smb4KSynchronizationInfo
{
  public:
    /**
     * The constructor. It takes no arguments and you should use the
     * setXYZ() functions to set the necessary values.
     */
    Smb4KSynchronizationInfo();

    /**
     * The destructor.
     */
    ~Smb4KSynchronizationInfo();

    /**
     * Set the text that's provided in rsync's output. This may either be a
     * file name or some information about the progress
     *
     * @param text        The text
     */
    void setText( const QString &text );

    /**
     * Return the name of the file that is currently processed. This may
     * be empty if no information about the file name is available.
     *
     * @returns the name of the file that is currently processed or an empty
     * string
     */
    const QString &text () const { return m_text; }

    /**
     * Set the progress of the file that's currently processed.
     *
     * @param percent     The progress in percent
     */
    void setIndividualProgress( int percent );

    /**
     * Return the progress of the current file transfer. If no
     * information is available, -1 is returned.
     *
     * @returns the progress of the current file transfer or -1.
     */
    const int individualProgress() const { return m_individual_progress; }

    /**
     * Set the total progress of synchronization process.
     *
     * @param percent     The progress in percent
     */
    void setTotalProgress( int percent );

    /**
     * Return the total progress of synchronization process. If no
     * information is available, -1 is returned.
     *
     * @returns the total progress of the synchronization or -1.
     */
    const int totalProgress() const { return m_total_progress; }

    /**
     * Set the total number of files that have been considered for the
     * synchronization.
     *
     * @param total       The total number of files
     */
    void setTotalFileNumber( int total );

    /**
     * Return the total number of files that were considered for synchronization.
     * If no information is available, -1 is returned.
     *
     * @returns the total number of files or -1.
     */
    const int totalFileNumber() const { return m_total_files; }

    /**
     * Set the number of files that have already been processed during the
     * synchronization.
     *
     * @param processed   The number of files that have been processed
     */
    void setProcessedFileNumber( int processed );

    /**
     * Return the number of files that have already been processed during the
     * synchronization. If no information is available, -1 is returned.
     *
     * @returns the number of processed files or -1.
     */
    const int processedFileNumber() const { return m_processed_files; }

    /**
     * Set the transfer rate. This should be a string that already contains
     * all information, i.e. the string should look like this: 100 kB/s.
     *
     * @param rate        The rate string (e.g. 100 kB/s)
     */
    void setTransferRate( const QString &rate );

    /**
     * Return the transfer rate. This is a string that already contains all
     * information, so that you can just put it into your widget without any
     * modification. It may also be empty if no information about the rate is
     * available.
     *
     * @returns The rate or an empty string.
     */
    const QString &transferRate() const { return m_rate; }

  private:
    /**
     * The text
     */
    QString m_text;

    /**
     * The individual progress
     */
    int m_individual_progress;

    /**
     * The total progress
     */
    int m_total_progress;

    /**
     * The total file number
     */
    int m_total_files;

    /**
     * The number of processed files
     */
    int m_processed_files;

    /**
     * The rate string
     */
    QString m_rate;
};

#endif