示例#1
0
void CViewControlsPage::updateUI( ) 
{
	// Make sure we have been initialized.
	if( ! m_bInitialized )
		return;

	// Fill the combo boxes and select the current options.
	fillComboBoxes( );

	// Rotating reference frame.
	m_bRotatingReferenceFrame = m_viewControls.m_rotatingReferenceFrame ? TRUE : FALSE;

	// Update.
	UpdateData( FALSE );
}
FilterGeneratorGUI::FilterGeneratorGUI( QWidget* parent /*= NULL*/ )
:QFrame(parent)
{
	ui = new Ui::FilterCreatorGUI();
	ui->setupUi(this);
	//QPlainText { background-color: white;} 
	QColor col = UsefulGUIFunctions::editorMagicColor();
	this->setStyleSheet("QFrame { background-color:rgb(" + QString::number(col.red()) + "," + QString::number(col.green()) + "," + QString::number(col.blue()) + "); border-radius: 4px; } QAbstractScrollArea { background-color: white;}  QTreeWidget  { background-color: white;} QComboBox QAbstractItemView{qproperty-alternatingRowColors:true;alternate-background-color: white;}");
	fillComboBoxes();
	createContextMenu();
	ui->paramviewer->setVerticalScrollMode(QTreeWidget::ScrollPerPixel);
	ui->arity->view()->setAlternatingRowColors(true);
	ui->paramviewer->header()->hide();
	connect(ui->nameLine,SIGNAL(textChanged(const QString&)),this,SLOT(updateFunctionName(const QString&)));
	connect(ui->nameLine,SIGNAL(textEdited(const QString&)),this,SLOT(filterNameUpdated(const QString&)));
	connect(ui->nameLine,SIGNAL(editingFinished()),this,SLOT(filterNameValidationRequest()));
}
UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(UBTGModel* pModel, QWidget* parent, const char* name) :
    QWidget(parent)
  , mpLayout(NULL)
  , mpButtonTitleLayout(NULL)
  , mpContainerWidgetLayout(NULL)
  , mpModePushButton(NULL)
  , mpPageNumberLabel(NULL)
  , mpScrollArea(NULL)
  , mpContainerWidget(NULL)
  , mpSessionTitle(NULL)
  , mpSeparatorSessionTitle(NULL)
  , mpAuthorsLabel(NULL)
  , mpAuthors(NULL)
  , mpSeparatorAuthors(NULL)
  , mpCreationLabel(NULL)
  , mpLastModifiedLabel(NULL)
  , mpObjectivesLabel(NULL)
  , mpObjectives(NULL)
  , mpSeparatorObjectives(NULL)
  , mpIndexLabel(NULL)
  , mpKeywordsLabel(NULL)
  , mpKeywords(NULL)
  , mpSchoolLevelItemLabel(NULL)
  , mpSchoolLevelBox(NULL)
  , mpSchoolLevelValueLabel(NULL)
  , mpSchoolSubjectsItemLabel(NULL)
  , mpSchoolSubjectsBox(NULL)
  , mpSchoolSubjectsValueLabel(NULL)
  , mpSchoolTypeItemLabel(NULL)
  , mpSchoolTypeBox(NULL)
  , mpSchoolTypeValueLabel(NULL)
  , mpSeparatorIndex(NULL)
  , mpLicenceLabel(NULL)
  , mpLicenceBox( NULL)
  , mpLicenceIcon(NULL)
  , mpLicenceLayout(NULL)
  , mpModel(pModel)
  //, mpSceneItemSessionTitle(NULL)
{
    QWidget::setObjectName(name);
    QString chapterStyle("QLabel {font-size:16px; font-weight:bold;}");
    mpLayout = new QVBoxLayout(0);
    setLayout(mpLayout);
    mpPageNumberLabel = new QLabel(this);
    mpPageNumberLabel->setAlignment(Qt::AlignRight);
    mpPageNumberLabel->setObjectName("UBTGPageNumberLabel");
    mpPageNumberLabel->setText(tr("Title page"));
    mpLayout->addWidget(mpPageNumberLabel);

    mpScrollArea = new QScrollArea();
    mpScrollArea->setFocusPolicy(Qt::NoFocus);
    mpContainerWidget = new QWidget();
    mpContainerWidget->setFocusPolicy(Qt::NoFocus);
    mpContainerWidgetLayout = new QVBoxLayout();

    mpLayout->addWidget(mpScrollArea);
    mpScrollArea->setWidget(mpContainerWidget);
    mpScrollArea->setWidgetResizable(true);
    mpScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    mpContainerWidget->setLayout(mpContainerWidgetLayout);

    mpButtonTitleLayout = new QHBoxLayout(0);

    mpModePushButton = new QPushButton(this);
    mpModePushButton->setIcon(QIcon(":images/teacherGuide/pencil.svg"));
    mpModePushButton->setMaximumWidth(32);
    mpModePushButton->installEventFilter(this);
    mpButtonTitleLayout->addWidget(mpModePushButton);
    connect(mpModePushButton, SIGNAL(clicked()), this, SLOT(switchToMode()));

    mpSessionTitle = new UBTGAdaptableText(0, this, "UBTGSessionTitle");
    mpSessionTitle->setPlaceHolderText(tr("Type session title here ..."));
    mpSessionTitle->setMaximumLength(1000);
    mpButtonTitleLayout->addWidget(mpSessionTitle);
    connect(this, SIGNAL(resized()), mpSessionTitle, SLOT(onTextChanged()));

    mpContainerWidgetLayout->addLayout(mpButtonTitleLayout);

    mpSeparatorSessionTitle = new QFrame(this);
    mpSeparatorSessionTitle->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
    mpSeparatorSessionTitle->setObjectName("UBTGSeparator");
    mpContainerWidgetLayout->addWidget(mpSeparatorSessionTitle);

    mpAuthorsLabel = new QLabel(this);
    mpAuthorsLabel->setObjectName("UBTGZeroPageEditionModeTitle");
    mpAuthorsLabel->setText(tr("Author(s)"));
    mpAuthorsLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpAuthorsLabel);

    mpAuthors = new UBTGAdaptableText(0, this);
    mpAuthors->setObjectName("UBTGZeroPageInputText");
    mpAuthors->setPlaceHolderText(tr("Type authors here ..."));
    mpContainerWidgetLayout->addWidget(mpAuthors);
    connect(this, SIGNAL(resized()), mpAuthors, SLOT(onTextChanged()));

    mpCreationLabel = new QLabel(this);
    mpCreationLabel->setObjectName("UBTGZeroPageDateLabel");
    mpCreationLabel->setText(tr("Creation date:"));
    mpContainerWidgetLayout->addWidget(mpCreationLabel);

    mpLastModifiedLabel = new QLabel(this);
    mpLastModifiedLabel->setObjectName("UBTGZeroPageDateLabel");
    mpLastModifiedLabel->setText(tr("Last Modified:"));
    mpContainerWidgetLayout->addWidget(mpLastModifiedLabel);

    mpSeparatorAuthors = new QFrame(this);
    mpSeparatorAuthors->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
    mpSeparatorAuthors->setObjectName("UBTGSeparator");
    mpContainerWidgetLayout->addWidget(mpSeparatorAuthors);

    mpObjectivesLabel = new QLabel(this);
    mpObjectivesLabel->setObjectName("UBTGZeroPageEditionModeTitle");
    mpObjectivesLabel->setText(tr("Objective(s)"));
    mpObjectivesLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpObjectivesLabel);

    mpObjectives = new UBTGAdaptableText(0, this);
    mpObjectives->setObjectName("UBTGZeroPageInputText");
    mpObjectives->setPlaceHolderText(tr("Type objectives here..."));
    mpContainerWidgetLayout->addWidget(mpObjectives);
    connect(this, SIGNAL(resized()), mpObjectives, SLOT(onTextChanged()));

    mpSeparatorObjectives = new QFrame(this);
    mpSeparatorObjectives->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
    mpSeparatorObjectives->setObjectName("UBTGSeparator");
    mpContainerWidgetLayout->addWidget(mpSeparatorObjectives);

    mpIndexLabel = new QLabel(this);
    mpIndexLabel->setObjectName("UBTGZeroPageEditionModeTitle");
    mpIndexLabel->setText(tr("Resource indexing"));
    mpIndexLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpIndexLabel);

    mpKeywordsLabel = new QLabel(this);
    mpKeywordsLabel->setObjectName("UBTGZeroPageItemLabel");
    mpKeywordsLabel->setText(tr("Keywords:"));
    mpKeywordsLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpKeywordsLabel);
    mpKeywords = new UBTGAdaptableText(0, this);
    mpKeywords->setPlaceHolderText(tr("Type keywords here ..."));
    mpContainerWidgetLayout->addWidget(mpKeywords);
    connect(this, SIGNAL(resized()), mpKeywords, SLOT(onTextChanged()));

    mpSchoolLevelItemLabel = new QLabel(this);
    mpSchoolLevelItemLabel->setObjectName("UBTGZeroPageItemLabel");
    mpSchoolLevelItemLabel->setText(tr("Level:"));
    mpSchoolLevelItemLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpSchoolLevelItemLabel);
    mpSchoolLevelBox = new QComboBox(this);
    mpSchoolLevelBox->setMinimumHeight(22);
    mpSchoolLevelBox->setMinimumWidth(LOWER_RESIZE_WIDTH);
    mpSchoolLevelBox->setObjectName("DockPaletteWidgetComboBox");
    connect(mpSchoolLevelBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onSchoolLevelChanged(QString)));
    mpContainerWidgetLayout->addWidget(mpSchoolLevelBox);
    mpSchoolLevelValueLabel = new QLabel(this);
    mpContainerWidgetLayout->addWidget(mpSchoolLevelValueLabel);

    mpSchoolSubjectsItemLabel = new QLabel(this);
    mpSchoolSubjectsItemLabel->setObjectName("UBTGZeroPageItemLabel");
    mpSchoolSubjectsItemLabel->setText(tr("Subjects:"));
    mpSchoolSubjectsItemLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpSchoolSubjectsItemLabel);
    mpSchoolSubjectsBox = new QComboBox(this);
    mpSchoolSubjectsBox->setMinimumHeight(22);
    mpSchoolSubjectsBox->setMinimumWidth(LOWER_RESIZE_WIDTH);
    mpSchoolSubjectsBox->setObjectName("DockPaletteWidgetComboBox");
    mpContainerWidgetLayout->addWidget(mpSchoolSubjectsBox);
    mpSchoolSubjectsValueLabel = new QLabel(this);
    mpContainerWidgetLayout->addWidget(mpSchoolSubjectsValueLabel);

    mpSchoolTypeItemLabel = new QLabel(this);
    mpSchoolTypeItemLabel->setObjectName("UBTGZeroPageItemLabel");
    mpSchoolTypeItemLabel->setText(tr("Type:"));
    mpSchoolTypeItemLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpSchoolTypeItemLabel);
    mpSchoolTypeBox = new QComboBox(this);
    mpSchoolTypeBox->setMinimumHeight(22);
    mpSchoolTypeBox->setMinimumWidth(LOWER_RESIZE_WIDTH);
    mpSchoolTypeBox->setObjectName("DockPaletteWidgetComboBox");
    mpContainerWidgetLayout->addWidget(mpSchoolTypeBox);
    mpSchoolTypeValueLabel = new QLabel(this);
    mpContainerWidgetLayout->addWidget(mpSchoolTypeValueLabel);

    mpSeparatorIndex = new QFrame(this);
    mpSeparatorIndex->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
    mpSeparatorIndex->setObjectName("UBTGSeparator");
    mpContainerWidgetLayout->addWidget(mpSeparatorIndex);

    mpLicenceLabel = new QLabel(this);
    mpLicenceLabel->setObjectName("UBTGZeroPageItemLabel");
    mpLicenceLabel->setText(tr("Licence"));
    mpLicenceLabel->setStyleSheet(chapterStyle);
    mpContainerWidgetLayout->addWidget(mpLicenceLabel);
    mpLicenceBox = new QComboBox(this);
    mpLicenceBox->setMinimumHeight(22);
    mpLicenceBox->setMinimumWidth(LOWER_RESIZE_WIDTH);
    mpLicenceBox->setObjectName("DockPaletteWidgetComboBox");
    mpContainerWidgetLayout->addWidget(mpLicenceBox);
    mpLicenceLayout = new QHBoxLayout(0);
    mpLicenceIcon = new QLabel(this);
    mpLicenceIcon->setMinimumWidth(LOWER_RESIZE_WIDTH/2);
    mpLicenceLayout->addWidget(mpLicenceIcon);
    mpLicenceValueLabel = new QLabel(this);
    mpLicenceValueLabel->setMinimumWidth(LOWER_RESIZE_WIDTH/2);
    mpLicenceLayout->addWidget(mpLicenceValueLabel);
    mpContainerWidgetLayout->addLayout(mpLicenceLayout);
    mpContainerWidgetLayout->addStretch(1);

    //connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged()));
    fillComboBoxes();

    // Register the metadatas
//    addMetaData(nameSpace(), UBSettings::sessionTitle, mpSessionTitle->text());
//    addMetaData(nameSpace(), UBSettings::sessionAuthors, mpAuthors->text());
//    addMetaData(nameSpace(), UBSettings::sessionObjectives, mpObjectives->text());
//    addMetaData(nameSpace(), UBSettings::sessionKeywords, mpKeywords->text());
//    addMetaData(nameSpace(), UBSettings::sessionGradeLevel, mpSchoolLevelBox->currentText());
//    addMetaData(nameSpace(), UBSettings::sessionSubjects, mpSchoolSubjectsBox->currentText());
//    addMetaData(nameSpace(), UBSettings::sessionType, mpSchoolTypeBox->currentText());
//    addMetaData(nameSpace(), UBSettings::sessionLicence, QString("%0").arg(mpLicenceBox->currentIndex()));

//    UBApplication::documentController->currentDocument()->registerMetaDataProvider(this);
}