00001 #ifndef MAINWINDOW_C
00002 #define MAINWINDOW_C
00003
00004 #include "NeovisionII/NeoAnnotate/MainWindow.qt.H"
00005 #include "NeovisionII/NeoAnnotate/AnnotationObject.qt.H"
00006 #include "NeovisionII/NeoAnnotate/AnimationDelegate.qt.H"
00007 #include "NeovisionII/NeoAnnotate/AnnotationObjectMgrDelegate.qt.H"
00008 #include <Qt/QtXml>
00009
00010
00011 void MainWindow::createMenuBar()
00012 {
00013 QMenu * fileMenu = menuBar()->addMenu(tr("&File"));
00014
00015
00016 QAction * createDBEntryAction = fileMenu->addAction(tr("&New Annotation"));
00017 createDBEntryAction->setShortcut(tr("Ctrl+N"));
00018 connect(createDBEntryAction, SIGNAL(triggered()), this, SLOT(createDBEntry()));
00019
00020 QAction * saveToDBAction = fileMenu->addAction("&Save Annotation");
00021 saveToDBAction->setShortcut(tr("Ctrl+S"));
00022 connect(saveToDBAction, SIGNAL(triggered()), this, SLOT(saveAnnotationToDB()));
00023
00024 QAction * openFromDBAction = fileMenu->addAction("&Open Existing Annotation");
00025 openFromDBAction->setShortcut(tr("Ctrl+O"));
00026 connect(openFromDBAction, SIGNAL(triggered()), this, SLOT(openAnnotationFromDB()));
00027
00028 QAction * preferencesAction = fileMenu->addAction("Preferences...");
00029 connect(preferencesAction, SIGNAL(triggered()), this, SLOT(openPrefsDialog()));
00030
00031 QMenu * connectionMenu = menuBar()->addMenu(tr("&Connection"));
00032
00033 QAction * connectToDBAction = connectionMenu->addAction("Connect To &Database");
00034 connect(connectToDBAction, SIGNAL(triggered()), &itsDBManager, SLOT(connectToDb()));
00035
00036 QAction * chooseAnnotationSourceAction = connectionMenu->addAction("Choose Annotation &Source");
00037 connect(chooseAnnotationSourceAction, SIGNAL(triggered()), &itsDBManager, SLOT(chooseAnnotationSource()));
00038 }
00039
00040
00041 void MainWindow::createToolbar()
00042 {
00043
00044
00045 QPushButton * zoomInAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/Zoom-In-icon.png"),"", this);
00046 QPushButton * zoomOutAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/Zoom-Out-icon.png"),"", this);
00047 QPushButton * cursorAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/cursor-arrow.png"),"", this);
00048 QPushButton * addVertexAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/cursor-add.png"),"", this);
00049 QPushButton * remVertexAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/cursor-rem.png"),"", this);
00050 QPushButton * rotateAction = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/rotate-icon.jpg"),"", this);
00051
00052 zoomInAction->setToolTip("Zoom In");
00053 zoomOutAction->setToolTip("Zoom Out");
00054 cursorAction->setToolTip("Edit Objects");
00055 addVertexAction->setToolTip("Add Vertex");
00056 remVertexAction->setToolTip("Remove Vertex");
00057
00058 zoomInAction->setIconSize(QSize(24,24));
00059 zoomOutAction->setIconSize(QSize(24,24));
00060 cursorAction->setIconSize(QSize(24,24));
00061 addVertexAction->setIconSize(QSize(24,24));
00062 remVertexAction->setIconSize(QSize(24,24));
00063
00064 QButtonGroup * cursorGroup = new QButtonGroup(this);
00065 cursorGroup->addButton(cursorAction);
00066 cursorGroup->addButton(addVertexAction);
00067 cursorGroup->addButton(remVertexAction);
00068 cursorGroup->addButton(rotateAction);
00069
00070 cursorAction->setCheckable(true);
00071 addVertexAction->setCheckable(true);
00072 remVertexAction->setCheckable(true);
00073 rotateAction->setCheckable(true);
00074
00075
00076 QHBoxLayout * opacityLayout = new QHBoxLayout(this);
00077 QLabel * opacityNameLbl = new QLabel(this);
00078 QSlider * opacitySlider = new QSlider(Qt::Horizontal, this);
00079 QLabel * opacityAmtLbl = new QLabel(this);
00080 QLabel * opacityPerLbl = new QLabel(this);
00081 connect(opacitySlider, SIGNAL(valueChanged(int)), opacityAmtLbl, SLOT(setNum(int)));
00082 connect(opacitySlider, SIGNAL(valueChanged(int)), itsObjectManager, SLOT(setOpacity(int)));
00083 opacitySlider->setValue(50);
00084 opacitySlider->setRange(0, 100);
00085 opacityNameLbl->setText("Opacity: ");
00086 opacityPerLbl->setText("%");
00087 opacityLayout->addWidget(opacityNameLbl);
00088 opacityLayout->addWidget(opacitySlider);
00089 opacityLayout->addWidget(opacityAmtLbl);
00090 opacityLayout->addWidget(opacityPerLbl);
00091 QGroupBox * opacityBox = new QGroupBox(this);
00092 opacityBox->setMaximumWidth(200);
00093 opacityBox->setLayout(opacityLayout);
00094
00095
00096 QToolBar * toolbar = addToolBar(tr("Edit"));
00097
00098
00099 toolbar->addWidget(zoomInAction);
00100 toolbar->addWidget(zoomOutAction);
00101 toolbar->addSeparator();
00102 toolbar->addSeparator();
00103 toolbar->addWidget(cursorAction);
00104 toolbar->addWidget(addVertexAction);
00105 toolbar->addWidget(remVertexAction);
00106 toolbar->addWidget(rotateAction);
00107 toolbar->addSeparator();
00108 toolbar->addSeparator();
00109 toolbar->addWidget(opacityBox);
00110 toolbar->addSeparator();
00111
00112
00113 connect(zoomInAction, SIGNAL(clicked()), itsMainDisplay, SLOT(zoomIn()));
00114 connect(zoomOutAction, SIGNAL(clicked()), itsMainDisplay, SLOT(zoomOut()));
00115 connect(cursorAction, SIGNAL(clicked()), itsMainDisplay, SLOT(setActionMode_Cursor()));
00116 connect(addVertexAction, SIGNAL(clicked()), itsMainDisplay, SLOT(setActionMode_AddVertex()));
00117 connect(remVertexAction, SIGNAL(clicked()), itsMainDisplay, SLOT(setActionMode_RemVertex()));
00118 connect(rotateAction, SIGNAL(clicked()), itsMainDisplay, SLOT(setActionMode_Rotate()));
00119
00120
00121 cursorAction->click();
00122 }
00123
00124
00125 QWidget* MainWindow::createObjectList()
00126 {
00127
00128 QTableView *objectList = new QTableView;
00129 objectList->setSelectionBehavior(QAbstractItemView::SelectRows);
00130 objectList->setSelectionMode(QAbstractItemView::SingleSelection);
00131 objectList->setModel(itsObjectManager);
00132 QVBoxLayout *objectListLayout = new QVBoxLayout;
00133 objectListLayout->addWidget(objectList);
00134
00135 AnnotationObjectMgrDelegate* objMgrDel = new AnnotationObjectMgrDelegate(this);
00136 objMgrDel->setObjCategories(itsDBManager.getObjCategories());
00137 objectList->setItemDelegate(objMgrDel);
00138
00139
00140 connect(objectList, SIGNAL(clicked(const QModelIndex &)), itsObjectManager, SLOT(select(const QModelIndex &)));
00141
00142
00143 connect(itsObjectManager, SIGNAL(selectingObject(int)), objectList, SLOT(selectRow(int)));
00144
00145 QHBoxLayout *objectButtonLayout = new QHBoxLayout;
00146
00147 QPushButton *addObjectButton = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/Add-icon.png"),"");
00148 QPushButton *delObjectButton = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/Remove-icon.png"),"");
00149 connect(addObjectButton, SIGNAL(clicked()), this, SLOT(addObject()));
00150 connect(delObjectButton, SIGNAL(clicked()), itsObjectManager, SLOT(removeObject()));
00151
00152 objectButtonLayout->addWidget(addObjectButton);
00153 objectButtonLayout->addWidget(delObjectButton);
00154 objectButtonLayout->addStretch();
00155
00156 objectListLayout->addLayout(objectButtonLayout);
00157 QWidget *objectListWidget = new QWidget;
00158 objectListWidget->setLayout(objectListLayout);
00159
00160 return objectListWidget;
00161 }
00162
00163
00164 QTableView* MainWindow::createAnimationControls()
00165 {
00166 itsAnimationView = new QTableView;
00167 itsAnimationView->setMouseTracking(true);
00168 itsAnimationView->setSelectionMode(QAbstractItemView::ExtendedSelection);
00169 itsAnimationView->setSelectionBehavior(QAbstractItemView::SelectItems);
00170 itsAnimationView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
00171 itsAnimationView->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
00172 itsAnimationView->horizontalHeader()->setDefaultSectionSize(10);
00173 itsAnimationView->horizontalHeader()->hide();
00174
00175 itsAnimationView->verticalHeader()->setResizeMode(QHeaderView::Fixed);
00176 itsAnimationView->verticalHeader()->setDefaultSectionSize(25);
00177
00178 AnimationDelegate *delegate = new AnimationDelegate(this);
00179 itsAnimationView->setItemDelegate(delegate);
00180
00181 itsAnimationView->setDragDropMode(QAbstractItemView::DragDrop);
00182 itsAnimationView->setDragEnabled(true);
00183
00184 itsAnimationView->viewport()->installEventFilter(this);
00185
00186 itsAnimationView->setContextMenuPolicy(Qt::CustomContextMenu);
00187 connect(itsAnimationView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(animationViewPopup(const QPoint &)));
00188
00189
00190 connect(this, SIGNAL(frameIndexChanged(int)), delegate, SLOT(frameIndexChanged(int)));
00191
00192
00193 connect(itsAnimationView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(animationFrameSelected(const QModelIndex &)));
00194
00195 return itsAnimationView;
00196 }
00197
00198
00199 MainWindow::MainWindow() :
00200 itsDBManager(this),
00201 itsCachedFrameLoader(new CachedFrameLoader),
00202 itsFramerate(10.0),
00203 itsPrefsDialog(this),
00204 itsSettings(new QSettings("iLab", "NeoAnnotate"))
00205 {
00206 itsDBManager.updateSettings(itsSettings);
00207
00208 connect(&itsDBManager, SIGNAL(openVideo(QString)), this, SLOT(openVideo(QString)));
00209
00210 statusBar()->insertPermanentWidget(0, &itsDBStatusLabel);
00211 statusBar()->insertPermanentWidget(1, new QLabel(" | "));
00212 statusBar()->insertPermanentWidget(2, &itsAnnotatorLabel);
00213 itsDBStatusLabel.setText(tr("Not Connected To DB"));
00214 itsAnnotatorLabel.setText(tr("No Annotator Selected"));
00215
00216 itsDBManager.connectToDb();
00217 while(itsDBManager.isConnected() == false)
00218 {
00219 QMessageBox msgBox(QMessageBox::Critical, "Not Connected To Database",
00220 "You must connect to a database to use this application",
00221 QMessageBox::Abort | QMessageBox::Retry);
00222 if(msgBox.exec() == QMessageBox::Retry)
00223 {
00224 itsDBManager.connectToDb();
00225 }
00226 else
00227 {
00228 qDebug() << "Exiting. ";
00229 QCoreApplication::exit(0);
00230 exit(0);
00231 }
00232 }
00233
00234 buildWindow();
00235 }
00236
00237
00238 void MainWindow::setDBStatusLabel(QString text)
00239 {
00240 itsDBStatusLabel.setText(text);
00241 }
00242
00243
00244 void MainWindow::setAnnotatorLabel(QString text)
00245 {
00246 itsAnnotatorLabel.setText(text);
00247 }
00248
00249
00250 void MainWindow::createTimeline()
00251 {
00252
00253 itsTimeline = new QTimeLine(1, this);
00254
00255 itsTimeline->setCurveShape(QTimeLine::LinearCurve);
00256 }
00257
00258
00259 QGroupBox* MainWindow::createTransport()
00260 {
00261
00262 itsPlayButton = new QPushButton(QIcon("src/NeovisionII/NeoAnnotate/icons/Play-icon.png"),"");
00263 connect(itsPlayButton, SIGNAL(clicked()), this, SLOT(playPushed()));
00264
00265
00266 itsProgressBar = new QSlider(this);
00267 itsProgressBar->setOrientation(Qt::Horizontal);
00268 itsProgressBar->setRange(0,0);
00269
00270 connect(itsProgressBar, SIGNAL(sliderMoved(int)), this, SLOT(changeTime(int)));
00271 connect(itsProgressBar, SIGNAL(sliderPressed()), this, SLOT(sliderPressed()));
00272 connect(itsProgressBar, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
00273
00274 itsFrameLabel = new QLabel(this);
00275 itsFrameLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
00276 itsFrameLabel->setMaximumSize(90, 30);
00277 itsFrameLabel->setMinimumSize(90, 30);
00278
00279
00280
00281 QHBoxLayout *transportLayout = new QHBoxLayout;
00282 transportLayout->addWidget(itsPlayButton);
00283 transportLayout->addWidget(itsProgressBar);
00284 transportLayout->addWidget(itsFrameLabel);
00285
00286
00287 QGroupBox *transportBox = new QGroupBox("Transport");
00288 transportBox->setLayout(transportLayout);
00289 transportBox->setFlat(false);
00290
00291 return transportBox;
00292 }
00293
00294
00295
00296 void MainWindow::buildWindow()
00297 {
00298 itsMainDisplay = new MainDisplay(this);
00299 itsObjectManager = new AnnotationObjectManager(this);
00300
00301 connect(itsMainDisplay, SIGNAL(addVertex(QPointF)), itsObjectManager, SLOT(addVertex(QPointF)));
00302 connect(itsMainDisplay, SIGNAL(removeVertex(QPointF)), itsObjectManager, SLOT(removeVertex(QPointF)));
00303
00304 createMenuBar();
00305 createTimeline();
00306 createToolbar();
00307 QGroupBox* transport = createTransport();
00308 QWidget* objectList = createObjectList();
00309
00310
00311 QTableView* animationControls = createAnimationControls();
00312 itsObjectManager->setAnimationView(animationControls);
00313
00314
00315 QVBoxLayout * bottomToolsLayout = new QVBoxLayout;
00316 bottomToolsLayout->addWidget(animationControls);
00317
00318 bottomToolsLayout->addWidget(transport);
00319 QWidget* bottomToolsWidget = new QWidget;
00320 bottomToolsWidget->setLayout(bottomToolsLayout);
00321
00322 QDockWidget * ObjectListToolbar = new QDockWidget("Object List");
00323 ObjectListToolbar->setWidget(objectList);
00324 ObjectListToolbar->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
00325 addDockWidget(Qt::LeftDockWidgetArea, ObjectListToolbar);
00326
00327
00328 QSplitter *mainSplitter = new QSplitter(this);
00329 mainSplitter->setOrientation(Qt::Vertical);
00330 mainSplitter->addWidget(itsMainDisplay);
00331 mainSplitter->addWidget(bottomToolsWidget);
00332 QList<int> sizesList;
00333 sizesList.push_back(400);
00334 sizesList.push_back(100);
00335 mainSplitter->setSizes(sizesList);
00336
00337
00338 QVBoxLayout* mainLayout = new QVBoxLayout;
00339 mainLayout->addWidget(mainSplitter);
00340
00341
00342 QWidget *centralWidget = new QWidget;
00343 setCentralWidget(centralWidget);
00344 centralWidget->setLayout(mainLayout);
00345
00346
00347 connect(itsTimeline, SIGNAL(frameChanged(int)), itsProgressBar, SLOT(setValue(int)));
00348 connect(itsTimeline, SIGNAL(frameChanged(int)), this, SLOT(updateFrame(int)));
00349 connect(this, SIGNAL(pausePlayback(bool)), itsTimeline, SLOT(setPaused(bool)));
00350
00351 setWindowTitle(tr("NeoVision II Video Annotation Tool"));
00352
00353
00354
00355 }
00356
00357
00358
00359
00360
00361
00362 void MainWindow::updateFrame(int frameNum)
00363 {
00364 itsCurrentFrame = frameNum;
00365 itsFrameLabel->setText(QString("Frame: %1").arg(frameNum, 3, 10, QChar(' ')));
00366 itsMainDisplay->setImage(itsCachedFrameLoader->getFrame(frameNum));
00367
00368 emit(frameIndexChanged(frameNum-itsCachedFrameLoader->getFrameRange().getFirst()));
00369
00370
00371 if(itsTimeline->state() == QTimeLine::Running)
00372 {
00373 QModelIndex root = itsAnimationView->indexAt(QPoint(0,0));
00374 QModelIndex currIndex = root.child(1, frameNum);
00375 itsAnimationView->scrollTo(currIndex, QAbstractItemView::PositionAtCenter);
00376 itsAnimationView->scrollToTop();
00377 }
00378 }
00379
00380
00381
00382 void MainWindow::addObject()
00383 {
00384
00385 QTransform t = itsMainDisplay->viewportTransform();
00386
00387 float w = itsMainDisplay->width();
00388 float h = itsMainDisplay->height();
00389
00390 float sx = t.m11();
00391 float sy = t.m22();
00392 float tx = -t.m31();
00393 float ty = -t.m32();
00394
00395 QPointF center_view((w/2.0)/sx, (h/2.0)/sy);
00396 QPointF topLeft(tx/sx, ty/sy);
00397 QPointF center = center_view + topLeft;
00398
00399
00400
00401 AnnotationObject * obj = new AnnotationObject(
00402 itsCurrentFrame,
00403 itsCachedFrameLoader->getFrameRange(),
00404 center
00405 );
00406
00407 obj->setPos(center);
00408
00409
00410 obj->frameChanged(itsTimeline->currentFrame());
00411
00412 itsObjectManager->addObject(obj);
00413 itsMainDisplay->addObject(obj);
00414
00415 connect(itsTimeline, SIGNAL(frameChanged(int)), obj, SLOT(frameChanged(int)));
00416 }
00417
00418 void MainWindow::playPushed()
00419 {
00420 if(itsTimeline->state() == QTimeLine::NotRunning)
00421
00422 {
00423 itsPlayButton->setDown(true);
00424 itsTimeline->start();
00425 }
00426 else if(itsTimeline->state() == QTimeLine::Paused)
00427 {
00428 itsPlayButton->setDown(true);
00429 itsTimeline->resume();
00430 }
00431 else if(itsTimeline->state() == QTimeLine::Running)
00432 {
00433 itsPlayButton->setDown(false);
00434 itsTimeline->setPaused(true);
00435 }
00436 }
00437
00438 void MainWindow::changeTime(int frameNum)
00439 {
00440
00441 int ms = 1.0/itsFramerate * qreal(frameNum - itsCachedFrameLoader->getFrameRange().getFirst()) * 1000.0;
00442
00443 itsTimeline->setCurrentTime(ms);
00444 }
00445
00446 void MainWindow::sliderPressed()
00447 {
00448 if(itsTimeline->state() == QTimeLine::Running)
00449 {
00450 timelineWasRunning = true;
00451 itsTimeline->setPaused(true);
00452 }
00453 else
00454 {
00455 timelineWasRunning = false;
00456 }
00457 }
00458
00459 void MainWindow::sliderReleased()
00460 {
00461 if(timelineWasRunning)
00462 {
00463
00464 itsTimeline->start();
00465 }
00466 }
00467
00468
00469 void MainWindow::animationViewPopup(const QPoint & pos)
00470 {
00471 QPoint globalPos = itsAnimationView->viewport()->mapToGlobal(pos);
00472 int column = itsAnimationView->indexAt(pos).column();
00473 int row = itsAnimationView->indexAt(pos).row();
00474
00475 itsObjectManager->constructAnimationContextMenu(globalPos, row, column);
00476 }
00477
00478 bool MainWindow::eventFilter(QObject * watched, QEvent * event)
00479 {
00480 if(watched == itsAnimationView->viewport())
00481 {
00482 if(event->type() == QEvent::MouseButtonPress)
00483 {
00484
00485
00486
00487 QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
00488 QPoint pos = mouseEvent->pos();
00489 QModelIndex index = itsAnimationView->indexAt(pos);
00490
00491
00492 int frameNumber = index.column() + itsCachedFrameLoader->getFrameRange().getFirst();
00493 this->changeTime(frameNumber);
00494
00495
00496
00497
00498 itsObjectManager->setLastAnimViewClick(index);
00499
00500 return false;
00501
00502 }
00503 else if(event->type() == QEvent::MouseButtonRelease)
00504 {
00505
00506
00507
00508 QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
00509 QPoint pos = mouseEvent->pos();
00510 int column = itsAnimationView->indexAt(pos).column();
00511 int frameNumber = column + itsCachedFrameLoader->getFrameRange().getFirst();
00512
00513
00514 this->changeTime(frameNumber);
00515
00516 return false;
00517 }
00518 else if(event->type() == QEvent::KeyPress)
00519 {
00520
00521 }
00522 }
00523 return false;
00524 }
00525
00526 void MainWindow::animationFrameSelected(const QModelIndex & index)
00527 {
00528 int frameNumber = index.column() + itsCachedFrameLoader->getFrameRange().getFirst();
00529 updateFrame(frameNumber);
00530 changeTime(frameNumber);
00531 }
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563 void MainWindow::openVideo(QString fileName)
00564 {
00565 if(fileName == "") return;
00566
00567 itsFileName = fileName;
00568 itsCachedFrameLoader->loadVideo(itsFileName);
00569
00570 updateFrame(0);
00571
00572
00573 FrameRange frameRange = itsCachedFrameLoader->getFrameRange();
00574
00575
00576 int numFrames = frameRange.getLast() - frameRange.getFirst() - 1;
00577
00578
00579 qreal duration_s = 1.0/(itsFramerate / qreal(numFrames));
00580 qreal duration_ms = 1000.0 * duration_s;
00581
00582 itsTimeline->setDuration(duration_ms);
00583
00584
00585 itsTimeline->setFrameRange(frameRange.getFirst(),frameRange.getLast()-1);
00586
00587 itsProgressBar->setRange(itsTimeline->startFrame(),itsTimeline->endFrame());
00588 }
00589
00590 void MainWindow::openVideo()
00591 {
00592 QFileDialog dialog(this, tr("Choose a .mgzJ file"));
00593 dialog.setFileMode(QFileDialog::ExistingFile);
00594 dialog.setNameFilter(tr("mgzJ Files (*.mgzJ)"));
00595
00596 if(dialog.exec())
00597 {
00598 openVideo(dialog.selectedFiles()[0]);
00599 }
00600 }
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 void MainWindow::saveAnnotationToDB()
00916 {
00917 itsDBManager.saveAnnotation();
00918 }
00919
00920 void MainWindow::openAnnotationFromDB()
00921 {
00922 itsDBManager.openAnnotation();
00923 }
00924
00925 void MainWindow::createDBEntry()
00926 {
00927 itsDBManager.createDBEntry();
00928 }
00929
00930 void MainWindow::openPrefsDialog()
00931 {
00932
00933 if(itsSettings->contains("archiveLoc"))
00934 itsPrefsDialog.archiveLocEdit->setText(itsSettings->value("archiveLoc").toString());
00935 if(itsSettings->contains("workingLoc"))
00936 itsPrefsDialog.workingLocEdit->setText(itsSettings->value("workingLoc").toString());
00937 if(itsSettings->contains("incomingLoc"))
00938 itsPrefsDialog.incomingLocEdit->setText(itsSettings->value("incomingLoc").toString());
00939
00940 if(itsPrefsDialog.exec())
00941 {
00942 QString archiveLoc = itsPrefsDialog.archiveLocEdit->text();
00943 QString workingLoc = itsPrefsDialog.workingLocEdit->text();
00944 QString incomingLoc = itsPrefsDialog.incomingLocEdit->text();
00945
00946 itsSettings->setValue("archiveLoc", archiveLoc);
00947 itsSettings->setValue("workingLoc", workingLoc);
00948 itsSettings->setValue("incomingLoc", incomingLoc);
00949
00950 }
00951 }
00952 #endif //MAINWINDOW_C
00953