Example #1
0
MergeCmappedDialog::MergeCmappedDialog(TFilePath &levelPath)
    : Dialog(TApp::instance()->getMainWindow(), true, true, "Merge Tlv")
    , m_levelPath(levelPath) {
  bool ret = true;

  QString path =
      QString::fromStdWString(m_levelPath.getParentDir().getWideString());
  QString name = QString::fromStdString(m_levelPath.getName());

  setWindowTitle(tr(" Merge Tlv Levels"));
  m_saveInFileFld = new DVGui::FileField(0, path);
  ret             = ret && connect(m_saveInFileFld, SIGNAL(pathChanged()), this,
                       SLOT(onPathChanged()));
  addWidget(tr("Save in:"), m_saveInFileFld);

  m_fileNameFld = new DVGui::LineEdit(name + "_merged");
  m_fileNameFld->setMaximumHeight(DVGui::WidgetHeight);
  ret = ret && connect(m_fileNameFld, SIGNAL(editingFinished()),
                       SLOT(onNameChanged()));
  addWidget(tr("File Name:"), m_fileNameFld);

  QPushButton *okBtn = new QPushButton(tr("Apply"), this);
  okBtn->setDefault(true);
  QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
  connect(okBtn, SIGNAL(clicked()), this, SLOT(accept()));
  connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));

  addButtonBarWidget(okBtn, cancelBtn);
}
//----------------------------------------------------------------------------//
void NamedElement::setName(const String& name)
{
    if (d_name == name)
        return;

    if (getParentElement())
    {
        NamedElement* parent = dynamic_cast<NamedElement*>(getParentElement());

        if (parent && parent->isChild(name))
        {
            CEGUI_THROW(AlreadyExistsException("Failed to rename "
                "NamedElement at: " + getNamePath() + " as: " + name + ". A Window "
                "with that name is already attached as a sibling."));
        }
    }

    // log this under informative level
    Logger::getSingleton().logEvent("Renamed element at: " + getNamePath() +
                                    " as: " + name, Informative);

    d_name = name;

    NamedElementEventArgs args(this);
    onNameChanged(args);
}
BasicmLearningEditor::BasicmLearningEditor(TemplateCore *core, QWidget *parent)
  : TemplateEditor(core, parent), m_ui(new Ui::BasicmLearningEditor) {
  m_ui->setupUi(this);

  // Set validators.
  QRegExpValidator *author_validator = new QRegExpValidator(this);
  QRegExpValidator *title_validator = new QRegExpValidator(this);

  author_validator->setRegExp(QRegExp(".{,50}"));
  title_validator->setRegExp(QRegExp(".{,100}"));

  m_ui->m_txtAuthor->lineEdit()->setValidator(author_validator);
  m_ui->m_txtName->lineEdit()->setValidator(title_validator);

  // Set tab order.
  QList<QWidget*> tab_order_widgets;
  tab_order_widgets << m_ui->m_txtTitle->lineEdit() << m_ui->m_txtDescription <<
                       m_ui->m_txtAuthor->lineEdit() << m_ui->m_txtName->lineEdit() <<
                       m_ui->m_listItems << m_ui->m_btnItemAdd << m_ui->m_btnItemRemove <<
                       m_ui->m_btnItemUp << m_ui->m_btnItemDown;

  for (int i = 1; i < tab_order_widgets.size(); i++) {
    setTabOrder(tab_order_widgets.at(i - 1), tab_order_widgets.at(i));
  }


  m_ui->m_txtTitle->lineEdit()->setPlaceholderText(tr("Title of the item"));
  m_ui->m_txtNumberOfItems->lineEdit()->setEnabled(false);
  m_ui->m_txtAuthor->lineEdit()->setPlaceholderText(tr("Author of this collection"));
  m_ui->m_txtName->lineEdit()->setPlaceholderText(tr("Name of this collection"));

  IconFactory *factory = IconFactory::instance();

  m_ui->m_btnItemAdd->setIcon(factory->fromTheme("item-add"));
  m_ui->m_btnItemRemove->setIcon(factory->fromTheme("item-remove"));
  m_ui->m_btnItemUp->setIcon(factory->fromTheme("move-up"));
  m_ui->m_btnItemDown->setIcon(factory->fromTheme("move-down"));

  connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkTitle(QString)));
  connect(m_ui->m_btnItemAdd, SIGNAL(clicked()), this, SLOT(addNewItem()));
  connect(m_ui->m_btnItemRemove, SIGNAL(clicked()), this, SLOT(removeSelectedItem()));
  connect(m_ui->m_txtDescription, SIGNAL(textChanged()), this, SLOT(saveItem()));
  connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(saveItem()));
  connect(m_ui->m_listItems, SIGNAL(currentRowChanged(int)), this, SLOT(displayItem(int)));
  connect(m_ui->m_btnItemUp, SIGNAL(clicked()), this, SLOT(moveItemUp()));
  connect(m_ui->m_btnItemDown, SIGNAL(clicked()), this, SLOT(moveItemDown()));
  connect(m_ui->m_txtAuthor->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString)));
  connect(m_ui->m_txtName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)));

  checkTitle(m_ui->m_txtTitle->lineEdit()->text());
  checkAuthor();
  checkName();
  setEditorsEnabled(false);
  updateItemCount();
}
void UIWizardNewVMPageExpert::sltNameChanged(const QString &strNewText)
{
    /* Call to base-class: */
    onNameChanged(strNewText);

    /* Fetch recommended RAM value: */
    CGuestOSType type = m_pNameAndSystemEditor->type();
    m_pRamSlider->setValue(type.GetRecommendedRAM());
    m_pRamEditor->setText(QString::number(type.GetRecommendedRAM()));

    /* Broadcast complete-change: */
    emit completeChanged();
}
CLSStandardsWheelConfigurationViewElement::CLSStandardsWheelConfigurationViewElement(CLSStandardsWheelElement *element, QWidget *parent)
	: QWidget(parent)
{
	wheelElement_ = element;

	nameEdit_ = new QLineEdit(wheelElement_->name());
	nameEdit_->setAlignment(Qt::AlignCenter);

	connect(nameEdit_, SIGNAL(editingFinished()), this, SLOT(onNameChanged()));
	connect(wheelElement_, SIGNAL(nameChanged(QString)), nameEdit_, SLOT(setText(QString)));

	QHBoxLayout	*elementLayout = new QHBoxLayout;
	elementLayout->addWidget(nameEdit_, 0, Qt::AlignCenter);

	setLayout(elementLayout);
}
/*!
    Constructor
 */
FacebookConnection::FacebookConnection(QObject *parent) :
    SocialConnection(parent),
    m_facebook(new Facebook(this)),
    m_manager(new FacebookDataManager(this)),
    m_apiCall(Undefined)
{
    connect(m_facebook, SIGNAL(requestCompleted(QVariant,QByteArray)),
            this, SLOT(onRequestCompleted(QVariant,QByteArray)));
    connect(m_facebook, SIGNAL(requestFailed(QVariant,QString)),
            this, SLOT(onRequestFailed(QVariant,QString)));
    connect(m_facebook, SIGNAL(clientIdChanged(QString)),
            this, SIGNAL(clientIdChanged(QString)));
    connect(m_facebook, SIGNAL(accessTokenChanged(QString)),
            this, SIGNAL(accessTokenChanged(QString)));
    connect(m_facebook, SIGNAL(authorizedChanged(bool)),
            this, SLOT(onAuthenticationChanged(bool)));
    connect(m_facebook, SIGNAL(screenNameChanged(QString)),
            this, SLOT(onNameChanged(QString)));
}
Example #7
0
CategoriesDialog::CategoriesDialog(QWidget *parent) :
    QDialog(parent),
    m_model(new CategoryModel(this)),
    m_view(new QTreeView(this)),
    m_nameEdit(new QLineEdit(this)),
    m_pathButton(new QMaemo5ValueButton(tr("Download path"), this)),
    m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Vertical, this)),
    m_layout(new QGridLayout(this))
{
    setWindowTitle(tr("Categories"));
    setMinimumHeight(360);

    m_view->setModel(m_model);
    m_view->setSelectionBehavior(QTreeView::SelectRows);
    m_view->setContextMenuPolicy(Qt::CustomContextMenu);
    m_view->setEditTriggers(QTreeView::NoEditTriggers);
    m_view->setItemsExpandable(false);
    m_view->setUniformRowHeights(true);
    m_view->setAllColumnsShowFocus(true);
    m_view->setRootIsDecorated(false);
    m_view->header()->setStretchLastSection(true);

    m_nameEdit->setPlaceholderText(tr("Name"));

    m_pathButton->setValueText(tr("None chosen"));

    m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);

    m_layout->addWidget(m_view, 0, 0);
    m_layout->addWidget(m_nameEdit, 1, 0);
    m_layout->addWidget(m_pathButton, 2, 0);
    m_layout->addWidget(m_buttonBox, 2, 1);
    m_layout->setRowStretch(0, 1);

    connect(m_view, SIGNAL(clicked(QModelIndex)), this, SLOT(setCurrentCategory(QModelIndex)));
    connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
    connect(m_nameEdit, SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)));
    connect(m_nameEdit, SIGNAL(returnPressed()), m_buttonBox->button(QDialogButtonBox::Ok), SLOT(animateClick()));
    connect(m_pathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
    connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(addCategory()));
}
CategorySettingsPage::CategorySettingsPage(QWidget *parent) :
    SettingsPage(parent),
    m_model(new CategoryModel(this)),
    m_view(new QTreeView(this)),
    m_nameEdit(new QLineEdit(this)),
    m_pathEdit(new QLineEdit(this)),
    m_pathButton(new QPushButton(QIcon::fromTheme("document-open"), tr("&Browse"), this)),
    m_saveButton(new QPushButton(QIcon::fromTheme("document-save"), tr("&Save"), this)),
    m_layout(new QFormLayout(this))
{
    setWindowTitle(tr("Categories"));

    m_view->setModel(m_model);
    m_view->setAlternatingRowColors(true);
    m_view->setSelectionBehavior(QTreeView::SelectRows);
    m_view->setContextMenuPolicy(Qt::CustomContextMenu);
    m_view->setEditTriggers(QTreeView::NoEditTriggers);
    m_view->setItemsExpandable(false);
    m_view->setUniformRowHeights(true);
    m_view->setAllColumnsShowFocus(true);
    m_view->setRootIsDecorated(false);
    m_view->header()->setStretchLastSection(true);

    m_saveButton->setEnabled(false);

    m_layout->addRow(m_view);
    m_layout->addRow(tr("&Name:"), m_nameEdit);
    m_layout->addRow(tr("&Path:"), m_pathEdit);
    m_layout->addWidget(m_pathButton);
    m_layout->addWidget(m_saveButton);

    connect(m_view, SIGNAL(clicked(QModelIndex)), this, SLOT(setCurrentCategory(QModelIndex)));
    connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
    connect(m_nameEdit, SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)));
    connect(m_nameEdit, SIGNAL(returnPressed()), m_saveButton, SLOT(animateClick()));
    connect(m_pathEdit, SIGNAL(textChanged(QString)), this, SLOT(onPathChanged(QString)));
    connect(m_pathEdit, SIGNAL(returnPressed()), m_saveButton, SLOT(animateClick()));
    connect(m_pathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
    connect(m_saveButton, SIGNAL(clicked()), this, SLOT(addCategory()));
}
FlashCardEditor::FlashCardEditor(TemplateCore *core, QWidget *parent)
  : TemplateEditor(core, parent), m_ui(new Ui::FlashCardEditor) {
  m_ui->setupUi(this);

  // Set validators.
  QRegExpValidator *author_validator = new QRegExpValidator(this);
  QRegExpValidator *title_validator = new QRegExpValidator(this);

  author_validator->setRegExp(QRegExp(".{,50}"));
  title_validator->setRegExp(QRegExp(".{,100}"));

  m_ui->m_txtAuthor->lineEdit()->setValidator(author_validator);
  m_ui->m_txtName->lineEdit()->setValidator(title_validator);

  // Set validators.
  QRegExpValidator *question_validator = new QRegExpValidator(this);
  QRegExpValidator *hint_validator = new QRegExpValidator(this);

  question_validator->setRegExp(QRegExp(".{,100}"));
  hint_validator->setRegExp(QRegExp(".{,30}"));

  m_ui->m_txtQuestion->lineEdit()->setValidator(question_validator);
  m_ui->m_txtHint->lineEdit()->setValidator(hint_validator);

  // Set tab order.
  QList<QWidget*> tab_order_widgets;
  tab_order_widgets << m_ui->m_txtQuestion->lineEdit() << m_ui->m_btnPictureSelect  <<
                       m_ui->m_txtAnswer->lineEdit() << m_ui->m_txtHint->lineEdit() <<
                       m_ui->m_txtAuthor->lineEdit() << m_ui->m_txtName->lineEdit() <<
                       m_ui->m_listQuestions << m_ui->m_btnQuestionAdd << m_ui->m_btnQuestionRemove <<
                       m_ui->m_btnQuestionUp << m_ui->m_btnQuestionDown;

  for (int i = 1; i < tab_order_widgets.size(); i++) {
    setTabOrder(tab_order_widgets.at(i - 1), tab_order_widgets.at(i));
  }

  m_ui->m_txtNumberOfQuestions->lineEdit()->setEnabled(false);

  m_ui->m_lblPictureFile->label()->setWordWrap(true);
  m_ui->m_txtAnswer->lineEdit()->setPlaceholderText(tr("Answer for the answer"));
  m_ui->m_txtHint->lineEdit()->setPlaceholderText(tr("Hint for the answer"));

  m_ui->m_lblPictureFile->setStatus(WidgetWithStatus::Error, QString(), tr("No picture selected"));
  m_ui->m_txtAuthor->lineEdit()->setPlaceholderText(tr("Author of this quiz"));
  m_ui->m_txtName->lineEdit()->setPlaceholderText(tr("Name of this quiz"));

  IconFactory *factory = IconFactory::instance();

  m_ui->m_btnQuestionAdd->setIcon(factory->fromTheme("item-add"));
  m_ui->m_btnQuestionRemove->setIcon(factory->fromTheme("item-remove"));
  m_ui->m_btnQuestionUp->setIcon(factory->fromTheme("move-up"));
  m_ui->m_btnQuestionDown->setIcon(factory->fromTheme("move-down"));

  connect(m_ui->m_btnPictureSelect, SIGNAL(clicked()), this, SLOT(selectPicture()));
  connect(m_ui->m_txtAuthor->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString)));
  connect(m_ui->m_txtQuestion->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(saveQuestion()));
  connect(m_ui->m_txtName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)));
  connect(m_ui->m_txtAnswer->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(onAnswerChanged(QString)));
  connect(m_ui->m_txtHint->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(onHintChanged(QString)));
  connect(m_ui->m_btnQuestionAdd, SIGNAL(clicked()), this, SLOT(addQuestion()));
  connect(m_ui->m_btnQuestionRemove, SIGNAL(clicked()), this, SLOT(removeQuestion()));
  connect(m_ui->m_listQuestions, SIGNAL(currentRowChanged(int)), this, SLOT(loadQuestion(int)));
  connect(m_ui->m_btnQuestionUp, SIGNAL(clicked()), this, SLOT(moveQuestionUp()));
  connect(m_ui->m_btnQuestionDown, SIGNAL(clicked()), this, SLOT(moveQuestionDown()));

  setEditorsEnabled(false);
  updateQuestionCount();

  qRegisterMetaType<FlashCardQuestion>("FlashCardQuestion");

  checkAuthor();
  checkName();
  loadQuestion(-1);
}
Example #10
0
void NodeBackDrop::initialize(const QString& name,bool requestedByLoad,QVBoxLayout *dockContainer)
{
    
    _imp->menu = new QMenu(_imp->graph);
    
    QString tooltip("The node backdrop is useful to group nodes and identify them in the node graph. You can also "
                    "move all the nodes inside the backdrop.");
    _imp->settingsPanel = new DockablePanel(_imp->graph->getGui(), //< pointer to the gui
                                            this, //< pointer to the knob holder (this)
                                            dockContainer, //< pointer to the layout that will contain this settings panel
                                            DockablePanel::FULLY_FEATURED, //< use a fully featured header with editable text
                                            false, //< don't use scroll areas for tabs
                                            name, //< initial name
                                            Qt::convertFromPlainText(tooltip,Qt::WhiteSpaceNormal), //< help tooltip
                                            false, //< no default page
                                            "BackDrop", //< default page name
                                            dockContainer->parentWidget());
    
    
    ///initialize knobs here
    initializeKnobsPublic();
    
    QObject::connect(_imp->settingsPanel,SIGNAL(nameChanged(QString)),this,SLOT(onNameChanged(QString)));
    QObject::connect(_imp->settingsPanel,SIGNAL(colorChanged(QColor)),this,SLOT(onColorChanged(QColor)));
    dockContainer->addWidget(_imp->settingsPanel);
    
    if (!requestedByLoad) {
        _imp->graph->getGui()->putSettingsPanelFirst(_imp->settingsPanel);
        _imp->graph->getGui()->addVisibleDockablePanel(_imp->settingsPanel);
    } else {
        _imp->settingsPanel->setClosed(true);
    }
    
    
    
    setZValue(-10);
    
    _imp->header = new QGraphicsRectItem(this);
    _imp->header->setZValue(-9);
    
    _imp->name = new QGraphicsTextItem(name,this);
    _imp->name->setDefaultTextColor(QColor(0,0,0,255));
    _imp->name->setZValue(-8);
    
    _imp->label = new QGraphicsTextItem("",this);
    _imp->label->setDefaultTextColor(QColor(0,0,0,255));
    _imp->label->setZValue(-7);
    
    
    _imp->resizeHandle = new QGraphicsPolygonItem(this);
    _imp->resizeHandle->setZValue(-7);
    
    
    ///initialize knobs gui now
    _imp->settingsPanel->initializeKnobs();
    
    float r,g,b;
    appPTR->getCurrentSettings()->getDefaultBackDropColor(&r, &g, &b);
    QColor color;
    color.setRgbF(r, g, b);
    _imp->setColorInternal(color);
    
    _imp->setNameInternal(name);


    
}