Ejemplo n.º 1
0
void DataDialog::slotEditMultiple() {
  int charWidth = fontMetrics().averageCharWidth();

  int currentWidth = width();
  int extensionWidth = extensionWidget()->width();
  if (extensionWidth<charWidth*20) extensionWidth = charWidth*25; // FIXME: magic number hack...
  extensionWidget()->setVisible(!extensionWidget()->isVisible());
  if (!extensionWidget()->isVisible()) {
    _tagString->setVisible(true);
    _shortName->setVisible(true);
    _tagStringAuto->setVisible(true);
    _nameLabel->setVisible(true);
    setMinimumWidth(currentWidth - extensionWidth);
    resize(currentWidth - extensionWidth, height());
    _mode = Edit;
    _editMultipleButton->setText(tr("Edit Multiple >>"));
    emit editSingleMode();
  } else {
    if (currentWidth<charWidth*50) currentWidth = charWidth*80; // FIXME: magic number hack...
    _tagString->setVisible(false);
    _shortName->setVisible(false);
    _tagStringAuto->setVisible(false);
    _nameLabel->setVisible(false);
    setMinimumWidth(currentWidth + extensionWidth);
    resize(currentWidth + extensionWidth, height());
    _mode = EditMultiple;
    _editMultipleButton->setText(tr("<< Edit one %1").arg(_shortName->text()));
    emit editMultipleMode();
  }
  clearModified();
}
Ejemplo n.º 2
0
Dialog::Dialog(QWidget *parent)
  : QDialog(parent), _allowApply(false) {

  setupUi(this);

  _saveAsDefault->hide();
  _applyToExisting->hide();

  extensionWidget()->hide();

  connect(_listWidget, SIGNAL(itemClicked(QListWidgetItem*)),
          this, SLOT(selectPageForItem(QListWidgetItem*)));

  connect(_buttonBox, SIGNAL(clicked(QAbstractButton*)),
          this, SLOT(buttonClicked(QAbstractButton*)));

  setAttribute(Qt::WA_DeleteOnClose);

  resize(minimumSizeHint());

  _saveAsDefault->setProperty("si","Save as default");
  _applyToExisting->setProperty("si","Apply to existing objects");
#if defined(__QNX__) || defined(__ANDROID__)
  // Mobile environments don't have window managers, and so dialogs
  // are not a native concept. We may consider adding a "Back"
  // button to dialogs on mobile platform...
  //
  // In the meantime, dialogs should be fullscreen. A dialog without
  // borders looks really bad, and getting the size right is difficult.
  setWindowState(Qt::WindowFullScreen);
#endif
}
Ejemplo n.º 3
0
void DataDialog::createGui() {

  if (_mode == New) {
    buttonBox()->button(QDialogButtonBox::Apply)->setVisible(false);
  }

  connect(this, SIGNAL(apply()), this, SLOT(slotApply()));

  QWidget *extension = extensionWidget();

  QVBoxLayout *extensionLayout = new QVBoxLayout(extension);
  extensionLayout->setContentsMargins(0, -1, 0, -1);

  _editMultipleWidget = new EditMultipleWidget();
  extensionLayout->addWidget(_editMultipleWidget);

  extension->setLayout(extensionLayout);

  QWidget *box = topCustomWidget();

  QHBoxLayout *layout = new QHBoxLayout(box);

  _nameLabel = new QLabel(tr("&Name:"), box);
  _tagString = new QLineEdit(box);
  connect(_tagString, SIGNAL(textChanged(QString)), this, SLOT(modified()));
  _nameLabel->setBuddy(_tagString);

  _shortName = new QLabel(QString(), box);

  _tagStringAuto = new QCheckBox(tr("&Auto","automatic"), box);
  connect(_tagStringAuto, SIGNAL(toggled(bool)), _tagString, SLOT(setDisabled(bool)));

  _editMultipleButton = new QPushButton(tr("Edit Multiple >>"));
  _editMultipleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  connect(_editMultipleButton, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));

  QLabel *spacer = new QLabel();

  if (_dataObject) {
    setTagString(_dataObject->descriptiveName());
    setShortName(_dataObject->shortName());
    _tagStringAuto->setChecked(!_dataObject->descriptiveNameIsManual());
  } else {
    _tagStringAuto->setChecked(true);
    setTagString(QString());
    _editMultipleButton->setVisible(false);
  }

  layout->addWidget(_nameLabel);
  layout->addWidget(_tagString);
  layout->addWidget(_shortName);
  layout->addWidget(_tagStringAuto);
  layout->addWidget(spacer);
  layout->addWidget(_editMultipleButton);

  box->setLayout(layout);

}
void ViewItemDialog::slotEditMultiple() {
  int currentWidth = width();
  int extensionWidth = extensionWidget()->width();
  if (extensionWidth<204) extensionWidth = 204; // FIXME: magic number hack...
  extensionWidget()->setVisible(!extensionWidget()->isVisible());
 _tagString->setEnabled(!extensionWidget()->isVisible());
  if (!extensionWidget()->isVisible()) {
    setMinimumWidth(currentWidth - extensionWidth);
    resize(currentWidth - extensionWidth, height());
    _mode = Single;
    emit editSingleMode();
  } else {
    setMinimumWidth(currentWidth + extensionWidth);
    resize(currentWidth + extensionWidth, height());
    _mode = Multiple;
    emit editMultipleMode();
  }
}
Ejemplo n.º 5
0
void DataDialog::createGui() {

  buttonBox()->button(QDialogButtonBox::Apply)->setVisible(false);

  connect(this, SIGNAL(ok()), this, SLOT(slotOk()));

  QWidget *extension = extensionWidget();

  QVBoxLayout *extensionLayout = new QVBoxLayout(extension);
  extensionLayout->setContentsMargins(0, -1, 0, -1);

  EditMultipleWidget *editMultipleWidget = new EditMultipleWidget();
  extensionLayout->addWidget(editMultipleWidget);

  extension->setLayout(extensionLayout);

  QWidget *box = topCustomWidget();

  QHBoxLayout *layout = new QHBoxLayout(box);
  layout->setContentsMargins(0, -1, 0, -1);

  QLabel *label = new QLabel(tr("Unique Name:"), box);
  _tagString = new QLineEdit(box);

  QPushButton *button = new QPushButton(tr("Edit Multiple >>"));
  connect(button, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));

  if (_dataObject) {
    setTagString(_dataObject->tag().tagString()); // FIXME: should this be displayString()?
  } else {
    setTagString(tagString());
    button->setVisible(false);
  }

  layout->addWidget(label);
  layout->addWidget(_tagString);
  layout->addWidget(button);

  box->setLayout(layout);
}
ViewItemDialog::ViewItemDialog(ViewItem *item, QWidget *parent)
    : Dialog(parent), _mode(Single), _item(item) {

  setWindowTitle(tr("Edit View Item"));

  // semi-hack: set the width of the list widget to 15 characters, which is enough
  // to say "X-Axis Markers" in english.  This is better than setting it to a fixed
  // number of pixels, as it scales with font size or screen resolution, but
  // it won't necessairly survive translations, or someone adding a option like
  // "Do something super important", which has more than 15 characters.
  // We have to do it here, before the layout is set, and we don't yet know how
  // what is going into the listWidget.
  _listWidget->setMinimumWidth(_listWidget->fontMetrics().averageCharWidth()*15);

  QWidget *extension = extensionWidget();

  QVBoxLayout *extensionLayout = new QVBoxLayout(extension);
  extensionLayout->setContentsMargins(0, -1, 0, -1);

  _editMultipleWidget = new EditMultipleWidget();
  extensionLayout->addWidget(_editMultipleWidget);

  extension->setLayout(extensionLayout);

  _editMultipleBox = topCustomWidget();

  QHBoxLayout *layout = new QHBoxLayout(_editMultipleBox);

  _tagStringLabel = new QLabel(tr("&Name:"), _editMultipleBox);
  _tagStringLabel->setObjectName("_tagStringLabel");
  _tagString = new QLineEdit(_editMultipleBox);
  connect(_tagString, SIGNAL(textChanged(QString)), this, SLOT(modified()));
  _tagStringLabel->setBuddy(_tagString);

  _editMultipleButton = new QPushButton(tr("Edit Multiple >>"));
  _editMultipleButton->setObjectName("_editMultipleButton");
  connect(_editMultipleButton, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));

  layout->addWidget(_tagStringLabel);
  layout->addWidget(_tagString);
  layout->addWidget(_editMultipleButton);

  _editMultipleBox->setLayout(layout);

  setSupportsMultipleEdit(false);

  if (_item->hasBrush()) {
    _fillTab = new FillTab(this);
    connect(_fillTab, SIGNAL(apply()), this, SLOT(fillChanged()));
  }
  if (_item->hasStroke()) {
    _strokeTab = new StrokeTab(this);
    connect(_strokeTab, SIGNAL(apply()), this, SLOT(strokeChanged()));
  }
  _layoutTab = new LayoutTab(this);
  connect(_layoutTab, SIGNAL(apply()), this, SLOT(layoutChanged()));

  DialogPageTab *page = new DialogPageTab(this);
  page->setPageTitle(tr("Appearance"));
  if (_item->hasBrush()) {
    page->addDialogTab(_fillTab);
  }

  if (_item->hasStroke()) {
    page->addDialogTab(_strokeTab);
  }
  page->addDialogTab(_layoutTab);
  addDialogPage(page);

  if (!_item->customDimensionsTab()) {
    _dimensionsTab = new DimensionsTab(_item, this);
    DialogPage *dimensionsPage = new DialogPage(this);
    dimensionsPage->setPageTitle(tr("Size/Position"));
    dimensionsPage->addDialogTab(_dimensionsTab);
    addDialogPage(dimensionsPage);
    connect(_dimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged()));
  } else {
    _dimensionsTab = 0;
  }

  QList<DialogPage*> dialogPages = _item->dialogPages();
  foreach (DialogPage *dialogPage, dialogPages)
    addDialogPage(dialogPage);

  setupFill();
  setupStroke();
  setupLayout();
  setupDimensions();

  selectDialogPage(page);

  if (!_item->customDimensionsTab()) {
    connect(_dimensionsTab, SIGNAL(tabModified()), this, SLOT(modified()));
  }

  connect(this, SIGNAL(editMultipleMode()), this, SLOT(setMultipleEdit()));
  connect(this, SIGNAL(editSingleMode()), this, SLOT(setSingleEdit()));
  connect(_item, SIGNAL(relativeSizeUpdated()), this, SLOT(setupDimensions()));
  connect(_saveAsDefault, SIGNAL(clicked()), this, SLOT(modified()));

  _saveAsDefault->show();

  _tagStringLabel->setProperty("si","&Name:");
  _editMultipleButton->setProperty("si","Edit Multiple >>");
}
Ejemplo n.º 7
0
void DataDialog::slotEditMultiple() {
  extensionWidget()->setVisible(!extensionWidget()->isVisible());
}