DockWidget3DSettings::DockWidget3DSettings(QWidget *parent, GLWidget* ptr_gl) : QDockWidget(parent),ptr_glWidget(ptr_gl), ui(new Ui::DockWidget3DSettings) { ui->setupUi(this); close(); setContentsMargins(0,0,0,0); // Connect all the sliders and other widgets connect(ui->horizontalSliderDepthScale ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVScale ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVXOffset ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVYOffset ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderSpecularI ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderDiffuseI ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderLightPower ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderLightRadius ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->comboBoxPerformanceNoRays ,SIGNAL(activated(int)),this,SLOT(updateSettings(int))); connect(ui->comboBoxPerformanceNoTessSub ,SIGNAL(activated(int)),this,SLOT(updateSettings(int))); connect(ui->checkBoxPerformanceCullFace ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxPerformanceSimplePBR ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxBloomEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxDOFEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxLensFlaresEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxShowTriangleEdges ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->comboBoxShadingModel ,SIGNAL(activated(int)), this,SLOT(selectShadingModel(int))); connect(ui->comboBoxShadingType ,SIGNAL(activated(int)), this,SLOT(updateSettings(int))); // loading 3d mesh signal and eviromental maps connect(ui->pushButtonLoadMesh ,SIGNAL(released()), ptr_glWidget,SLOT(loadMeshFromFile())); connect(ui->comboBoxChooseOBJModel ,SIGNAL(activated(QString)),ptr_glWidget,SLOT(chooseMeshFile(QString))); connect(ui->comboBoxSkyBox ,SIGNAL(activated(QString)),ptr_glWidget,SLOT(chooseSkyBox(QString))); // send current settings to glWidget connect(this,SIGNAL(signalSettingsChanged(Display3DSettings)),ptr_glWidget,SLOT(updatePerformanceSettings(Display3DSettings))); // ------------------------------------------------------- // // Loading cub maps folders // ------------------------------------------------------- // qDebug() << "Loading cubemaps folders:"; QDir currentDir(_find_data_dir(QString(RESOURCE_BASE) + "Core/2D/skyboxes")); currentDir.setFilter(QDir::Dirs); QStringList entries = currentDir.entryList(); qDebug() << "Looking for enviromental maps in Core/2D/skyboxes:"; for( QStringList::ConstIterator entry=entries.begin(); entry!=entries.end(); ++entry ){ QString dirname=*entry; if(dirname != tr(".") && dirname != tr("..")){ qDebug() << "Enviromental map:" << dirname; ui->comboBoxSkyBox->addItem(dirname); } }// end of for // setting cube map for glWidget ptr_glWidget->chooseSkyBox(ui->comboBoxSkyBox->currentText(),true); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qDebug() << "Application dir:" << QApplication::applicationDirPath(); qDebug() << "Data dir:" << _find_data_dir(""); // Chossing proper GUI style from config.ini file. QSettings settings("config.ini", QSettings::IniFormat); // Dude, this default style is really amazing... // Seriously? // No... QString guiStyle = settings.value("gui_style","DefaultAwesomeStyle").toString(); app.setStyle(QStyleFactory::create( guiStyle )); // Customize some elements: app.setStyleSheet("QGroupBox { font-weight: bold; } "); QFont font; font.setFamily(font.defaultFamily()); font.setPixelSize(10); app.setFont(font); // removing old log file QFile::remove(AB_LOG); QGLFormat glFormat(QGL::SampleBuffers); #ifdef Q_OS_MAC glFormat.setProfile( QGLFormat::CoreProfile ); glFormat.setVersion( 4, 1 ); #endif #ifdef USE_OPENGL_330 #ifdef Q_OS_LINUX glFormat.setProfile( QGLFormat::CoreProfile ); glFormat.setVersion( 3, 3 ); #endif #endif QGLFormat::setDefaultFormat(glFormat); qInstallMessageHandler(customMessageHandler); qDebug() << "Starting application:"; if(!checkOpenGL()){ AllAboutDialog msgBox; msgBox.setPixmap(":/resources/icon-off.png"); msgBox.setText("Fatal Error!"); #ifdef USE_OPENGL_330 msgBox.setInformativeText("Sorry but it seems that your graphics card does not support openGL 3.3.\n" "Program will not run :(\n" "See " AB_LOG " file for more info."); #else msgBox.setInformativeText("Sorry but it seems that your graphics card does not support openGL 4.0.\n" "Program will not run :(\n" "See " AB_LOG " file for more info."); #endif msgBox.show(); return app.exec(); }else{ MainWindow window; window.setWindowTitle(AWESOME_BUMP_VERSION); window.resize(window.sizeHint()); int desktopArea = QApplication::desktop()->width() * QApplication::desktop()->height(); int widgetArea = window.width() * window.height(); if (((float)widgetArea / (float)desktopArea) < 0.75f) window.show(); else window.showMaximized(); return app.exec(); } }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qDebug() << "Application dir:" << QApplication::applicationDirPath(); qDebug() << "Data dir:" << _find_data_dir(""); // Chossing proper GUI style from config.ini file. QSettings settings("config.ini", QSettings::IniFormat); // Dude, this default style is really amazing... // Seriously? // No... QString guiStyle = settings.value("gui_style","DefaultAwesomeStyle").toString(); app.setStyle(QStyleFactory::create( guiStyle )); // Customize some elements: app.setStyleSheet("QGroupBox { font-weight: bold; } "); QFont font; font.setFamily(font.defaultFamily()); font.setPixelSize(10); app.setFont(font); // removing old log file QFile::remove(AB_LOG); QGLFormat glFormat(QGL::SampleBuffers); #if defined(Q_OS_LINUX) || defined(Q_OS_MAC) /* * Commenting out the next line because it causes rendering to fail. QGLFormat::CoreProfile * disables all OpenGL functions that are depreciated as of OpenGL 3.0. This fix is a workaround. * The full solution is to replace all depreciated OpenGL functions with their current implements. */ # if defined(Q_OS_MAC) glFormat.setProfile( QGLFormat::CoreProfile ); # endif glFormat.setVersion( GL_MAJOR, GL_MINOR ); #endif QGLFormat::setDefaultFormat(glFormat); qInstallMessageHandler(customMessageHandler); qDebug() << "Starting application:"; if(!checkOpenGL()){ AllAboutDialog msgBox; msgBox.setPixmap(":/resources/icon-off.png"); msgBox.setText("Fatal Error!"); msgBox.setInformativeText(QString("Sorry but it seems that your graphics card does not support openGL %1.%2.\n" "Program will not run :(\n" "See " AB_LOG " file for more info.").arg(GL_MAJOR).arg(GL_MINOR)); msgBox.show(); return app.exec(); }else{ MainWindow window; window.setWindowTitle(AWESOME_BUMP_VERSION); window.resize(window.sizeHint()); int desktopArea = QApplication::desktop()->width() * QApplication::desktop()->height(); int widgetArea = window.width() * window.height(); if (((float)widgetArea / (float)desktopArea) < 0.75f) window.show(); else window.showMaximized(); return app.exec(); } }