File indexing completed on 2021-12-21 14:36:42
0001 /* 0002 0003 This file is part of the KFloppy program, part of the KDE project 0004 0005 Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@math.cornell.edu> 0006 Copyright (C) 2004, 2005 Nicolas GOUTTE <goutte@kde.org> 0007 Copyright (C) 2015, 2016 Wolfgang Bauer <wbauer@tmo.at> 0008 0009 This program is free software; you can redistribute it and/or modify 0010 it under the terms of the GNU General Public License as published by 0011 the Free Software Foundation; either version 2 of the License, or 0012 (at your option) any later version. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program; if not, write to the Free Software 0021 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0022 0023 */ 0024 0025 #ifndef FloppyData_included 0026 #define FloppyData_included 0027 0028 #include <KConfig> 0029 #include <QCloseEvent> 0030 #include <QDialog> 0031 #include <QKeyEvent> 0032 0033 class QCheckBox; 0034 class QLineEdit; 0035 class QLabel; 0036 class QRadioButton; 0037 class QComboBox; 0038 class QGroupBox; 0039 0040 class QProgressBar; 0041 class QPushButton; 0042 class KHelpMenu; 0043 class KFAction; 0044 class KFActionQueue; 0045 0046 class FloppyData : public QDialog 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 explicit FloppyData(QWidget *parent = nullptr); 0052 ~FloppyData() override; 0053 0054 /// Need to overload normal show() in order to mangle caption 0055 void show(); 0056 /// Maps combobox selection to drive and density 0057 bool findDevice(); 0058 /// set default device 0059 bool setInitialDevice(const QString &dev); 0060 /** Override closeEvent() in order to properly close 0061 the entire application.*/ 0062 void closeEvent(QCloseEvent *) override; 0063 /// Writing the user-visible settings. 0064 void writeSettings(); 0065 /// Reading the user-visible settings. 0066 void readSettings(); 0067 /// Map stored settings to widget status 0068 void setWidgets(); 0069 /// Enable/disable all UI elements 0070 void setEnabled(bool); 0071 0072 public Q_SLOTS: 0073 void quit(); 0074 void format(); 0075 void reset(); 0076 0077 void formatStatus(const QString &, int); 0078 0079 protected Q_SLOTS: 0080 0081 private: 0082 int verifyconfig; 0083 int labelconfig; 0084 QString labelnameconfig; 0085 int quickformatconfig; 0086 QString driveconfig; 0087 QString densityconfig; 0088 QString filesystemconfig; 0089 0090 int drive; 0091 /// Number of blocks of the floppy (typically 1440) 0092 int blocks; 0093 0094 bool formating; 0095 // bool abort; 0096 0097 QLabel *label1; 0098 QLabel *label2; 0099 QLabel *label3; 0100 QGroupBox *buttongroup; 0101 QCheckBox *verifylabel; 0102 QCheckBox *labellabel; 0103 QLineEdit *lineedit; 0104 QRadioButton *quick; 0105 QRadioButton *zerooutformat; 0106 QPushButton *quitbutton; 0107 QPushButton *helpbutton; 0108 QRadioButton *fullformat; 0109 QPushButton *formatbutton; 0110 QLabel *frame; 0111 QComboBox *deviceComboBox; 0112 QComboBox *filesystemComboBox; 0113 QComboBox *densityComboBox; 0114 QProgressBar *progress; 0115 KHelpMenu *helpMenu; 0116 0117 KFActionQueue *formatActions; 0118 0119 bool m_canLowLevel; ///< Low level formatting is possible (i.e. was fdformat found?) 0120 bool m_canZeroOut; ///< Is zero-out possible (i.e. was dd found?) 0121 protected: 0122 void keyPressEvent(QKeyEvent *e) override; 0123 }; 0124 0125 #endif // FloppyData_included