Ejemplo n.º 1
0
void MainWindow::saveConfig() {
    QString fileName =
            QFileDialog::getSaveFileName(this,
                                         tr("Save File"),
                                         QDir::currentPath(),
                                         tr("All files (*.xml)"));
    if (fileName.isEmpty()) {
        return;
    }

    QFile file(fileName);
    if (!file.open(QFile::WriteOnly | QFile::Text)) {
        QMessageBox::warning(this, tr("Circle"),
                             tr("Cannot write file %1:\n%2.")
                             .arg(fileName)
                             .arg(file.errorString()));
        return;
    }

    QDomDocument doc;
    doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"")) ;

    QDomElement properties = doc.createElement("properties");

    properties.appendChild(newOption(doc,
                                     "option",
                                     "posX",
                                     "int",
                                     QString::number(ui->horizontalSlider->minimum()),
                                     QString::number(ui->horizontalSlider->maximum()),
                                     QString::number(ui->horizontalSlider->value()),
                                     "X position of circle's center"));

    properties.appendChild(newOption(doc,
                                     "option",
                                     "posY",
                                     "int",
                                     QString::number(ui->horizontalSlider_2->minimum()),
                                     QString::number(ui->horizontalSlider_2->maximum()),
                                     QString::number(ui->horizontalSlider_2->value()),
                                     "Y position of circle's center"));

    properties.appendChild(newOption(doc,
                                     "option",
                                     "R",
                                     "int",
                                     QString::number(ui->horizontalSlider_3->minimum()),
                                     QString::number(ui->horizontalSlider_3->maximum()),
                                     QString::number(ui->horizontalSlider_3->value()),
                                     QString("Radius of circle's center")));

    doc.appendChild(properties);

    QTextStream out(&file);
    out << doc.toString();
    file.close();
}
Ejemplo n.º 2
0
void QtCellItemDelegate::paint(QPainter *painter,
        const QStyleOptionViewItem &option, const QModelIndex &index) const
{
#if 1
    //painter->save();
    QStyleOptionViewItem newOption(option);
    QRect rect = newOption.rect;
    int count = index.model()->columnCount();
    int column = index.column();
    int left = rect.left();
    int right = rect.right();
    int top = rect.top();
    int width = rect.width();
    int height = rect.height();

    if (column == 0) rect = QRect(left + 15, top, width, height);
    if (column == count - 1) rect = QRect(left, top, width - 15, height);
    newOption.rect = rect;
    QStyledItemDelegate::paint( painter, newOption, index );

    if (option.state & QStyle::State_Selected) {
        QColor color(SC_MAIN_COLOR_BLUE);
        if (column == 0) painter->fillRect(0, top, 15, 40, color);
        if (column == (count - 1)) painter->fillRect(right - 15, top, 16, 40, color);
    }
    //painter->restore();
#endif
}
Ejemplo n.º 3
0
void ActivityDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
  QStyleOptionViewItem newOption(option);

  /* Remove focus border */
  if (newOption.state & QStyle::State_HasFocus) {
    newOption.state ^= QStyle::State_HasFocus;
  }

  QStyledItemDelegate::paint(painter, newOption, index);
}
void KexiProjectItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
                                    const QModelIndex &index) const
{
    const KexiProjectModel* model = qobject_cast<const KexiProjectModel*>(index.model());
    QPersistentModelIndex highlighted = model->itemWithSearchHighlight();
    QStyleOptionViewItem newOption(option);
    if (highlighted.isValid() && highlighted == index) {
        newOption.state |= QStyle::State_MouseOver;
    }
    QStyledItemDelegate::paint(painter, newOption, index);
}
Ejemplo n.º 5
0
    virtual void drawComplexControl( ComplexControl control, const QStyleOptionComplex * option,
        QPainter * painter, const QWidget * widget = 0 ) const
    {
        if (control == CC_ToolButton && qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
            QStyleOptionToolButton newOption(*qstyleoption_cast<const QStyleOptionToolButton *>(option));
            newOption.features &= ~QStyleOptionToolButton::HasMenu;

            StyleProxy::drawComplexControl(control, &newOption, painter, widget);
            return;
        }
        StyleProxy::drawComplexControl(control, option, painter, widget);
    }
Ejemplo n.º 6
0
 virtual void drawControl(ControlElement ce,
                          const QStyleOption * option, QPainter * painter,
                          const QWidget * widget = 0) const
 {
     if (ce == CE_Header/*CE_HeaderSection*/ && option) {
         QStyleOptionHeader newOption(*qstyleoption_cast<const QStyleOptionHeader*>(option));
         newOption.palette.setColor(QPalette::Button, m_backgroundColor);
         //set background color as well (e.g. for thinkeramik)
         newOption.palette.setColor(QPalette::Window, m_backgroundColor);
         StyleProxy::drawControl(ce, &newOption, painter, widget);
         return;
     }
     StyleProxy::drawControl(ce, option, painter, widget);
 }
Ejemplo n.º 7
0
void Options::Set(Option option)
{
	for (unsigned int i= 0; i < m_options.size(); i++)
	{		
		if (m_options[i].GetOptionId() == option.GetOptionId())
		{
			Option newOption(option.GetOptionId(), option.GetValue());
			m_options[i] = option;
			return;
		}
	}

	m_options.push_back(option);
}
Ejemplo n.º 8
0
 virtual void drawControl(ControlElement ce,
                          const QStyleOption * option, QPainter * painter, const QWidget * widget = 0) const
 //drawPrimitive
 //PrimitiveElement pe,
 //QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default,
 //const QStyleOption& option = QStyleOption::Default ) const
 {
     if (ce == CE_Header/*CE_HeaderSection*/ && option) {
         QStyleOptionHeader newOption(*qstyleoption_cast<const QStyleOptionHeader*>(option));
         newOption.palette.setColor(QPalette::Button, m_backgroundColor);
         //set background color as well (e.g. for thinkeramik)
         newOption.palette.setColor(QPalette::Window, m_backgroundColor);
         StyleProxy::drawControl(ce, &newOption, painter, widget);
         return;
     }
     StyleProxy::drawControl(ce, option, painter, widget);
 }
Ejemplo n.º 9
0
//-----------------------------------------------------------------------------------------
void ExtendedItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    painter->save();    

    QStyleOptionViewItemV4 newOption(option);
    QString iconPath = index.data(Qt::UserRole).toString();
    if(!iconPath.isEmpty())
    {
        QIcon icon(iconPath);
        painter->drawPixmap(option.rect.topLeft(), icon.pixmap(16, 16));
        newOption.rect.setX(option.rect.x() + 15);
    }
    
    QStyledItemDelegate::paint(painter, newOption, index);

    painter->restore();
}
Ejemplo n.º 10
0
Config::Config()
{
	//
	// Renderer
	//

	newOption("sm.enabled", true);
	newOption("sm.poissonEnabled", true);
	newOption("sm.bilinearEnabled", true);
	newOption("sm.resolution", 512);
	newOption("sm.maxLights", 4);

	newOption("is.maxPointLights", 384);
	newOption("is.maxSpotLights", 16);
	newOption("is.maxSpotTexLights", 8);
	newOption("is.maxLightsPerCluster", 8);

	newOption("lf.maxSpritesPerFlare", 8);
	newOption("lf.maxFlares", 16);

	newOption("bloom.enabled", true);
	newOption("bloom.renderingQuality", 0.5);
	newOption("bloom.blurringDist", 1.0);
	newOption("bloom.samples", 5);
	newOption("bloom.blurringIterationsCount", 1);
	newOption("bloom.threshold", 1.0);
	newOption("bloom.scale", 2.0);

	newOption("ssao.enabled", true);
	newOption("ssao.renderingQuality", 0.3);
	newOption("ssao.blurringIterationsCount", 1);

	newOption("sslf.enabled", true);

	newOption("pps.enabled", true);
	newOption("pps.sharpen", false);
	newOption("pps.gammaCorrection", true);

	newOption("ir.enabled", true);
	newOption("ir.rendererSize", 128);
	newOption("ir.cubemapTextureArraySize", 32);
	newOption("sslr.enabled", true);
	newOption("sslr.startRoughnes", 0.2);

	newOption("dbg.enabled", false);
	newOption("tm.enabled", true);

	// Globals
	newOption("width", 1280);
	newOption("height", 768);
	newOption("renderingQuality", 1.0); // Applies only to MainRenderer
	newOption("lodDistance", 10.0); // Distance that used to calculate the LOD
	newOption("samples", 1);
	newOption("tessellation", true);
	newOption("clusterSizeZ", 32);
	newOption("imageReflectionMaxDistance", 30.0);

	//
	// GR
	//
	newOption("gr.uniformPerFrameMemorySize", 1024 * 1024 * 16);
	newOption("gr.storagePerFrameMemorySize", 1024 * 1024 * 16);
	newOption("gr.vertexPerFrameMemorySize", 1024 * 1024 * 10);
	newOption("gr.transferPerFrameMemorySize", 1024 * 1024 * 128);
	newOption("gr.transferPersistentMemorySize", (4096 / 4) * (4096 / 4) * 16 * 4);

	//
	// Resource
	//
	newOption("maxTextureSize", 1024 * 1024);
	newOption("textureAnisotropy", 8);
	newOption("dataPaths", ".");

	//
	// Window
	//
	newOption("glmajor", 4);
	newOption("glminor", 5);
	newOption("fullscreenDesktopResolution", false);
	newOption("debugContext", false);
	newOption("vsync", false);
}
Ejemplo n.º 11
0
// Hauptklasse von dem Feld... NAME Šndern
MainWindow::MainWindow()
{

	widget = new QWidget; //heir erstelle ich das Main Widget, in dem alles passiert
	setCentralWidget(widget);

/* ######################### ERSTELLUNG - CREATE ########################*/

	createActions();		// Actions erstellen
	createMenus();			// MenŸs erstellen
	
	//readSettings();			// die gespeicherten Einstellungen laden
	setWindowIcon(QIcon(":/images/icon.png"));
	IDcount = 1;  //die erste ID beginnt mit 1, dachte ich mir ;)
	
	
	
	
/* ##### Struktur erstellen */
	str_title = new QLabel(tr("Dialogstruktur")); //Titel des Strukturbaumes erstellen	

	str_structur = new QTreeWidget;	 //Strukturbaum erstellen
	str_structur -> setFixedWidth(250);
	str_structur -> setColumnCount(3);
	str_headerlabels << tr("Type") << tr("ID") << tr("Name");  //hier wird eine QStringlist erstellt, die alle Listenueberschriften erhaellt
	str_structur->setHeaderLabels(str_headerlabels);
	
	str_structur->header()->setResizeMode(0, QHeaderView::ResizeToContents);
	str_structur->header()->setResizeMode(1, QHeaderView::ResizeToContents);
	str_structur->header()->setResizeMode(2, QHeaderView::Stretch);
	//str_structur -> setHeaderLabels(str_headerlabels);
	
	str_addO = new QToolButton;
		str_addO->setText(tr("neue Option"));
	str_addR = new QToolButton;
		str_addR->setText(tr("neue Antwort"));

	str_rem = new QToolButton;
		str_rem->setText("-");
		str_rem->setFixedWidth(25);
	


/* ##### Bereich rechts erstellen: entweder helper oder editor */
modeWidget = new QStackedWidget;
	modeWidget->addWidget(new startMode);
	modeWidget->addWidget(new optionMode);
	modeWidget->addWidget(new responseMode);
	
	
//connections eingeben
	connect(str_structur, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(changePage(QTreeWidgetItem*, int))); 
	connect(str_addO, SIGNAL(clicked()), this, SLOT(newOption())); 
	connect(str_addR, SIGNAL(clicked()), this, SLOT(newResponse())); 
	connect(str_rem, SIGNAL(clicked()), this, SLOT(remItem())); 

	
//Layout bestimmen

	
	QHBoxLayout *str_buttons = new QHBoxLayout;
		str_buttons->addWidget(str_addO);
		str_buttons->addWidget(str_addR);
		str_buttons->addWidget(str_rem);
	
	QVBoxLayout *structLayout = new QVBoxLayout; //Strukturlayout -> links
		structLayout -> addWidget(str_title);
		structLayout -> addWidget(str_structur);
		structLayout->addLayout(str_buttons);
	

	QHBoxLayout *mainLayout = new QHBoxLayout; //hauptlayout
		mainLayout ->addLayout(structLayout);
		mainLayout ->addWidget(modeWidget, 0);
		widget->setLayout(mainLayout); //das Layout "installieren"
		
	setWindowTitle(tr("RL Dialog Editor"));
}
Ejemplo n.º 12
0
Config::Config()
{
	// Renderer
	newOption("r.renderingQuality", 1.0, "Rendering quality factor");
	newOption("r.lodDistance0", 20.0, "Distance that will be used to calculate the LOD 0");
	newOption("r.lodDistance1", 40.0, "Distance that will be used to calculate the LOD 1");
	newOption("r.clusterSizeX", 32);
	newOption("r.clusterSizeY", 26);
	newOption("r.clusterSizeZ", 32);
	newOption("r.avgObjectsPerCluster", 16);
	newOption("r.textureAnisotropy", 8);

	newOption("r.volumetricLightingAccumulation.clusterFractionXY", 4);
	newOption("r.volumetricLightingAccumulation.clusterFractionZ", 4);
	newOption("r.volumetricLightingAccumulation.finalClusterInZ", 26);

	newOption("r.shadowMapping.enabled", true);
	newOption("r.shadowMapping.tileResolution", 128);
	newOption("r.shadowMapping.tileCountPerRowOrColumn", 16);
	newOption("r.shadowMapping.scratchTileCountX", 4 * (MAX_SHADOW_CASCADES + 2));
	newOption("r.shadowMapping.scratchTileCountY", 4);
	newOption("r.shadowMapping.lightLodDistance0", 10.0);
	newOption("r.shadowMapping.lightLodDistance1", 20.0);

	newOption("r.lensFlare.maxSpritesPerFlare", 8);
	newOption("r.lensFlare.maxFlares", 16);

	newOption("r.bloom.threshold", 2.5);
	newOption("r.bloom.scale", 2.5);

	newOption("r.indirect.reflectionResolution", 128);
	newOption("r.indirect.maxSimultaneousProbeCount", 32);
	newOption("r.indirect.shadowMapResolution", 64);

	newOption("r.motionBlur.maxSamples", 32);

	newOption("r.ssr.maxSteps", 64);
	newOption("r.ssr.historyBlendFactor", 0.3);

	newOption("r.dbg.enabled", false);

	newOption("r.final.motionBlurSamples", 32);

	// Scene
	newOption("scene.earlyZDistance", 10.0, "Objects with distance lower than that will be used in early Z");
	newOption("scene.reflectionProbeEffectiveDistance", 256.0, "How far reflection probes can look");
	newOption("scene.reflectionProbeShadowEffectiveDistance", 32.0, "How far to render shadows for reflection probes");

	// Globals
	newOption("width", 1280);
	newOption("height", 768);

	// Resource
	newOption("rsrc.maxTextureSize", 1024 * 1024);
	newOption("rsrc.dataPaths", ".", "The engine loads assets only in from these paths. Separate them with :");
	newOption("rsrc.transferScratchMemorySize", 256_MB);

	// Window
	newOption("window.fullscreen", false);
	newOption("window.debugContext", false);
	newOption("window.vsync", false);
	newOption("window.debugMarkers", false);

	// GR
	newOption("gr.diskShaderCacheMaxSize", 10_MB);
	newOption("gr.vkminor", 1);
	newOption("gr.vkmajor", 1);
	newOption("gr.glmajor", 4);
	newOption("gr.glminor", 5);

	// Core
	newOption("core.uniformPerFrameMemorySize", 16_MB);
	newOption("core.storagePerFrameMemorySize", 16_MB);
	newOption("core.vertexPerFrameMemorySize", 10_MB);
	newOption("core.textureBufferPerFrameMemorySize", 1_MB);
	newOption("core.mainThreadCount", max(2u, getCpuCoresCount() / 2u - 1u));
	newOption("core.displayStats", false);
	newOption("core.clearCaches", false);
}