Пример #1
0
int TPalette::Page::addStyle(TColorStyle *style) {
  assert(m_palette);
  int stylesCount = int(m_palette->m_styles.size());
  int styleId;
  for (styleId = 0; styleId < stylesCount; styleId++)
    if (m_palette->m_styles[styleId].first == 0) break;
  if (styleId >= stylesCount - 1) return addStyle(m_palette->addStyle(style));
  m_palette->setStyle(styleId, style);
  return addStyle(styleId);
}
Пример #2
0
/*!
  \internal
  Opens directory as a style.
*/
void MainWindow::openStyle()
{
    const QString path = QFileDialog::getExistingDirectory(this);
    if (path.isEmpty())
        return;
    addStyle(Style(path));
}
Пример #3
0
void ListView::allowMultiSelection(bool allow)
{
  if (allow) {
    removeStyle(LVS_SINGLESEL);
  } else {
    addStyle(LVS_SINGLESEL);
  }
}
ParagraphBulletsNumbers::ParagraphBulletsNumbers(QWidget *parent)
        : QWidget(parent),
        m_alignmentMode(false),
        m_imageCollection(0),
        m_data(0),
        m_fontSize(0)
{
    widget.setupUi(this);

    foreach(const Lists::ListStyleItem & item, Lists::genericListStyleItems())
        addStyle(item);
    addStyle(Lists::ListStyleItem(i18n("Custom Bullet"), KoListStyle::CustomCharItem));
    m_blankCharIndex = addStyle(Lists::ListStyleItem(i18n("No Bullet"), KoListStyle::CustomCharItem));
    foreach(const Lists::ListStyleItem & item, Lists::otherListStyleItems())
        addStyle(item);

    widget.alignment->addItem(i18nc("Automatic horizontal alignment", "Auto"));
    widget.alignment->addItem(i18nc("Text alignment", "Left"));
    widget.alignment->addItem(i18nc("Text alignment", "Right"));
    widget.alignment->addItem(i18nc("Text alignment", "Centered"));

    widget.labelFollowedBy->addItem(i18nc("Tab follows the bullet or number", "Tab Stop"));
    widget.labelFollowedBy->addItem(i18nc("Space", "Space"));
    widget.labelFollowedBy->addItem(i18nc("None", "Nothing"));

    widget.doubleSpinBox->setSingleStep(0.05);
    widget.doubleSpinBox_2->setSingleStep(0.05);
    widget.doubleSpinBox_3->setSingleStep(0.05);

    connect(widget.labelFollowedBy,SIGNAL(currentIndexChanged(int)),this,SLOT(labelFollowedByIndexChanged(int)));
    connect(widget.listTypes, SIGNAL(currentRowChanged(int)), this, SLOT(styleChanged(int)));
    connect(widget.customCharacter, SIGNAL(clicked(bool)), this, SLOT(customCharButtonPressed()));
    connect(widget.letterSynchronization, SIGNAL(toggled(bool)), widget.startValue, SLOT(setLetterSynchronization(bool)));
    connect(widget.prefix, SIGNAL(textChanged(const QString&)), this, SLOT(recalcPreview()));
    connect(widget.suffix, SIGNAL(textChanged(const QString&)), this, SLOT(recalcPreview()));
    connect(widget.depth, SIGNAL(valueChanged(int)), this, SLOT(recalcPreview()));
    connect(widget.levels, SIGNAL(valueChanged(int)), this, SLOT(recalcPreview()));
    connect(widget.startValue, SIGNAL(valueChanged(int)), this, SLOT(recalcPreview()));
    connect(widget.insertImage, SIGNAL(clicked()), this, SLOT(selectListImage()));
    connect(widget.imageHeight, SIGNAL(valueChanged(double)), this, SLOT(recalcPreview()));
    connect(widget.imageWidth, SIGNAL(valueChanged(double)), this, SLOT(recalcPreview()));
    connect(widget.restartNumbering, SIGNAL(clicked()), this, SLOT(recalcPreview()));
}
Пример #5
0
/*!
  \internal
  Looks for styles built in Qt Quick Controls.
*/
void MainWindow::findBuiltInStyles()
{
    foreach (const QString &importPath, ui->quickWidget->engine()->importPathList()) {
        QDir dir(importPath + QStringLiteral("/QtQuick/Controls/Styles"));
        if (!dir.exists())
            continue;
        foreach (const QString &styleName, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
            addStyle(Style(styleName, dir.absolutePath(), true), false);
    }
}
Пример #6
0
/*!
  \internal
  Opens a style from the recent list.
*/
void MainWindow::openRecentStyle()
{
    QAction *action = qobject_cast<QAction *>(sender());

    if (!action)
        return;

    const QFileInfo fi(action->text());
    if (!fi.exists())
        return;

    addStyle(Style(fi.fileName(), fi.absolutePath()));
}
Пример #7
0
Static line_type doCommand(Char *line_)
{
  line_type Result;
  Char line[256];
  Char command[256];
  command_type last_command;
  boolean starts_with_note;
  Char STR1[256], STR3[256];

  strcpy(line, line_);
  if (line[0] == comment && !isAssertion(line))
    return comment_line;
  starts_with_note = maybeMusicLine(line);
  GetNextWord(command, line, blank_, colon_);
  sprintf(STR1, "%c", colon_);
  if (endsWith(command, STR1)) {
    last_command = findCommand(command);
    Result = command_line;
    if (last_command == enable)
      doEnable(line, true);
    else if (last_command == disable)
      doEnable(line, false);
    else if (last_command == range)
      orig_range_line = line_no;
    if (last_command != none) {
      if (mustAppend(last_command) && redefined[(long)last_command])
	sprintf(cline[(long)last_command] + strlen(cline[(long)last_command]),
		"\n%s", line);
      else {
	strcpy(cline[(long)last_command], line);
	if (warn_redefine && redefined[(long)last_command]) {
	  sprintf(STR3, "You have redefined preamble command %s", command);
	  warning(STR3, print);
	}
      }
      if (last_command == start)
	strcpy(start_line, line);
      redefined[(long)last_command] = true;
      return Result;
    }
    Result = colon_line;
    sprintf(STR3, "%s%c %s", command, colon_, line);
    addStyle(STR3);
    orig_style_line[known_styles-1] = line_no;
    return Result;
  } else if (starts_with_note)
    return plain_line;
  else
    return unknown;
  return Result;
}
Пример #8
0
void Debug::log(std::string msg, int type) {
    if(!m_enabled) {
        return;
    }

    switch(type) {
    case Debug::e_info:
        msg = "INFO: " + msg;
        break;
    case Debug::e_success:
        msg = "SUCCESS: " + msg;
        if(isSet(Debug::color)) {
            msg = addStyle(msg, "32", false);
        }
        break;
    case Debug::e_warning:
        msg = "* WARNING *: " + msg;
        if(isSet(Debug::color)) {
            msg = addStyle(msg, "33", true);
        }
        break;
    case Debug::e_error:
        msg = "*** ERROR ***: " + msg;
        if(isSet(Debug::color)) {
            msg = addStyle(msg, "31", true);
        }
        break;
    }

    if(isSet(Debug::timestamp)) {
        msg = formatTime("%02d:%02d.%02d: ") + msg;
    }

    // Output to console
    std::cout << msg << std::endl;
}
QgsMapLayerStyleManagerWidget::QgsMapLayerStyleManagerWidget( QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent )
    : QgsMapStylePanel( layer, canvas, parent )
{
  mModel = new QStandardItemModel( this );
  mStyleList = new QListView( this );
  mStyleList->setModel( mModel );
  mStyleList->setViewMode( QListView::ListMode );
  mStyleList->setResizeMode( QListView::Adjust );

  QToolBar* toolbar = new QToolBar( this );
  QAction* addAction = toolbar->addAction( tr( "Add" ) );
  connect( addAction, SIGNAL( triggered() ), this, SLOT( addStyle() ) );
  QAction* removeAction = toolbar->addAction( tr( "Remove Current" ) );
  connect( removeAction, SIGNAL( triggered() ), this, SLOT( removeStyle() ) );

  connect( canvas, SIGNAL( mapCanvasRefreshed() ), this, SLOT( updateCurrent() ) );

  connect( mStyleList, SIGNAL( clicked( QModelIndex ) ), this, SLOT( styleClicked( QModelIndex ) ) );

  setLayout( new QVBoxLayout() );
  layout()->setContentsMargins( 0, 0, 0, 0 );
  layout()->addWidget( toolbar );
  layout()->addWidget( mStyleList );

  connect( mLayer->styleManager(), SIGNAL( currentStyleChanged( QString ) ), this, SLOT( currentStyleChanged( QString ) ) );
  connect( mLayer->styleManager(), SIGNAL( styleAdded( QString ) ), this, SLOT( styleAdded( QString ) ) );
  connect( mLayer->styleManager(), SIGNAL( styleremoved( QString ) ), this, SLOT( styleRemoved( QString ) ) );
  connect( mLayer->styleManager(), SIGNAL( styleRenamed( QString, QString ) ), this, SLOT( styleRenamed( QString, QString ) ) );

  mModel->clear();

  Q_FOREACH ( const QString name, mLayer->styleManager()->styles() )
  {
    QString stylename = name;

    if ( stylename.isEmpty() )
      stylename = "(default)";

    QStandardItem* item = new QStandardItem( stylename );
    mModel->appendRow( item );
  }

  QString active = mLayer->styleManager()->currentStyle();
  currentStyleChanged( active );
}
Пример #10
0
KeyDialog::KeyDialog(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f)
{
	ui = new Ui_KeyDialog();
	ui->setupUi(this);
	ui->mainLabelLineEdit->installEventFilter(this);
	ui->secondLabelLineEdit->installEventFilter(this);
	setModal(true);
	resetCurrentItems();
	connect(ui->styleChooser, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
		this, SLOT(styleChanged(QListWidgetItem*)));
	foreach(QAbstractButton* button, ui->buttonBox->buttons())
		button->setFocusPolicy(Qt::NoFocus);
	styleDialog = new StyleDialog();
	connect(ui->addStyleButton, SIGNAL(pressed()), SLOT(addStyle()));
	connect(ui->editStyleButton, SIGNAL(pressed()), SLOT(editStyle()));
	connect(ui->deleteStyleButton, SIGNAL(pressed()), SLOT(deleteStyle()));
	connect((KeyboardView*) parent, SIGNAL(zoomChanged(double)), 
			styleDialog, SLOT(changeScale(double)));
}
Пример #11
0
void MainWindow::newStyle()
{
    QStringList styleNames;
    foreach (const Style &style, m_styles)
        styleNames << style.name();

    QScopedPointer<NewStyleDialog> dialog(new NewStyleDialog(styleNames, this));
    if (dialog->exec() == QDialog::Rejected)
        return;

    const Style &baseStyle = m_styles.at(dialog->baseStyleIndex());
    const QString destination = dialog->location() + QStringLiteral("/") + dialog->name();

    /// TODO: Copy only required files?
    if (!copyRecursively(baseStyle.fullPath(), destination)) {
        QMessageBox::warning(this, tr("Error"),
                             tr("Cannot create style in the specified location."));
        return;
    }

    addStyle(Style(dialog->name(), dialog->location()));
}
Пример #12
0
Static void readStyles(void)
{
  boolean eofstyle;
  Char S[256];
  style_index0 l = 0;
  Char *TEMP;

  if (styleFileFound())
    eofstyle = true;
  else
    eofstyle = P_eof(stylefile);
  while (!eofstyle) {
    fgets(S, 256, stylefile);
    TEMP = strchr(S, '\n');
    if (TEMP != NULL)
      *TEMP = 0;
    if (*S != '\0') {
      addStyle(S);
      l++;
      orig_style_line[known_styles-1] = l;
    }
    eofstyle = P_eof(stylefile);
  }
}
Пример #13
0
int TPalette::addStyle(const TPixel32 &color) {
  return addStyle(new TSolidColorStyle(color));
}
Пример #14
0
int TPalette::Page::addStyle(TPixel32 color) {
  return addStyle(new TSolidColorStyle(color));
}