libyui-ncurses-pkg
Loading...
Searching...
No Matches
NCPkgPopupDiskspace.h
1/*
2 Copyright (c) [2002-2011] Novell, Inc.
3 Copyright (c) 2021 SUSE LLC
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) version 3.0 of the License. This library
9 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 License for more details. You should have received a copy of the GNU
13 Lesser General Public License along with this library; if not, write
14 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
15 Floor, Boston, MA 02110-1301 USA
16
17
18 File: NCPkgPopupDiskspace.h
19 Author: Gabriele Strattner <gs@suse.de>
20
21*/
22
23
24#ifndef NCPkgPopupDiskspace_h
25#define NCPkgPopupDiskspace_h
26
27#include <iosfwd>
28#include <vector>
29#include <string>
30
31#include <yui/FSize.h>
32#include <yui/ncurses/NCPopup.h>
33#include <yui/ncurses/NCLabel.h>
34
35#include "NCZypp.h"
36
37
38typedef zypp::DiskUsageCounter::MountPoint ZyppPartitionDu;
39typedef zypp::DiskUsageCounter::MountPointSet ZyppDuSet;
40typedef zypp::DiskUsageCounter::MountPointSet::iterator ZyppDuSetIterator;
41
42class NCTable;
43class NCPushButton;
44
46//
47// CLASS NAME : NCPkgWarningRangeNotifier
48//
49// Class YQPkgWarningRangeNotifier from YQPkgDiskUsageList.h
50//
51
76{
77public:
78
83
88 void enterRange();
89
95 void enterProximity();
96
100 void warningPostedNotify();
101
106 bool inRange() const;
107
113 bool needWarning() const;
114
118 bool leavingProximity() const;
119
120 /*
121 * Log settings to y2log
122 */
123 void logSettings() const;
124
128 void clear();
129
134 void clearHistory();
135
136
137protected:
138
139 bool _inRange;
140 bool _isClose;
141 bool _hasBeenClose;
142 bool _warningPosted;
143};
144
145class NCPkgPopupDiskspace : public NCPopup
146{
147private:
148 NCTable * partitions;
149 NCPushButton * okButton;
150 NCLabel * head;
151
152protected:
153
154 virtual bool postAgain();
155
156 virtual NCursesEvent wHandleInput( wint_t ch );
157
158public:
159 NCPkgPopupDiskspace( const wpos at, std::string headline );
160
161 virtual ~NCPkgPopupDiskspace();
162
163 void createLayout( std::string headline );
164 void doit();
165
166 NCTable *Partitions() { return partitions; }
167
168 virtual int preferredWidth();
169 virtual int preferredHeight();
170
171};
172
174//
175// CLASS NAME : NCPkgPopupDiskspace
176//
177// DESCRIPTION :
178//
180{
181 NCPkgDiskspace & operator=( const NCPkgDiskspace & );
182 NCPkgDiskspace ( const NCPkgDiskspace & );
183
184private:
185
186 bool testmode;
187 NCPkgPopupDiskspace *popupWin;
188 ZyppDuSet testDiskUsage;
189
190 std::string usedPercent( const FSize &used, const FSize &total );
191
195 NCPkgWarningRangeNotifier runningOutWarning;
196
200 NCPkgWarningRangeNotifier overflowWarning;
201
202
203public:
204
205 NCPkgDiskspace( bool testSpaceMode );
206
207 virtual ~NCPkgDiskspace();
208
209
210 void fillPartitionTable();
211
212 std::string checkDiskSpace();
213
214 void setDiskSpace( wint_t key ); // used for testing
215
216 void checkDiskSpaceRange();
217
218 void showInfoPopup( std::string headline );
219
220 void checkRemainingDiskSpace( const ZyppPartitionDu & partition );
221
222 FSize calculateDiff();
223};
224
225
227
228
229#endif // NCPkgPopupDiskspace_h
Definition NCPkgPopupDiskspace.h:180
Definition NCPkgPopupDiskspace.h:146
Definition NCPkgPopupDiskspace.h:76
void enterProximity()
Definition NCPkgPopupDiskspace.cc:608
void warningPostedNotify()
Definition NCPkgPopupDiskspace.cc:616
void enterRange()
Definition NCPkgPopupDiskspace.cc:600
void clear()
Definition NCPkgPopupDiskspace.cc:582
NCPkgWarningRangeNotifier()
Definition NCPkgPopupDiskspace.cc:575
bool needWarning() const
Definition NCPkgPopupDiskspace.cc:637
bool leavingProximity() const
Definition NCPkgPopupDiskspace.cc:630
void clearHistory()
Definition NCPkgPopupDiskspace.cc:591
bool inRange() const
Definition NCPkgPopupDiskspace.cc:623