Esempio n. 1
0
TextSettingsDialog::TextSettingsDialog(QWidget *parent, const OptionsMap& settings)
: BaseSettingsDialog(parent) {

    setupUi(this);
    new HelpButton(this, buttonBox, "17467707");

    curColor = qvariant_cast<QColor>(settings[LABEL_COLOR]);

#if (QT_VERSION < 0x050000) //Qt 5
    QStyle *buttonStyle = new QPlastiqueStyle;
#else
    QStyle *buttonStyle = new QProxyStyle(QStyleFactory::create("fusion"));
#endif
    buttonStyle->setParent(colorButton);
    colorButton->setStyle(buttonStyle);

    updateColorButton();
    QFont curFont = qvariant_cast<QFont>(settings[LABEL_FONT]);
    fontComboBox->setCurrentFont(curFont);
    sizeSpinBox->setValue(curFont.pointSize());

    boldToolButton->setChecked(curFont.bold());
    italicToolButton->setChecked(curFont.italic());
    underlineToolButton->setChecked(curFont.underline());
    overlineToolButton->setChecked(curFont.overline());

    overlineToolButton->setVisible(false);

    connect(colorButton, SIGNAL(clicked()), SLOT(sl_colorButton()));
}
Esempio n. 2
0
void TextSettingsDialog::sl_colorButton() {
    curColor = QColorDialog::getColor(curColor, this);
    if (curColor.isValid()) {
        changedSettings[LABEL_COLOR] = curColor;
        updateColorButton();
    }
}
Esempio n. 3
0
void SettingsDialog::chooseColor(QPushButton* button, QColor* color) {
#if QT_VERSION >= 0x040500
  QColor newColor = QColorDialog::getColor(*color, this, tr("Select color..."),
                    QColorDialog::ShowAlphaChannel);
#else
  QColor newColor = QColorDialog::getColor(*color, this, tr("Select color..."));
#endif
  if (newColor.isValid()) {
    *color = newColor;
    updateColorButton(button, *color);
  }
}
Esempio n. 4
0
void SettingsDialog::initSettings() {
  QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                       SETTING_ORGANIZATION, SETTING_APPLICATION);
  QString fontname = settings.value("GUI/Font").toString();

  if (fontname.isEmpty()) {
    tableFont.setFamily(TABLE_FONT);
    tableFont.setPointSize(TABLE_FONT_SIZE);
  } else {
    tableFont = settings.value("GUI/Font").value<QFont>();
  }

   QString fontImageName = settings.value("GUI/ImageFont").toString();
   if (fontImageName.isEmpty()) {
     imageFont.setFamily(TABLE_FONT);
     imageFont.setPointSize(TABLE_FONT_SIZE);
   } else {
     imageFont = settings.value("GUI/ImageFont").value<QFont>();
   }

  if (settings.contains("GUI/UseTheSameFont")) {
     useSameFontCB->setChecked(settings.value("GUI/UseTheSameFont").toBool());
     fontImageButton->setDisabled(useSameFontCB->isChecked());
     fontImageLabel->setDisabled(useSameFontCB->isChecked());
     fontImageLbl->setDisabled(useSameFontCB->isChecked());
  }

  if (settings.contains("GUI/ImageFontOffset"))
    offsetSpinBox->setValue(settings.value("GUI/ImageFontOffset").toInt());

  initStyles();
  if (settings.contains("GUI/Style")) {
      int styleindex = styleComboBox->findText(
            settings.value("GUI/Style").toString());
      styleComboBox->setCurrentIndex(styleindex);
  } else {
      styleComboBox->setCurrentIndex(0);
  }

  if (settings.contains("GUI/IconTheme")) {
      int themeindex = themeComboBox->findText(
            settings.value("GUI/IconTheme").toString());
      themeComboBox->setCurrentIndex(themeindex);
  } else {
      themeComboBox->setCurrentIndex(0);
  }

  if (settings.contains("GUI/BalloonCount"))
    ballonsSpinBox->setValue(settings.value("GUI/BalloonCount").toInt());

  if (settings.contains("GUI/ImageFontColor")) {
    imageFontColor = settings.value("GUI/ImageFontColor").value<QColor>();
  } else {
    imageFontColor = Qt::red;
  }

  if (settings.contains("GUI/Rectagle")) {
    rectColor = settings.value("GUI/Rectagle").value<QColor>();
  } else {
    rectColor = Qt::red;
  }

  if (settings.contains("GUI/Rectagle_fill")) {
    rectFillColor = settings.value("GUI/Rectagle_fill").value<QColor>();
  } else {
    rectFillColor = Qt::red;
    rectFillColor.setAlpha(127);
  }

  if (settings.contains("GUI/Box")) {
    boxColor = settings.value("GUI/Box").value<QColor>();
  } else {
    boxColor = Qt::green;
  }

  if (settings.contains("GUI/BackgroundColor")) {
    backgroundColor = settings.value("GUI/BackgroundColor").value<QColor>();
  } else {
    backgroundColor = (Qt::gray);
  }

  // Text settings
  if (settings.contains("Text/OpenDialog"))
    cbOpenDialog->setChecked(settings.value("Text/OpenDialog").toBool());
  if (settings.contains("Text/WordSpace"))
    sbWordSpace->setValue(settings.value("Text/WordSpace").toInt());
  if (settings.contains("Text/ParagraphIndent"))
    spParaIndent->setValue(settings.value("Text/ParagraphIndent").toInt());
  if (settings.contains("Text/Ligatures"))
    pteLigatures->setPlainText(settings.value("Text/Ligatures").toString());

  QFont tempFont = tableFont;
  // Lets use reasonable font size ;-)
  if (tableFont.pointSize() > 12)
        tempFont.setPointSize(12);
  fontLabel->setFont(tempFont);
  fontLabel->setText(tableFont.family().toLocal8Bit() +
                     tr(", %1 pt").arg(tableFont.pointSize()));

  tempFont = imageFont;
  if (imageFont.pointSize() > 12)
        tempFont.setPointSize(12);
  fontImageLabel->setFont(tempFont);
  fontImageLabel->setText(imageFont.family().toLocal8Bit() +
                     tr(", %1 pt").arg(imageFont.pointSize()));

  updateColorButton(imageFontColorButton, imageFontColor);
  updateColorButton(colorRectButton, rectColor);
  updateColorButton(rectFillColorButton, rectFillColor);
  updateColorButton(colorBoxButton, boxColor);
  updateColorButton(backgroundColorButton, backgroundColor);

  // Tesseract datapath settings, langs should be set later
  if (settings.contains("Tesseract/DataPath")) {
    lnPrefix->setText(settings.value("Tesseract/DataPath").toString());
  }
}
Esempio n. 5
0
void SettingsDialog::initSettings() {
  QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                       SETTING_ORGANIZATION, SETTING_APPLICATION);
  QString fontname = settings.value("GUI/Font").toString();

  if (fontname.isEmpty()) {
    tableFont.setFamily(TABLE_FONT);
    tableFont.setPointSize(TABLE_FONT_SIZE);
  } else {
    tableFont = settings.value("GUI/Font").value<QFont>();
  }

  if (settings.contains("GUI/Rectagle")) {
    rectColor = settings.value("GUI/Rectagle").value<QColor>();
  } else {
    rectColor = Qt::red;
  }

  if (settings.contains("GUI/Rectagle_fill")) {
    rectFillColor = settings.value("GUI/Rectagle_fill").value<QColor>();
  } else {
    rectFillColor = Qt::red;
    rectFillColor.setAlpha(127);
  }

  if (settings.contains("GUI/Box")) {
    boxColor = settings.value("GUI/Box").value<QColor>();
  } else {
    boxColor = Qt::green;
  }

  if (settings.contains("GUI/BackgroundColor")) {
    backgroundColor = settings.value("GUI/BackgroundColor").value<QColor>();
  } else {
    backgroundColor = (Qt::gray);
  }

  // Text settings
  if (settings.contains("Text/OpenDialog"))
    cbOpenDialog->setChecked(settings.value("Text/OpenDialog").toBool());
  if (settings.contains("Text/WordSpace"))
    sbWordSpace->setValue(settings.value("Text/WordSpace").toInt());
  if (settings.contains("Text/ParagraphIndent"))
    spParaIndent->setValue(settings.value("Text/ParagraphIndent").toInt());
  if (settings.contains("Text/Ligatures"))
    pteLigatures->setPlainText(settings.value("Text/Ligatures").toString());

  fontLabel->setFont(tableFont);
  fontLabel->setText(tableFont.family().toAscii() +
                     tr(", %1 pt").arg(tableFont.pointSize()));
  updateColorButton(colorRectButton, rectColor);
  updateColorButton(rectFillColorButton, rectFillColor);
  updateColorButton(colorBoxButton, boxColor);
  updateColorButton(backgroundColorButton, backgroundColor);

  // Tesseract settings
  if (settings.contains("Tesseract/DataPath")) {
    lnPrefix->setText(settings.value("Tesseract/DataPath").toString());
  }
  if (settings.contains("Tesseract/Lang")) {
      int langindex = cbLang->findData(
            settings.value("Tesseract/Lang").toString());
      cbLang->setCurrentIndex(langindex);
  }
}