00001 #include <QApplication>
00002 #include <QScrollArea>
00003 #include <QSlider>
00004 #include <QVBoxLayout>
00005 #include <QDebug>
00006 #include "ui_MainWindow.h"
00007
00008 #include "GLWidget.h"
00009 #include "TransferFunction.h"
00010 #include "TimeCounter.h"
00011 #include "ScrollAreaTransferFunction.h"
00012
00013
00014 void initTransferFunctionWindow(QDockWidget &transferFunctionDockWindow,
00015 QScrollArea *scrollArea, TransferFunction &transferFunction)
00016 {
00017 scrollArea->setBackgroundRole(QPalette::Dark);
00018 scrollArea->setWidget(&transferFunction);
00019 scrollArea->setAlignment(Qt::AlignBottom);
00020
00021 scrollArea->setMaximumWidth(4096);
00022
00023
00024 QWidget *transferFunctionWindow = new QWidget();
00025 QSlider *slider = new QSlider(Qt::Horizontal);
00026 slider->setMinimum(0);
00027 slider->setMaximum(1000);
00028
00029 QVBoxLayout *layout = new QVBoxLayout;
00030 layout->addWidget(scrollArea);
00031 layout->addWidget(slider);
00032
00033 transferFunctionWindow->setLayout(layout);
00034 transferFunctionDockWindow.setWidget(transferFunctionWindow);
00035
00036 QObject::connect(slider, SIGNAL(valueChanged(int)), &transferFunction, SLOT(setZoomFactor(int)));
00037
00038 }
00039
00040 int main(int argc, char *argv[])
00041 {
00042
00043 TimeCounter_init();
00044
00045
00046 QApplication app(argc, argv);
00047
00048
00049 QMainWindow *mainWindow = new QMainWindow;
00050 Ui::MainWindow uiMainWindow;
00051 uiMainWindow.setupUi(mainWindow);
00052
00053 mainWindow->setWindowTitle("TiDo Visualization 1.0");
00054
00055 Volume volume;
00056
00057 ScrollAreaTransferFunction *scrollArea = new ScrollAreaTransferFunction();
00058 TransferFunction transferFunction(scrollArea);
00059 initTransferFunctionWindow(*(uiMainWindow.TransferfunctionDockWidget), scrollArea, transferFunction);
00060
00061 GLWidget *glWidget = new GLWidget(uiMainWindow);
00062 mainWindow->setCentralWidget(glWidget);
00063
00064 QObject::connect(uiMainWindow.actionLoad_TransferFunction, SIGNAL(triggered()), &transferFunction, SLOT(loadTfFile()));
00065 QObject::connect(uiMainWindow.actionSave_TransferFunction, SIGNAL(triggered()), &transferFunction, SLOT(saveTfFile()));
00066 QObject::connect(uiMainWindow.actionLoad_model, SIGNAL(triggered()), &volume, SLOT(loadDatFile()));
00067 QObject::connect(&volume, SIGNAL(loadedDatFile(Volume*)), glWidget, SLOT(changeVolume(Volume*)));
00068 QObject::connect(&volume, SIGNAL(loadedDatFile(Volume*)), &transferFunction, SLOT(setVolume(Volume*)));
00069 QObject::connect(&volume, SIGNAL(loadedDatFileName(const QString&)), mainWindow, SLOT(setWindowTitle(const QString&)));
00070 QObject::connect(&transferFunction, SIGNAL(getTransferFunction(unsigned int*, int)), glWidget, SLOT(changeTransferFunction(unsigned int*, int)));
00071
00072
00073 uiMainWindow.TransferfunctionDockWidget->setVisible(false);
00074
00075
00076 mainWindow->show();
00077 volume.loadDatFile("dat/present.dat");
00078
00079
00080 return app.exec();
00081 }