CMakeBuildDirChooser::CMakeBuildDirChooser(QWidget* parent)
    : KDialog(parent)
{
    setDefaultButton(KDialog::Ok);
    setCaption(i18n("Configure a build directory"));

//     QWidget* w= new QWidget(this);
    m_chooserUi = new Ui::CMakeBuildDirChooser;
    m_chooserUi->setupUi(mainWidget());
    m_chooserUi->buildFolder->setMode(KFile::Directory|KFile::ExistingOnly);
    m_chooserUi->installPrefix->setMode(KFile::Directory|KFile::ExistingOnly);
//     setMainWidget(w);

    setCMakeBinary(Path(QStandardPaths::findExecutable( "cmake" )));

    KConfigGroup config = KSharedConfig::openConfig()->group("CMakeBuildDirChooser");
    QStringList lastExtraArguments = config.readEntry("LastExtraArguments", QStringList());;
    m_chooserUi->extraArguments->addItem("");
    m_chooserUi->extraArguments->addItems(lastExtraArguments);
    m_chooserUi->extraArguments->setInsertPolicy(QComboBox::InsertAtTop);
    KCompletion *comp = m_chooserUi->extraArguments->completionObject();
    connect(m_chooserUi->extraArguments, static_cast<void(KComboBox::*)(const QString&)>(&KComboBox::returnPressed), comp, static_cast<void(KCompletion::*)(const QString&)>(&KCompletion::addItem));
    comp->insertItems(lastExtraArguments);

    connect(m_chooserUi->cmakeBin, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated);
    connect(m_chooserUi->buildFolder, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated);
    connect(m_chooserUi->buildType, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this, &CMakeBuildDirChooser::updated);
    connect(m_chooserUi->extraArguments, &KComboBox::editTextChanged, this, &CMakeBuildDirChooser::updated);
    updated();
}
Esempio n. 2
0
//BEGIN class PropertyEditorList
PropertyEditorList::PropertyEditorList( QWidget * parent, Property * property, const char * name )
	: PropertySubEditor( parent, property, name )
{
    QWidget *box = new QWidget(this);
    QHBoxLayout *boxLayout = new QHBoxLayout;

	m_combo = new PropComboBox( box );
	m_combo->setGeometry(frameGeometry());

    boxLayout->addWidget(m_combo);
    box->setLayout(boxLayout);

	bool isEditable = false;
	switch ( property->type() )
	{
		case Property::Type::Port:
		case Property::Type::Pin:
		case Property::Type::PenStyle:
		case Property::Type::PenCapStyle:
		case Property::Type::SevenSegment:
		case Property::Type::KeyPad:
		case Property::Type::Select:
			isEditable = false;
			break;
			
		case Property::Type::String:
		case Property::Type::Multiline:
		case Property::Type::RichText:
		case Property::Type::Combo:
		case Property::Type::FileName:
		case Property::Type::VarName:
			isEditable = true;
			break;
				
		case Property::Type::None:
		case Property::Type::Int:
		case Property::Type::Raw:
		case Property::Type::Double:
		case Property::Type::Color:
		case Property::Type::Bool:
			// not handled by this
			break;
	}
	
	m_combo->setEditable( isEditable );
	
	m_combo->setInsertPolicy(QComboBox::InsertAtBottom);
	m_combo->setAutoCompletion(true);
	m_combo->setMinimumSize(10, 0); // to allow the combo to be resized to a small size

	m_combo->insertItems(m_combo->count(), m_property->allowed() );
	//m_combo->setCurrentText( m_property->displayString() ); // 2018.12.07
    {
        QString text = m_property->displayString();
        int i = m_combo->findText(text);
        if (i != -1)
            m_combo->setCurrentIndex(i);
        else if (m_combo->isEditable())
            m_combo->setEditText(text);
        else
            m_combo->setItemText(m_combo->currentIndex(), text);
    }

	KCompletion *comp = m_combo->completionObject();
	comp->insertItems( m_property->allowed() );

	setWidget(box, m_combo->lineEdit());
	
	connect( m_combo, SIGNAL(activated( const QString & )), this, SLOT(valueChanged( const QString & )) );
	connect( m_property, SIGNAL(valueChanged( const QString& )), m_combo, SLOT(setCurrentItem( const QString & )) );
}
Esempio n. 3
0
CDDAHeaderDataDialog::CDDAHeaderDataDialog(CDDAModel *cddaModel, QWidget *parent) : QDialog(parent) {

  Q_UNUSED(parent);

  cdda_model = cddaModel;
  if (!cdda_model) {
    qDebug() << "CDDAModel is NULL!";
    return;
  }



  setWindowTitle(i18n("Edit Data"));

  QVBoxLayout *mainLayout = new QVBoxLayout;
  setLayout(mainLayout);

  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply|QDialogButtonBox::Cancel);
  okButton = buttonBox->button(QDialogButtonBox::Ok);
  applyButton = buttonBox->button(QDialogButtonBox::Apply);
  okButton->setDefault(true);
  okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
  connect(buttonBox, &QDialogButtonBox::accepted, this, &CDDAHeaderDataDialog::slotAccepted);
  connect(buttonBox, &QDialogButtonBox::rejected, this, &CDDAHeaderDataDialog::reject);
  connect(applyButton, &QPushButton::clicked, this, &CDDAHeaderDataDialog::slotApplied);

  QWidget *widget = new QWidget(this);
  mainLayout->addWidget(widget);
  mainLayout->addWidget(buttonBox);
  ui.setupUi(widget);

  QStringList genres; for (int i = 0; i < GENRE_MAX; ++i) genres.append(QString().fromAscii(ID3_GENRES[i]));
  genres.sort();
  KCompletion *comp = ui.kcombobox_genre->completionObject();
  comp->insertItems(genres);
  ui.kcombobox_genre->addItems(genres);
  connect(ui.kcombobox_genre, SIGNAL(returnPressed(const QString&)), comp, SLOT(addItem(const QString&)));

  ui.checkBox_various->setChecked(cdda_model->isVarious());
  connect(ui.checkBox_various, SIGNAL(toggled(bool)), this, SLOT(trigger_changed()));
  ui.checkBox_multicd->setChecked(cdda_model->isMultiCD());
  connect(ui.checkBox_multicd, SIGNAL(toggled(bool)), this, SLOT(enable_checkbox_multicd(bool)));
  connect(ui.checkBox_multicd, SIGNAL(toggled(bool)), this, SLOT(trigger_changed()));
  ui.qlineedit_artist->setText(cdda_model->artist());
  connect(ui.qlineedit_artist, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed()));
  ui.qlineedit_title->setText(cdda_model->title());
  connect(ui.qlineedit_title, SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed()));
  ui.kintspinbox_cdnum->setValue(cdda_model->cdNum());
  connect(ui.kintspinbox_cdnum, SIGNAL(valueChanged(int)), this, SLOT(trigger_changed()));
  ui.kintspinbox_trackoffset->setValue(cdda_model->trackOffset());
  connect(ui.kintspinbox_trackoffset, SIGNAL(valueChanged(int)), this, SLOT(trigger_changed()));
  ui.kcombobox_genre->lineEdit()->setText(cdda_model->genre());
  connect(ui.kcombobox_genre->lineEdit(), SIGNAL(textEdited(const QString&)), this, SLOT(trigger_changed()));
  {
    bool ok; int year = cdda_model->year().toInt(&ok);
    if (ok) ui.kintspinbox_year->setValue(year); else ui.kintspinbox_year->setValue(QDate::currentDate().year());
  }
  connect(ui.kintspinbox_year, SIGNAL(valueChanged(int)), this, SLOT(trigger_changed()));
  ui.ktextedit_extdata->setText(cdda_model->extendedData().join("\n"));
  connect(ui.ktextedit_extdata, SIGNAL(textChanged()), this, SLOT(trigger_changed()));
  ui.qlineedit_freedbdiscid->setText(QString("0x%1").arg(DiscIDCalculator::FreeDBId(cdda_model->discSignature()), 0, 16));

  enable_checkbox_multicd(cdda_model->isMultiCD());

  applyButton->setEnabled(false);

}