| 43 | #include <iostream> |
| 44 | |
| 45 | MainWindow::MainWindow(QWidget *parent) : |
| 46 | QMainWindow(parent), |
| 47 | ui(new Ui::MainWindow), |
| 48 | lastCalctime_normal(0), |
| 49 | lastCalctime_specular(0), |
| 50 | lastCalctime_displace(0), |
| 51 | lastCalctime_ssao(0), |
| 52 | stopQueue(false) |
| 53 | { |
| 54 | ui->setupUi(this); |
| 55 | |
| 56 | supportedImageformats << "*.png" << "*.jpg" << "*.jpeg" << "*.tiff" |
| 57 | << "*.tif" << "*.ppm" << "*.bmp" << "*.xpm" |
| 58 | << "*.tga" << "*.gif"; |
| 59 | |
| 60 | //connect signals of GUI elements with slots of this class |
| 61 | connectSignalSlots(); |
| 62 | |
| 63 | //hide advanced settings and connect signals/slots to show them |
| 64 | hideAdvancedSettings(); |
| 65 | |
| 66 | //initialize graphicsview |
| 67 | GraphicsScene *scene = new GraphicsScene(); |
| 68 | ui->graphicsView->setScene(scene); |
| 69 | ui->graphicsView->setDragMode(QGraphicsView::ScrollHandDrag); |
| 70 | scene->addText("Start by dragging images here."); |
| 71 | ui->graphicsView->setRenderHints(QPainter::HighQualityAntialiasing |
| 72 | | QPainter::SmoothPixmapTransform); |
| 73 | ui->graphicsView->setAcceptDrops(true); |
| 74 | |
| 75 | //show default status message |
| 76 | ui->statusBar->showMessage("Drag images into the empty preview window to load them."); |
| 77 | |
| 78 | //hide queue progressbar |
| 79 | ui->progressBar_Queue->hide(); |
| 80 | |
| 81 | // SSAO map generator is not ready yet, remove it from the UI |
| 82 | ui->tabWidget->removeTab(4); |
| 83 | |
| 84 | //default UI colors |
| 85 | useCustomUiColors = false; |
| 86 | uiColorMainDefault = QColor("#444"); |
| 87 | uiColorTextDefault = QColor("#eee"); |
| 88 | uiColorGraphicsViewDefault = QColor(Qt::darkGray); |
| 89 | uiColorMain = uiColorMainDefault; |
| 90 | uiColorText = uiColorTextDefault; |
| 91 | uiColorGraphicsView = uiColorGraphicsViewDefault; |
| 92 | |
| 93 | //read last window position and color settings from registry |
| 94 | readSettings(); |
| 95 | |
| 96 | //set UI colors |
| 97 | setUiColors(); |
| 98 | |
| 99 | //if the program was opened via "open with" by the OS, |
| 100 | //extract the image paths from the arguments |
| 101 | QStringList args = QCoreApplication::arguments(); |
| 102 | if(args.size() > 1) { |
nothing calls this directly
no outgoing calls
no test coverage detected