ProfileDataCoverDialog::ProfileDataCoverDialog(const bool scale, const QSize& size, const QString& format, const QString &pattern, QWidget *parent) : QDialog(parent) { Q_UNUSED(parent); this->scale = scale; this->size = size; this->format = format; this->pattern = pattern; setWindowTitle(i18n("Cover Settings")); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); connect(ui.checkBox_scale, SIGNAL(toggled(bool)), this, SLOT(enable_scale(bool))); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); applyButton = buttonBox -> button(QDialogButtonBox::Apply); connect(buttonBox, &QDialogButtonBox::accepted, this, &ProfileDataCoverDialog::slotAccepted); connect(buttonBox, &QDialogButtonBox::rejected, this, &ProfileDataCoverDialog::reject); connect(applyButton, &QPushButton::clicked, this, &ProfileDataCoverDialog::slotApplied); QWidget *widget = new QWidget(this); mainLayout->addWidget(widget); mainLayout->addWidget(buttonBox); ui.setupUi(widget); connect(ui.kpushbutton_pattern, SIGNAL(clicked()), this, SLOT(pattern_wizard())); ui.kpushbutton_pattern->setIcon(QIcon::fromTheme("tools-wizard")); ui.checkBox_scale->setChecked(scale); enable_scale(ui.checkBox_scale->isChecked()); connect(ui.checkBox_scale, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.kintspinbox_x->setValue(size.width()); connect(ui.kintspinbox_x, SIGNAL(valueChanged(int)), this, SLOT(trigger_changed())); ui.kintspinbox_y->setValue(size.height()); connect(ui.kintspinbox_y, SIGNAL(valueChanged(int)), this, SLOT(trigger_changed())); ui.kcombobox_format->addItem(i18n("JPEG (Joint Photographic Experts Group)"), "JPEG"); ui.kcombobox_format->addItem(i18n("PNG (Portable Network Graphics)"), "PNG"); ui.kcombobox_format->addItem(i18n("BMP (Windows Bitmap)"), "BMP"); { int i = ui.kcombobox_format->findData(format); ui.kcombobox_format->setCurrentIndex(i); } connect(ui.kcombobox_format, SIGNAL(currentIndexChanged(int)), this, SLOT(trigger_changed())); ui.qlineedit_pattern->setText(pattern); connect(ui.qlineedit_pattern, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); applyButton->setEnabled(false); }
ProfileDataPlaylistDialog::ProfileDataPlaylistDialog(const QString& format, const QString &pattern, const bool absFilePath, const bool utf8, QWidget *parent) : QDialog(parent) { Q_UNUSED(parent); this->format = format; this->pattern = pattern; this->absFilePath = absFilePath; this->utf8 = utf8; setWindowTitle(i18n("Playlist Settings")); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); applyButton = buttonBox->button(QDialogButtonBox::Apply); connect(buttonBox, &QDialogButtonBox::accepted, this, &ProfileDataPlaylistDialog::slotAccepted); connect(buttonBox, &QDialogButtonBox::rejected, this, &ProfileDataPlaylistDialog::reject); connect(applyButton, &QPushButton::clicked, this, &ProfileDataPlaylistDialog::slotApplied); QWidget *widget = new QWidget(this); mainLayout->addWidget(widget); mainLayout->addWidget(buttonBox); ui.setupUi(widget); connect(ui.kpushbutton_pattern, SIGNAL(clicked()), this, SLOT(pattern_wizard())); ui.kpushbutton_pattern->setIcon(QIcon::fromTheme("tools-wizard")); ui.kcombobox_format->addItem("M3U (Textbased Winamp Playlist)", "M3U"); ui.kcombobox_format->addItem("PLS (Textbased Playlist)", "PLS"); ui.kcombobox_format->addItem("XSPF (XML Shareable Playlist Format)", "XSPF"); { int i = ui.kcombobox_format->findData(format); ui.kcombobox_format->setCurrentIndex(i); } enable_abs_file_path(!(format == "XSPF")); enable_utf8(!(format == "XSPF")); connect(ui.kcombobox_format, SIGNAL(currentIndexChanged(int)), this, SLOT(trigger_changed())); ui.qlineedit_pattern->setText(pattern); connect(ui.qlineedit_pattern, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); ui.checkBox_abs_file_path->setChecked(absFilePath); connect(ui.checkBox_abs_file_path, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_utf8->setChecked(utf8); connect(ui.checkBox_utf8, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); applyButton->setEnabled(false); }
ProfileDataInfoDialog::ProfileDataInfoDialog(const QStringList& text, const QString& pattern, const QString& suffix, QWidget *parent) : QDialog(parent) { Q_UNUSED(parent); this->text = text; this->pattern = pattern; this->suffix = suffix; setWindowTitle(i18n("Info Settings")); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); applyButton = buttonBox->button(QDialogButtonBox::Apply); connect(buttonBox, &QDialogButtonBox::accepted, this, &ProfileDataInfoDialog::slotAccepted); connect(buttonBox, &QDialogButtonBox::rejected, this, &ProfileDataInfoDialog::reject); connect(applyButton, &QPushButton::clicked, this, &ProfileDataInfoDialog::slotApplied); QWidget *widget = new QWidget(this); mainLayout->addWidget(widget); mainLayout->addWidget(buttonBox); ui.setupUi(widget); connect(ui.kpushbutton_pattern, SIGNAL(clicked()), this, SLOT(pattern_wizard())); ui.kpushbutton_pattern->setIcon(QIcon::fromTheme("tools-wizard")); ui.ktextedit_text->setPlainText(text.join("\n")); connect(ui.ktextedit_text, SIGNAL(textChanged()), this, SLOT(trigger_changed())); ui.qlineedit_pattern->setText(pattern); connect(ui.qlineedit_pattern, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); ui.qlineedit_suffix->setText(suffix); connect(ui.qlineedit_suffix, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); ui.kpushbutton_load->setIcon(QIcon::fromTheme("document-open")); ui.kpushbutton_save->setIcon(QIcon::fromTheme("document-save")); connect(ui.kurllabel_aboutvariables, SIGNAL(leftClickedUrl()), this, SLOT(about_variables())); connect(ui.kpushbutton_load, SIGNAL(clicked()), this, SLOT(load_text())); connect(ui.kpushbutton_save, SIGNAL(clicked()), this, SLOT(save_text())); applyButton->setEnabled(false); }
ProfileDataDialog::ProfileDataDialog(ProfileModel *profileModel, const int profileRow, QWidget *parent) : KDialog(parent) { Q_UNUSED(parent); profile_model = profileModel; if (!profile_model) { kDebug() << "ProfileModel is NULL!"; return; } profile_row = profileRow; QWidget *widget = new QWidget(this); ui.setupUi(widget); setMainWidget(widget); if (profile_row >= 0) { lame_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_LAME_PARAMETERS_INDEX)).toString()); oggenc_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_OGGENC_PARAMETERS_INDEX)).toString()); flac_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_FLAC_PARAMETERS_INDEX)).toString()); faac_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_FAAC_PARAMETERS_INDEX)).toString()); wave_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_WAVE_PARAMETERS_INDEX)).toString()); custom_parameters.fromString(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_CUSTOM_PARAMETERS_INDEX)).toString()); } lame_widget = new lameWidget(&lame_parameters, this); connect(lame_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); oggenc_widget = new oggencWidget(&oggenc_parameters, this); connect(oggenc_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); flac_widget = new flacWidget(&flac_parameters, this); connect(flac_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); faac_widget = new faacWidget(&faac_parameters, this); connect(faac_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); wave_widget = new waveWidget(&wave_parameters, this); connect(wave_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); custom_widget = new customWidget(&custom_parameters, this); connect(custom_widget, SIGNAL(triggerChanged()), this, SLOT(trigger_changed())); ui.stackedWidget_encoder->addWidget(lame_widget); ui.stackedWidget_encoder->addWidget(oggenc_widget); ui.stackedWidget_encoder->addWidget(flac_widget); ui.stackedWidget_encoder->addWidget(faac_widget); ui.stackedWidget_encoder->addWidget(wave_widget); ui.stackedWidget_encoder->addWidget(custom_widget); QMap<int,QString> encoders = EncoderAssistant::availableEncoderNameList(); QMap<int,QString>::const_iterator i = encoders.constBegin(); while (i != encoders.constEnd()) { ui.kcombobox_encoder->addItem(i.value(), i.key()); ++i; } connect(ui.kcombobox_encoder, SIGNAL(activated(int)), this, SLOT(set_encoder_by_combobox(int))); connect(ui.kpushbutton_pattern, SIGNAL(clicked()), this, SLOT(pattern_wizard())); ui.kpushbutton_pattern->setIcon(KIcon("tools-wizard")); connect(ui.kpushbutton_cover, SIGNAL(clicked()), this, SLOT(cover_settings())); connect(ui.kpushbutton_playlist, SIGNAL(clicked()), this, SLOT(playlist_settings())); connect(ui.kpushbutton_info, SIGNAL(clicked()), this, SLOT(info_settings())); connect(ui.kpushbutton_hashlist, SIGNAL(clicked()), this, SLOT(hashlist_settings())); connect(ui.kpushbutton_cuesheet, SIGNAL(clicked()), this, SLOT(cuesheet_settings())); connect(ui.kpushbutton_singlefile, SIGNAL(clicked()), this, SLOT(singlefile_settings())); connect(ui.checkBox_cover, SIGNAL(toggled(bool)), this, SLOT(enable_settings_cover(bool))); connect(ui.checkBox_playlist, SIGNAL(toggled(bool)), this, SLOT(enable_settings_playlist(bool))); connect(ui.checkBox_info, SIGNAL(toggled(bool)), this, SLOT(enable_settings_info(bool))); connect(ui.checkBox_hashlist, SIGNAL(toggled(bool)), this, SLOT(enable_settings_hashlist(bool))); connect(ui.checkBox_cuesheet, SIGNAL(toggled(bool)), this, SLOT(enable_settings_cuesheet(bool))); connect(ui.checkBox_singlefile, SIGNAL(toggled(bool)), this, SLOT(enable_settings_singlefile(bool))); connect(ui.checkBox_singlefile, SIGNAL(toggled(bool)), this, SLOT(disable_filenames(bool))); connect(ui.checkBox_singlefile, SIGNAL(toggled(bool)), this, SLOT(disable_playlist(bool))); if (profile_row >= 0) { setCaption(i18n("Modify Profile")); setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply); ui.klineedit_name->setText(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_NAME_INDEX)).toString()); connect(ui.klineedit_name, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); ui.klineedit_name->setCursorPosition(0); ui.kiconbutton_icon->setIcon(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ICON_INDEX)).toString()); connect(ui.kiconbutton_icon, SIGNAL(iconChanged(const QString&)), this, SLOT(trigger_changed())); set_encoder(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_ENCODER_SELECTED_INDEX)).toInt()); connect(ui.kcombobox_encoder, SIGNAL(activated(int)), this, SLOT(trigger_changed())); ui.klineedit_pattern->setText(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PATTERN_INDEX)).toString()); connect(ui.klineedit_pattern, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed())); ui.klineedit_pattern->setCursorPosition(0); ui.checkBox_fat32compatible->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_FAT32COMPATIBLE_INDEX)).toBool()); connect(ui.checkBox_fat32compatible, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_underscore->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_UNDERSCORE_INDEX)).toBool()); connect(ui.checkBox_underscore, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_2digitstracknum->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_2DIGITSTRACKNUM_INDEX)).toBool()); connect(ui.checkBox_2digitstracknum, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_cover->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SC_INDEX)).toBool()); enable_settings_cover(ui.checkBox_cover->isChecked()); connect(ui.checkBox_cover, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_playlist->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PL_INDEX)).toBool()); enable_settings_playlist(ui.checkBox_playlist->isChecked()); connect(ui.checkBox_playlist, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_info->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_INF_INDEX)).toBool()); enable_settings_info(ui.checkBox_info->isChecked()); connect(ui.checkBox_info, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_hashlist->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_HL_INDEX)).toBool()); enable_settings_hashlist(ui.checkBox_hashlist->isChecked()); connect(ui.checkBox_hashlist, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_cuesheet->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_CUE_INDEX)).toBool()); enable_settings_cuesheet(ui.checkBox_cuesheet->isChecked()); connect(ui.checkBox_cuesheet, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_singlefile->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SF_INDEX)).toBool()); enable_settings_singlefile(ui.checkBox_singlefile->isChecked()); connect(ui.checkBox_singlefile, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); ui.checkBox_replaygain->setChecked(profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_RG_INDEX)).toBool()); connect(ui.checkBox_replaygain, SIGNAL(toggled(bool)), this, SLOT(trigger_changed())); disable_playlist(ui.checkBox_singlefile->isChecked()); //profile data cover data pdcd_scale = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SC_SCALE_INDEX)).toBool(); pdcd_size = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SC_SIZE_INDEX)).toSize(); pdcd_format = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SC_FORMAT_INDEX)).toString(); pdcd_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SC_NAME_INDEX)).toString(); //profile data playlist data pdpd_format = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PL_FORMAT_INDEX)).toString(); pdpd_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PL_NAME_INDEX)).toString(); pdpd_abs_file_path = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PL_ABS_FILE_PATH_INDEX)).toBool(); pdpd_utf8 = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_PL_UTF8_INDEX)).toBool(); //profile data info data pdid_text = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_INF_TEXT_INDEX)).toStringList(); pdid_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_INF_NAME_INDEX)).toString(); pdid_suffix = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_INF_SUFFIX_INDEX)).toString(); //profile data hashlist data pdhd_format = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_HL_FORMAT_INDEX)).toString(); pdhd_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_HL_NAME_INDEX)).toString(); //profile data cue sheet data pdud_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_CUE_NAME_INDEX)).toString(); //profile data single file data pdsd_pattern = profile_model->data(profile_model->index(profile_row, PROFILE_MODEL_COLUMN_SF_NAME_INDEX)).toString(); enableButtonApply(false); }