File indexing completed on 2024-05-26 05:53:46

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 <QCloseEvent>
0029 #include <QDialog>
0030 #include <QKeyEvent>
0031 
0032 class QCheckBox;
0033 class QLineEdit;
0034 class QLabel;
0035 class QRadioButton;
0036 class QComboBox;
0037 class QGroupBox;
0038 
0039 class QProgressBar;
0040 class QPushButton;
0041 class KHelpMenu;
0042 class KFAction;
0043 class KFActionQueue;
0044 
0045 class FloppyData : public QDialog
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050     explicit FloppyData(QWidget *parent = nullptr);
0051     ~FloppyData() override;
0052 
0053     /// Need to overload normal show() in order to mangle caption
0054     void show();
0055     /// Maps combobox selection to drive and density
0056     bool findDevice();
0057     /// set default device
0058     bool setInitialDevice(const QString &dev);
0059     /** Override closeEvent() in order to properly close
0060       the entire application.*/
0061     void closeEvent(QCloseEvent *) override;
0062     /// Writing the user-visible settings.
0063     void writeSettings();
0064     /// Reading the user-visible settings.
0065     void readSettings();
0066     /// Map stored settings to widget status
0067     void setWidgets();
0068     /// Enable/disable all UI elements
0069     void setEnabled(bool);
0070 
0071 public Q_SLOTS:
0072     void quit();
0073     void format();
0074     void reset();
0075 
0076     void formatStatus(const QString &, int);
0077 
0078 protected Q_SLOTS:
0079 
0080 private:
0081     int verifyconfig;
0082     int labelconfig;
0083     QString labelnameconfig;
0084     int quickformatconfig;
0085     QString driveconfig;
0086     QString densityconfig;
0087     QString filesystemconfig;
0088 
0089     int drive;
0090     /// Number of blocks of the floppy (typically 1440)
0091     int blocks;
0092 
0093     bool formating;
0094     // bool abort;
0095 
0096     QLabel *label1;
0097     QLabel *label2;
0098     QLabel *label3;
0099     QGroupBox *buttongroup;
0100     QCheckBox *verifylabel;
0101     QCheckBox *labellabel;
0102     QLineEdit *lineedit;
0103     QRadioButton *quick;
0104     QRadioButton *zerooutformat;
0105     QPushButton *quitbutton;
0106     QPushButton *helpbutton;
0107     QRadioButton *fullformat;
0108     QPushButton *formatbutton;
0109     QLabel *frame;
0110     QComboBox *deviceComboBox;
0111     QComboBox *filesystemComboBox;
0112     QComboBox *densityComboBox;
0113     QProgressBar *progress;
0114     KHelpMenu *helpMenu;
0115 
0116     KFActionQueue *formatActions;
0117 
0118     bool m_canLowLevel; ///< Low level formatting is possible (i.e. was fdformat found?)
0119     bool m_canZeroOut; ///< Is zero-out possible (i.e. was dd found?)
0120 protected:
0121     void keyPressEvent(QKeyEvent *e) override;
0122 };
0123 
0124 #endif // FloppyData_included