File indexing completed on 2024-05-19 04:53:13
0001 /* 0002 * dvbconfigdialog.h 0003 * 0004 * Copyright (C) 2007-2011 Christoph Pfister <christophpfister@gmail.com> 0005 * 0006 * This program is free software; you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation; either version 2 of the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License along 0017 * with this program; if not, write to the Free Software Foundation, Inc., 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0019 */ 0020 0021 #ifndef DVBCONFIGDIALOG_H 0022 #define DVBCONFIGDIALOG_H 0023 0024 #include <QBoxLayout> 0025 #include <QDialog> 0026 #include <QGridLayout> 0027 #include <QLayoutItem> 0028 0029 class QBoxLayout; 0030 class QButtonGroup; 0031 class QCheckBox; 0032 class QGridLayout; 0033 class QLabel; 0034 class QProgressBar; 0035 class QSpinBox; 0036 class QTreeWidget; 0037 class QComboBox; 0038 class QComboBox; 0039 class KJob; 0040 class QLineEdit; 0041 class QTabWidget; 0042 class QDialogButtonBox; 0043 0044 namespace KIO 0045 { 0046 class Job; 0047 class TransferJob; 0048 } 0049 class DvbConfig; 0050 class DvbConfigBase; 0051 class DvbConfigPage; 0052 class DvbDeviceConfig; 0053 class DvbManager; 0054 class DvbDevice; 0055 class DvbSConfigObject; 0056 class DvbSLnbConfigObject; 0057 0058 class RegexInputLine : public QObject 0059 { 0060 Q_OBJECT 0061 0062 public: 0063 int index; 0064 QLineEdit *lineEdit; 0065 QSpinBox *spinBox; 0066 QCheckBox *checkBox; 0067 0068 }; 0069 0070 class DvbConfigDialog : public QDialog 0071 { 0072 Q_OBJECT 0073 public: 0074 DvbConfigDialog(DvbManager *manager_, QWidget *parent); 0075 ~DvbConfigDialog(); 0076 0077 signals: 0078 void removeRegex(DvbConfigPage *page); 0079 0080 private slots: 0081 void changeRecordingFolder(); 0082 void changeTimeShiftFolder(); 0083 void changeXmltvFileName(); 0084 void updateScanFile(); 0085 void openScanFile(); 0086 void newRegex(); 0087 void removeRegex(); 0088 void namingFormatChanged(QString text); 0089 void moveLeft(DvbConfigPage *configPage); 0090 void moveRight(DvbConfigPage *configPage); 0091 void remove(DvbConfigPage *configPage); 0092 0093 private: 0094 void removeWidgets(QGridLayout *layout, int row, int column, bool deleteWidgets); 0095 void initRegexButtons(QGridLayout *buttonGrid); 0096 //void deleteChildWidgets(QLayoutItem *item); 0097 0098 void accept() override; 0099 0100 DvbManager *manager; 0101 QTabWidget *tabWidget; 0102 QLineEdit *recordingFolderEdit; 0103 QLineEdit *timeShiftFolderEdit; 0104 QLineEdit *xmltvFileNameEdit; 0105 QSpinBox *beginMarginBox; 0106 QSpinBox *endMarginBox; 0107 QLineEdit *namingFormat; 0108 QCheckBox *override6937CharsetBox; 0109 QCheckBox *createInfoFileBox; 0110 QCheckBox *disableEpgBox; 0111 QCheckBox *scanWhenIdleBox; 0112 QPixmap validPixmap; 0113 QPixmap invalidPixmap; 0114 QLabel *namingFormatValidLabel; 0115 QList<DvbConfigPage *> configPages; 0116 QLineEdit *actionAfterRecordingLineEdit; 0117 QGridLayout *regexGrid; 0118 QList<RegexInputLine *> regexInputList; 0119 }; 0120 0121 class DvbScanFileDownloadDialog : public QDialog 0122 { 0123 Q_OBJECT 0124 public: 0125 DvbScanFileDownloadDialog(DvbManager *manager_, QWidget *parent); 0126 ~DvbScanFileDownloadDialog(); 0127 0128 private slots: 0129 void progressChanged(KJob *, unsigned long percent); 0130 void dataArrived(KIO::Job *, const QByteArray &data); 0131 void jobFinished(); 0132 0133 private: 0134 DvbManager *manager; 0135 QProgressBar *progressBar; 0136 QLabel *label; 0137 KIO::TransferJob *job; 0138 QByteArray scanData; 0139 QVBoxLayout *mainLayout; 0140 QDialogButtonBox *buttonBox; 0141 QString errorMsg; 0142 }; 0143 0144 class DvbConfigPage : public QWidget 0145 { 0146 Q_OBJECT 0147 public: 0148 DvbConfigPage(QWidget *parent, DvbManager *manager, const DvbDeviceConfig *deviceConfig_); 0149 ~DvbConfigPage(); 0150 0151 void setMoveLeftEnabled(bool enabled); 0152 void setMoveRightEnabled(bool enabled); 0153 0154 const DvbDeviceConfig *getDeviceConfig() const; 0155 QList<DvbConfig> getConfigs(); 0156 0157 signals: 0158 void moveLeft(DvbConfigPage *page); 0159 void moveRight(DvbConfigPage *page); 0160 void remove(DvbConfigPage *page); 0161 void resetConfig(); 0162 0163 private slots: 0164 void moveLeft(); 0165 void moveRight(); 0166 void removeConfig(); 0167 0168 private: 0169 void addHSeparator(const QString &title); 0170 0171 const DvbDeviceConfig *deviceConfig; 0172 QBoxLayout *boxLayout; 0173 QPushButton *moveLeftButton; 0174 QPushButton *moveRightButton; 0175 QList<DvbConfig> configs; 0176 DvbSConfigObject *dvbSObject; 0177 }; 0178 0179 class DvbConfigObject : public QObject 0180 { 0181 Q_OBJECT 0182 public: 0183 DvbConfigObject(QWidget *parent, QBoxLayout *layout, DvbManager *manager, 0184 DvbConfigBase *config_, bool isGen2); 0185 ~DvbConfigObject(); 0186 0187 private slots: 0188 void timeoutChanged(int timeout); 0189 void sourceChanged(int index); 0190 void nameChanged(); 0191 void resetConfig(); 0192 0193 private: 0194 DvbConfigBase *config; 0195 QString defaultName; 0196 QSpinBox *timeoutBox; 0197 QComboBox *sourceBox; 0198 QLineEdit *nameEdit; 0199 bool isGen2; 0200 }; 0201 0202 class DvbSConfigObject : public QObject 0203 { 0204 Q_OBJECT 0205 public: 0206 DvbSConfigObject(QWidget *parent_, QBoxLayout *boxLayout, DvbManager *manager, 0207 const QList<DvbConfig> &configs, DvbDevice *device, bool isGen2); 0208 ~DvbSConfigObject(); 0209 0210 void appendConfigs(QList<DvbConfig> &list); 0211 0212 signals: 0213 void setDiseqcVisible(bool visible); 0214 void setFirstLnbVisible(bool visible); 0215 void setRotorVisible(bool visible); // common parts of usals / positions ui 0216 void setUsalsVisible(bool visible); // usals-specific parts of ui 0217 void setPositionsVisible(bool visible); // positions-specific parts of ui 0218 0219 private slots: 0220 void latitudeChanged(const QString &text); 0221 void longitudeChanged(const QString &text); 0222 void configChanged(int index); 0223 void addSatellite(); 0224 void removeSatellite(); 0225 void resetConfig(); 0226 0227 private: 0228 DvbConfigBase *createConfig(int lnbNumber); 0229 static double toLatitude(const QString &text, bool *ok); 0230 static double toLongitude(const QString &text, bool *ok); 0231 0232 QWidget *parent; 0233 DvbDevice *device; 0234 DvbConfigBase *lnbConfig; 0235 QList<DvbConfig> diseqcConfigs; 0236 QList<DvbSLnbConfigObject *> lnbConfigs; 0237 QStringList sources; 0238 QGridLayout *layout; 0239 QSpinBox *timeoutBox; 0240 QCheckBox *higherVoltageBox; 0241 QComboBox *configBox; 0242 QComboBox *sourceBox; 0243 QSpinBox *rotorSpinBox; 0244 QTreeWidget *satelliteView; 0245 QPixmap validPixmap; 0246 QPixmap invalidPixmap; 0247 QLabel *latitudeValidLabel; 0248 QLabel *longitudeValidLabel; 0249 QLineEdit *latitudeEdit; 0250 QLineEdit *longitudeEdit; 0251 }; 0252 0253 class DvbSLnbConfigObject : public QObject 0254 { 0255 Q_OBJECT 0256 public: 0257 DvbSLnbConfigObject(QSpinBox *timeoutSpinBox, 0258 QCheckBox *higherVoltageBox, QComboBox *sourceBox_, 0259 QPushButton *configureButton_, DvbConfigBase *config_, 0260 DvbDevice *device_); 0261 ~DvbSLnbConfigObject(); 0262 0263 void resetConfig(); 0264 0265 private slots: 0266 void timeoutChanged(int value); 0267 void higherVoltageChanged(int value); 0268 void sourceChanged(int index); 0269 void configure(); 0270 void selectType(int type); 0271 void dialogAccepted(); 0272 0273 private: 0274 QComboBox *sourceBox; 0275 QPushButton *configureButton; 0276 DvbConfigBase *config; 0277 DvbDevice *device; 0278 QDialog *dialog; 0279 0280 QButtonGroup *lnbSelectionGroup; 0281 QLabel *lowBandLabel; 0282 QLabel *switchLabel; 0283 QLabel *highBandLabel; 0284 QLabel *lowRangeLabel; 0285 QLabel *highRangeLabel; 0286 QSpinBox *lowBandSpinBox; 0287 QSpinBox *switchSpinBox; 0288 QSpinBox *highBandSpinBox; 0289 int currentType; 0290 }; 0291 0292 #endif /* DVBCONFIGDIALOG_H */