Ejemplo n.º 1
0
void catEditWidget::onOk()
{
    resetColorForm();
    if(validateForm())
    {
    Categorie item;

    if(State_ == Modification)
        item.m_id = enModification->m_id;


    item.m_nom=ui->nomLineEdit->text();
item.m_confiance=ui->confLineEdit->text().toInt();


    if(State_ == Modification)
    {
        model_->addCategorie(item,true);
        State_ = Insertion;
    }
    else
        model_->addCategorie(item);

    clearForm();
    }

}
Ejemplo n.º 2
0
void GxsGroupDialog::newGroup()
{
	setupDefaults();
	setupVisibility();
	setupReadonly();
	clearForm();
}
Ejemplo n.º 3
0
void ReactionsManager::fillForm()
{
    t_Reaction_ptr pReaction = currentReaction();

    if (pReaction.isNull()) {
        clearForm();
        setModified(false);
        return;
    }

    _ui->le_reaction_alias->setText(pReaction->_alias);
    _ui->cmbx_reaction_performer_behavior_type->setCurrentIndex(pReaction->_performer_behavior);

    setEventAtCombobox(pReaction);

    setPerformerTypeAtCombobox(pReaction->_performer_type);
    setPerformerAliasAtCombobox(pReaction);

    setBehaviorPresetAtCombobox(pReaction);

    _ui->chbx_reversible_flag->setChecked(pReaction->_bReversible);
    updateUiReversibleRelated();

    actualizeAvailableStates();

    setModified(false);
}
Ejemplo n.º 4
0
inline void ExpandersManager::fillForm()
{
    t_Expander_ptr pExpander = currentExpander();

    if (pExpander.isNull()) {
        clearForm();
        setModified(false);
        return;
    }

    _ui->le_expander_alias->setText(pExpander->_uin->_palias);
    _ui->le_expander_uin->setText(QString::number(pExpander->_uin->_puin));

    QString temp_type;
    switch (pExpander->_type) {
    case OBJ_RZE:
        temp_type = tr(TYPE_ZONES_TEXT);
        break;
    case OBJ_RAE:
        temp_type = tr(TYPE_RELAYS_TEXT);
        break;
    }
    bool bItemSelected = _ui->listWidget_expanders->currentRow() != -1;
    _ui->comboBox_expander_type->setEnabled(!bItemSelected);
    _ui->comboBox_expander_type->setCurrentIndex(-1);
    _ui->comboBox_expander_type->setCurrentText(temp_type);

    setModified(false);
}
Ejemplo n.º 5
0
ExpandersManager::ExpandersManager(QWidget *parent) :
    QWidget(parent),
    _ui(new Ui::ExpandersManager()),
    _bAdding(false)
{
    _ui->setupUi(this);

    _ui->splitter_expanders->setSizes(QList<int>() << 180 << 100);
    _ui->splitter_expanders->setStretchFactor(1, 1);

    _ui->le_expander_alias->setMaxLength(ALIAS_LEN);
    _ui->le_expander_uin->setValidator(new QIntValidator(1, 65535, this));

    _relation << "uin_id";

    connect(_ui->listWidget_expanders, SIGNAL(currentRowChanged(int)), this, SLOT(sltUpdateUI()));

    connect(_ui->btn_add_apply, SIGNAL(clicked()), SLOT(sltAddApply()));
    connect(_ui->btn_del_cancel, SIGNAL(clicked()), SLOT(sltDeleteCancel()));
    connect(_ui->le_expander_uin, SIGNAL(textEdited(QString)), SLOT(sltUpdateUI()));
    connect(_ui->le_expander_alias, SIGNAL(textEdited(QString)), SLOT(sltUpdateUI()));
    connect(_ui->comboBox_expander_type, SIGNAL(activated(int)), SLOT(sltUpdateUI()));

    _ui->comboBox_expander_type->addItems(QStringList() << tr(TYPE_ZONES_TEXT) << tr(TYPE_RELAYS_TEXT));
    clearForm();

    setModified(false);
    QTimer::singleShot(0, this, SLOT(sltUpdateList()));
}
Ejemplo n.º 6
0
EnrichmentDialog::EnrichmentDialog(WidgetType wt, Graph *g, ApplicationWindow *app, QWidget *parent)
	: QDialog(parent), d_app(app), d_plot(g), d_widget(NULL), d_widget_type(wt)
{
	bool standAlone = qobject_cast<ApplicationWindow*>(parent);
	if (standAlone)
		setSizeGripEnabled(true);

	setAttribute(Qt::WA_DeleteOnClose);

    QDialogButtonBox *buttonBox = new QDialogButtonBox;
	clearButton = NULL;
	editPage = NULL;
	imagePage = NULL;
	patternPage = NULL;
	textPage = NULL;

	if (wt == Tex){
		setWindowTitle(tr("QtiPlot") + " - " + tr("Tex Equation Editor"));

    	clearButton = buttonBox->addButton(tr("Clea&r"), QDialogButtonBox::ResetRole);
		connect(clearButton, SIGNAL(clicked()), this, SLOT(clearForm()));
	} else if (wt == MDIWindow)
        setWindowTitle(tr("QtiPlot") + " - " + tr("Window Geometry"));
	else
		setWindowTitle(tr("QtiPlot") + " - " + tr("Object Properties"));

    updateButton = buttonBox->addButton(tr("&Apply"), QDialogButtonBox::ApplyRole);
	connect(updateButton, SIGNAL(clicked()), this, SLOT(apply()));

	cancelButton = buttonBox->addButton(tr("&Close"), QDialogButtonBox::RejectRole);
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

	tabWidget = new QTabWidget();
	if (wt == Text)
		initTextPage();
	else if (wt == Tex)
		initEditorPage();
	else if (wt == Image)
		initImagePage();
	else if (wt == Frame || wt == Ellipse)
		initPatternPage();

    if (wt != MDIWindow)
        initFramePage();
	initGeometryPage();

    QVBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(tabWidget);
	if (standAlone)
		layout->addWidget(buttonBox);
    setLayout(layout);

	connect(tabWidget, SIGNAL(currentChanged (QWidget *)), this, SLOT(customButtons(QWidget *)));
}
Ejemplo n.º 7
0
void EditCourseDialog::loadCourse( const QString &str )
{
	clearForm();

	QStringList list = str.trimmed().split("\t");
	if( list.count() < 7 )
		return;

	dateEdit->setDate( QDate::fromString( list.at(0), dateFormat ) );
	cbLineEdit->setText( list.at(1).simplified() );
	lowLineEdit->setText( list.at(2).simplified() );
	topLineEdit->setText( list.at(3).simplified() );
	controlLineEdit->setText( list.at(4).simplified() );

	QString text = tr("Currency: <b>%1</b>").arg(list.at(5).simplified()) + 
		tr("  Code: <b>%1</b>").arg( list.at(6).simplified() );
	currencyLabel->setText( text );

	loadCrossCourseRequest();
}
Ejemplo n.º 8
0
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{
	std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
	std::cerr << std::endl;

	std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
	std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
	std::cerr << " External: " << mGrpMeta.mCircleId;
	std::cerr << std::endl;

	setupDefaults();
	setupVisibility();
	setupReadonly();
	clearForm();
    	setGroupSignFlags(mGrpMeta.mSignFlags) ;

	/* setup name */
	ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
	
	/* Show Mode */
	ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
	ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
	ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
	ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
    ui.authorLabel->setId(mGrpMeta.mAuthorId);
	ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
	ui.descriptiontextEdit->setPlainText(description);
	
		switch (mode())
  {
		case MODE_CREATE:{
		}
		break;
		case MODE_SHOW:{
			ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
			if (!mPicture.isNull())
				ui.headerFrame->setHeaderImage(mPicture);
		}
		break;
		case MODE_EDIT:{
		}
		break;
  }
	/* set description */
	ui.groupDesc->setPlainText(description);
    	QString distribution_string = "[Unknown]";

	switch(mGrpMeta.mCircleType)
	{
		case GXS_CIRCLE_TYPE_YOUREYESONLY:
			ui.typeLocal->setChecked(true);
			distribution_string = tr("Your friends only") ;
			ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
			ui.distributionCircleComboBox->setVisible(true) ;
			ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
			break;
		case GXS_CIRCLE_TYPE_PUBLIC:
			ui.typePublic->setChecked(true);
			distribution_string = tr("Public") ;
			ui.distributionCircleComboBox->setVisible(false) ;
			break;
		case GXS_CIRCLE_TYPE_EXTERNAL:
			ui.typeGroup->setChecked(true);
			distribution_string = tr("Restricted to circle:") ;
			ui.distributionCircleComboBox->setVisible(true) ;
			ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
			ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
			break;
		default:
			std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
			std::cerr << std::endl;
			break;
	}
    ui.distributionValueLabel->setText(distribution_string) ;

	ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
    
    	if(!mGrpMeta.mAuthorId.isNull())
		ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;

	updateCircleOptions();
}
Ejemplo n.º 9
0
void catEditWidget::onCancel()
{
    clearForm();
    State_ = Insertion;
}
Ejemplo n.º 10
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    MyInfo = new info(this);

    // ------------------------- Всякая красота ----------------------------

    QSettings settings ("Other/config.ini", QSettings::IniFormat);
    settings.beginGroup("Settings");
    this->setWindowTitle("FormUdod - " + settings.value("windowtitle", "Запись в объединения").toString());
    settings.endGroup();

    this->setWindowIcon(QIcon(":/icons/Icons/udod"));

    help = new QDialog(this);
    help->setWindowTitle(tr("Помощь"));
    help->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
    QTextEdit* textEdit = new QTextEdit;
    textEdit->setReadOnly(true);
    textEdit->setHtml(tr("Данная программа представляет собой клиент для работы с базой данных. Перед началом работы убедитесь, что соединение с базой установлено — "
                         "в нижней части окна программы должна появиться соответствующая надпись. <b>Если соединение отсутствует, обратитесь к системному администратору.</b><br /><br />"
                         "Если соединение установлено, заполните анкету. <b>Обратите внимание, что поля, помеченные символом *, обязательны для заполнения!</b> "
                         "Если одно или несколько обязательных полей не заполнено, то при попытке сохранения программа выдаст соответствующее сообщения, а данные сохранены не будут.<br /><br />"
                         "Для сохранения введённых данных нажмите <img src=:/icons/Icons/save.png/ height=20> <b>Сохранить</b> на панели инструментов и подтвердите действие, нажав <b>Да</b> во всплывающем окне, "
                         "либо нажмите <b>Нет</b> для его отмены.<br /><br />"
                         "Для очистки всех полей нажмите <img src=:/icons/Icons/clear.png/ height=20> <b>Очистить форму</b>. Обратите внимание, что при этом все введённые данные будут потеряны!<br /><br />"
                         "Для получения информации о программе и лицензии нажмите <img src=:/icons/Icons/info.png/ height=20> <b>О программе</b>.<br /><br />"
                         "<b>Изменение настроек программы может осуществляться только системным администратором.</b>"));
    QVBoxLayout* layout = new QVBoxLayout;
    QDialogButtonBox* button = new QDialogButtonBox(QDialogButtonBox::Ok);
    connect(button, SIGNAL(accepted()), help, SLOT(close()));
    layout->addWidget(textEdit);
    layout->addWidget(button);
    help->setLayout(layout);

    // --------------------------- Main ToolBar ----------------------------

    // Иконки: http://www.flaticon.com/packs/web-application-ui/4

    ui->mainToolBar->addAction(QIcon(":/icons/Icons/save.png"), tr("Сохранить"), this, SLOT(saveInfo()));
    ui->mainToolBar->addAction(QIcon(":/icons/Icons/clear.png"), tr("Очистить форму"), this, SLOT(clearForm()));
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addAction(QIcon(":/icons/Icons/help.png"), tr("Помощь"), help, SLOT(show()));
    ui->mainToolBar->addAction(QIcon(":/icons/Icons/info.png"), tr("О программе"), MyInfo, SLOT(show()));

    names = new QRegularExpression("^[А-ЯЁ]{1}[а-яё]*(-[А-ЯЁ]{1}[а-яё]*)?$");
    words = new QRegularExpression();

    // Получение инфы обобъединениях

    QFile file ("Other/association.txt"); // Указываем название файла
    if(file.open(QIODevice::ReadOnly)) // Открываем файл для чтения
    {
        // Если файл успешно открыт
        QTextStream stream(&file); // Создаём поток текстового ввода/вывода
        if(stream.status() == QTextStream::Ok)
        {
            // Если поток создан успешно
            QStringList qsl; // Создаём список строк
            while (!stream.atEnd())
            {
                // Считываем поочерёдно все строки, форматируя их
                QString str = stream.readLine().simplified().replace(QRegularExpression("-{2,}"), "-");
                // Если строка не пустая и не комментарий
                if (!str.isEmpty() && str.at(0) != '#')
                    qsl.append(str); // Заносим её в список
            }
            qsl.sort(); // Сортируем список
            qsl.prepend("- Не выбрано -"); // Добавляем 0й элемент
            ui->ass1->addItems(qsl); // Устанавливаем текст для ComboBox
            ui->ass2->addItems(qsl);
            ui->ass3->addItems(qsl);
        }
        file.close(); // Закрываем файл
    }

    // ----------------------------- DataBase ------------------------------

    myDB = QSqlDatabase::addDatabase("QMYSQL");    // Указываем СУБД
    settings.beginGroup("Database");
    myDB.setHostName(settings.value("hostname", "localhost").toString());
    myDB.setDatabaseName(settings.value("dbname", "kcttTempDB").toString());
    myDB.setPort(settings.value("port").toInt());
    myDB.setUserName(settings.value("username").toString());
    myDB.setPassword(settings.value("password").toString());
    settings.endGroup();

    QString status;
    if (myDB.open() && !myDB.isOpenError() && myDB.isValid())                            // Открываем соединение
        status = tr("Соединение с базой установлено.");
    else
        status = tr("Ошибка соединения с основной базой: ") + myDB.lastError().text();

    ui->lblStatus->setText(status);
}
Ejemplo n.º 11
0
void QsoDataForm::fillForm(const log::Qso &qso)
{
    int cbIndex;

    // clear the form
    clearForm();

    // save the id value
    curPrimaryKey = qso.getId();

    // populate required values
    ui->qsoCallsignTxt->setText(qso.callsign);
    ui->qsoDateTimeOn->setDateTime(qso.timeOnUtc);

    // band CB
    cbIndex = ui->qsoBandCb->findData(qso.band, Qt::DisplayRole);
    if(cbIndex == -1) {
        qWarning() << "QSO Form: can't find band: " << qso.band;
    } else {
        ui->qsoBandCb->setCurrentIndex(cbIndex);
    }

    // mode CB (must determine whether to use mode or submode)
    if(qso.submode.isNull()) {
        cbIndex = ui->qsoModeCb->findData(qso.mode, Qt::DisplayRole);
    } else {
        cbIndex = ui->qsoModeCb->findData(qso.submode, Qt::DisplayRole);
    }

    if(cbIndex == -1) {
        qWarning() << "QSO Form: can't find mode/submode: " << qso.mode << ", " << qso.submode;
    } else {
        ui->qsoModeCb->setCurrentIndex(cbIndex);
    }

    // optional values
    // time off
    if(!qso.timeOffUtc.isNull()) {
        ui->qsoDateTimeOff->setDateTime(qso.timeOffUtc);
    } else {
        ui->qsoDateTimeOff->setDateTime(QDateTime::fromTime_t(0).toUTC());
    }

    // rst sent
    if(!qso.rstSent.isNull()) {
        ui->qsoRstSentTxt->setText(QString::number(qso.rstSent.toInt()));
    }

    // rst recv
    if(!qso.rstRecv.isNull()) {
        ui->qsoRstRecvTxt->setText(QString::number(qso.rstRecv.toInt()));
    }

    // freq
    if(!qso.freqMhz.isNull()) {
        ui->qsoFreqMhzTxt->setText(QString::number(qso.freqMhz.toDouble(), 'f', 6));
    }

    // power
    if(!qso.powerWatts.isNull()) {
        ui->qsoPowerWattsTxt->setText(QString::number(qso.powerWatts.toDouble(), 'f', 1));
    }

    // qth
    if(!qso.city.isNull()) {
        ui->qsoQthTxt->setText(qso.city);
    }

    // country
    if(!qso.country.isNull()) {
        cbIndex = ui->qsoCountryCb->findData(qso.country, Qt::DisplayRole);
        if(cbIndex == -1) {
            qWarning() << "QSO Form: can't find country: " << qso.country;
        } else {
            ui->qsoCountryCb->setCurrentIndex(cbIndex);
        }
    }

    // pas
    if(!qso.primaryAdminSub.isNull()) {
        cbIndex = ui->qsoPriAdminCb->findData(qso.primaryAdminSub, Qt::DisplayRole);
        if(cbIndex == -1) {
            qWarning() << "QSO Form: can't pri admin sub: " << qso.primaryAdminSub;
        } else {
            ui->qsoPriAdminCb->setCurrentIndex(cbIndex);
        }
    }

    // TODO secondary admin sub

    // comments
    if(!qso.comments.isNull()) {
        ui->qsoCommentsTxt->setPlainText(qso.comments);
    }

    // qso msg
    if(!qso.qsoMsg.isNull()) {
        ui->qsoMessageTxt->setPlainText(qso.qsoMsg);
    }
}