Пример #1
0
void NodeInspector::setExportWorker(ExportWorker* worker)
{
    const bool had_worker = export_button->hasWorker();
    export_button->setWorker(worker);
    if (!had_worker)
        onLayoutChanged();
}
Пример #2
0
void NodeInspector::trigger(const NodeState& state)
{
    QList<const Datum*> not_present = rows.keys();

    title_row->setNameValid(state.name_valid);

    for (Datum* d : state.datums)
    {
        if (d->getName().find("__") != 0 && !rows.contains(d))
        {
            rows[d] = new InspectorRow(d, this);
            connect(rows[d], &InspectorRow::layoutChanged,
                    this, &NodeInspector::onLayoutChanged);

            // If we had pending links, construct them now
            if (link_cache.contains(d))
            {
                scene()->addItem(new Connection(outputPort(d), link_cache[d]));
                link_cache.remove(d);
            }
        }
        not_present.removeAll(d);
    }

    for (auto d : not_present)
    {
        delete rows[d];
        rows.remove(d);
    }

    title_row->getButton<InspectorScriptButton>()->setScriptValid(
            state.error_lineno == -1);
    onLayoutChanged();
}
Пример #3
0
void NodeInspector::clearExportWorker()
{
    if (export_button->hasWorker())
    {
        export_button->clearWorker();
        onLayoutChanged();
    }
}
Пример #4
0
void NodeInspector::setShowHidden(bool h)
{
    if (h != show_hidden)
    {
        show_hidden = h;
        onLayoutChanged();
        prepareGeometryChange();
    }
}
Пример #5
0
void OpenFileDlg::on_btnUp_clicked()
{
    QModelIndex oldRoot(ui->fileList->rootIndex());
    QModelIndex newRoot(model.parent(oldRoot));
    if ( newRoot.isValid() )
    {
        ui->fileList->setRootIndex( newRoot );
        ui->fileList->setCurrentIndex( oldRoot );
        onLayoutChanged();
    }
}
Пример #6
0
void OpenFileDlg::accept()
{
    QModelIndex index( ui->fileList->currentIndex() );
    if ( index.isValid() )
    {
        if ( model.isDir( index ) )
        {
            ui->fileList->setRootIndex( index );
            onLayoutChanged();
        }
        else
        {
            fileName = model.filePath( index );
            QDialog::accept();
        }
    }
}
Пример #7
0
OpenFileDlg::OpenFileDlg(QWidget* parent, CR3View* docView, const QString& path, const QString& file)
    : Dialog(parent)
    , ui(new Ui::OpenFileDlg)
{
    ui->setupUi(this);

    QFont f(ui->lblPosition->font());
    f.setPointSize(f.pointSize()/2);
    ui->lblPosition->setFont(f);

    f = ui->lblTitle->font();
    f.setBold(true);
    ui->lblTitle->setFont(f);

    iconFile = QIcon(":/icons/book.png");
    iconFolder = QIcon(":/icons/folder.png");

    model.setIconProvider(this);

    model.setNameFilterDisables(false);
    model.setRootPath("/");
    ui->fileList->setModel( &model );
    ui->fileList->setRootIndex(model.index(path));
    if ( !file.isEmpty() )
    {
        ui->fileList->setCurrentIndex(model.index(path + QDir::separator() + file));
    }

    model.setFilter( QDir::AllDirs | QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden );
    model.setNameFilters( QStringList() << "*.zip" << "*.fb2" << "*.epub" << "*.rtf" << "*.txt" << "*.html" << "*.htm" << "*.tcr" << "*.pdb" << "*.chm" << "*.mobi" << "*.doc" << "*.azw" );

    QObject::connect( ui->fileList, SIGNAL(clicked(QModelIndex)), this, SLOT(onClicked(QModelIndex)));
    QObject::connect( ui->fileList, SIGNAL(activated(QModelIndex)), this, SLOT(onClicked(QModelIndex)));
    QObject::connect( &model, SIGNAL(layoutChanged()), this, SLOT(onLayoutChanged()));

    ui->navBar->setControls(ui->fileList, ui->lblPosition,
                            QSize( docView->getOptions()->getIntDef(PROP_APP_UI_SWIPES_X_WEIGHT, 1),
                                   docView->getOptions()->getIntDef(PROP_APP_UI_SWIPES_Y_WEIGHT, 1) ) );

    ui->fileList->setEditFocus(true);

    ui->fileList->setTextElideMode(Qt::ElideRight);

    init();
}
Пример #8
0
//-----------------------------------------------------------------------------
void ctkModelTester::setModel(QAbstractItemModel *_model)
{
  CTK_D(ctkModelTester);
  if (d->Model)
    {
    // disconnect
    d->Model->disconnect(this);
    d->AboutToBeInserted.clear();
    d->AboutToBeRemoved.clear();
    d->LayoutAboutToBeChanged.clear();
    }
  if (_model)
    {
    connect(_model, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)),
            this, SLOT(onColumnsAboutToBeInserted(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)),
            this, SLOT(onColumnsAboutToBeRemoved(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            this, SLOT(onColumnsInserted(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
            this, SLOT(onColumnsRemoved(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(onDataChanged(const QModelIndex& , const QModelIndex &)));
    connect(_model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(onLayoutAboutToBeChanged()));
    connect(_model, SIGNAL(layoutChanged()), this, SLOT(onLayoutChanged()));
    connect(_model, SIGNAL(modelAboutToBeReset()), this, SLOT(onModelAboutToBeReset()));
    connect(_model, SIGNAL(modelReset()), this, SLOT(onModelReset()));
    connect(_model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
            this, SLOT(onRowsAboutToBeInserted(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
            this, SLOT(onRowsAboutToBeRemoved(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
            this, SLOT(onRowsInserted(const QModelIndex& , int, int)));
    connect(_model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
            this, SLOT(onRowsRemoved(const QModelIndex& , int, int)));
    }
  d->Model = _model;
  this->testModel();
}
Пример #9
0
void UI::Element::SetBottom(const int b)
{
	bottom = b;
	onLayoutChanged();
}
Пример #10
0
void UI::Element::SetLeft(const int l)
{
	left = l;
	onLayoutChanged();
}
Пример #11
0
void UI::Element::SetHeight(const int h)
{
	height = h;
	onLayoutChanged();
}
Пример #12
0
void UI::Element::SetWidth(const int w)
{
	width = w;
	onLayoutChanged();
}
Пример #13
0
FontBuilder::FontBuilder(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::FontBuilder),
    m_image_writer(0)
{
    ui->setupUi(this);



    m_font_config = new FontConfig(this);
    bool font_config_block = m_font_config->blockSignals(true);
    connect(m_font_config,SIGNAL(nameChanged()),this,SLOT(onFontNameChanged()));
    connect(m_font_config,SIGNAL(sizeChanged()),this,SLOT(onFontNameChanged()));

    m_font_renderer = new FontRenderer(this,m_font_config);

    connect(m_font_renderer,SIGNAL(imagesChanged()),this,SLOT(onRenderedChanged()));

    m_layout_config = new LayoutConfig(this);
    m_layout_data = new LayoutData(this);

    connect(m_layout_data,SIGNAL(layoutChanged()),this,SLOT(onLayoutChanged()));

    m_layouter = 0;
    m_layouter_factory = new LayouterFactory(this);

    bool b = ui->comboBoxLayouter->blockSignals(true);
    ui->comboBoxLayouter->clear();
    ui->comboBoxLayouter->addItems(m_layouter_factory->names());

    m_output_config = new OutputConfig(this);

    QSettings settings("FontBuilder.ini", QSettings::IniFormat);
    QStringList loadList = settings.childGroups();
    loadList.removeOne("default");
    m_model = new QStringListModel(this);
    m_model->setStringList(loadList);

    ui->listView->setModel(m_model);
    ui->listView->setEditTriggers(QAbstractItemView::NoEditTriggers);

    settings.beginGroup("default");
    restoreGeometry(settings.value("geometry").toByteArray());
    readConfig(settings,"fontconfig",m_font_config);
    m_font_config->normalize();
    readConfig(settings,"layoutconfig",m_layout_config);
    readConfig(settings,"outputconfig",m_output_config);
    ui->checkBoxDrawGrid->setChecked(settings.value("draw_grid").toBool());
    settings.endGroup();

    ui->widgetFontPreview->setDrawGrid(ui->checkBoxDrawGrid->isChecked());
    connect(ui->checkBoxDrawGrid,SIGNAL(toggled(bool)),this,SLOT(on_checkBoxDrawGrid_toggled(bool)));

    ui->frameCharacters->setConfig(m_font_config);
    ui->frameFontOptions->setConfig(m_font_config);
    if (!m_layout_config->layouter().isEmpty()) {
        for (int i=0;i<ui->comboBoxLayouter->count();i++)
            if (ui->comboBoxLayouter->itemText(i)==m_layout_config->layouter())
                ui->comboBoxLayouter->setCurrentIndex(i);
    }
    ui->frameLayoutConfig->setConfig(m_layout_config);


    m_exporter_factory = new ExporterFactory(this);
    ui->frameOutput->setExporters(m_exporter_factory->names());

    m_image_writer_factory = new ImageWriterFactory(this);
    ui->frameOutput->setImageWriters(m_image_writer_factory->names());
    ui->frameOutput->setChnlTypes(
                QStringList() <<"Alpha" << "RGB");

    ui->comboBoxLayouter->blockSignals(b);
    this->on_comboBoxLayouter_currentIndexChanged(
            ui->comboBoxLayouter->currentText());

    ui->frameOutput->setConfig(m_output_config);
    m_font_renderer->renderAs(m_output_config->chnlType(), false);
    ui->frameFontSelect->setConfig(m_font_config, true);

    ui->fontTestFrame->setLayoutData(m_layout_data);
    ui->fontTestFrame->setRendererData(&m_font_renderer->data());
    ui->fontTestFrame->setFontConfig(m_font_config);

    ui->widgetFontPreview->setLayoutData(m_layout_data);
    ui->widgetFontPreview->setRendererData(&m_font_renderer->data());
    ui->widgetFontPreview->setLayoutConfig(m_layout_config);

    m_font_config->blockSignals(font_config_block);
    m_font_config->emmitChange();

    connect(m_font_config,SIGNAL(spacingChanged()),this,SLOT(onSpacingChanged()));
    ui->fontTestFrame->refresh();

    m_font_loader = new FontLoader(this);
}