MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // Setup UI ui->setupUi(this); // Set start tab as blank QLabel *newTab = new QLabel(ui->tabWidget); newTab->setText(tr("Neither camera connected nor file loaded.")); newTab->setAlignment(Qt::AlignCenter); ui->tabWidget->addTab(newTab, ""); ui->tabWidget->setTabsClosable(false); // Add "Connect to Camera" button to tab connectToCameraButton = new QPushButton(); connectToCameraButton->setText(tr("Connect/Open")); ui->tabWidget->setCornerWidget(connectToCameraButton, Qt::TopLeftCorner); connect(connectToCameraButton,SIGNAL(released()),this, SLOT(connectToCamera())); connect(ui->tabWidget,SIGNAL(tabCloseRequested(int)),this, SLOT(disconnectCamera(int))); // Set focus on button connectToCameraButton->setFocus(); connectToCameraButton->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O)); // Connect other signals/slots connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelpDialog())); connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(showAboutQtDialog())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionFullScreen, SIGNAL(toggled(bool)), this, SLOT(setFullScreen(bool))); connect(ui->actionConnect_Open, SIGNAL(triggered()), this, SLOT(connectToCamera())); // Create SharedImageBuffer object sharedImageBuffer = new SharedImageBuffer(); addCodecs(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), theCurImageIndex(0), theProcessingInProgressFlag(false) { ui->setupUi(this); theDragModeStrings.insert(QGraphicsView::NoDrag, "No Drag Mode"); theDragModeStrings.insert(QGraphicsView::RubberBandDrag, "Selection Mode"); theDragModeStrings.insert(QGraphicsView::ScrollHandDrag, "Scroll Mode"); connect(ui->thePic, SIGNAL(scrollModeChanged(QGraphicsView::DragMode)), this, SLOT(updateStatusBar(QGraphicsView::DragMode))); connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)), this, SLOT(rectangleSelection(QPoint,QPoint))); // List manipulation button handlers connect(ui->theUpButton, SIGNAL(clicked()), this, SLOT(movePageSelectionUp())); connect(ui->theDownButton, SIGNAL(clicked()), this, SLOT(movePageSelectionDown())); connect(ui->theDeleteButton, SIGNAL(clicked()), this, SLOT(deletePageSelection())); // Want to know when the Process Images button should be enabled. The rectangleSelection and deletePageSelection // button are the two buttons that effect the number of items in the list connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)), this, SLOT(isImageProcessingAllowed())); connect(ui->theDeleteButton, SIGNAL(clicked()), this, SLOT(isImageProcessingAllowed())); connect(ui->theNextImageButton, SIGNAL(clicked()), this, SLOT(nextImage())); connect(ui->thePreviousImageButton, SIGNAL(clicked()), this, SLOT(previousImage())); connect(ui->theProcessImagesButton, SIGNAL(clicked()), this, SLOT(processImages())); connect(ui->theWritePdfButton, SIGNAL(clicked()), this, SLOT(writePdf())); // Connect menu buttons connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(showAboutQtDialog())); connect(ui->actionStart_Server, SIGNAL(triggered()), this, SLOT(startServerDialog())); connect(ui->actionOpen_Directory, SIGNAL(triggered()), this, SLOT(openDirectoryChooser())); updateStatusBar(ui->thePic->dragMode()); }