-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMainwindow.cpp
More file actions
106 lines (90 loc) · 3.53 KB
/
Mainwindow.cpp
File metadata and controls
106 lines (90 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*********************************************************************************
*Copyright(C) 2013-2016 Qingan Yan (yanqinganssg (at) gmail.com or yanqingan (at) whu.edu.cn)
*Author: Qingan Yan
*Version: v15.2
*Date: Sep-10-2015
*Description: This program is used to display point clouds from .out and .ply file format,
which is the output of Bundler.
*Notice: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation.
*For more information, please view my homepage at https://yanqingan.github.io
**********************************************************************************/
#include <QFileDialog>
#include <QMessageBox>
#include "Mainwindow.h"
#include "ui_Mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
//ui->setupUi(this);
m_mainPlane = new QWidget;
m_sightExplorer = new SightExplorer;
setCentralWidget(m_sightExplorer);
CreateActions();
CreateMenus();
setGeometry(50, 50, WINDOW_WIDTH, WINDOW_HEIGHT);
setMinimumSize(WINDOW_WIDTH_MIN, WINDOW_HEIGHT_MIN);
setWindowTitle("Sight Explorer");
}
MainWindow::~MainWindow()
{
delete ui;
delete m_sightExplorer;
m_sightExplorer = NULL;
}
void MainWindow::CreateMenus()
{
m_fileMenu = menuBar()->addMenu(tr("&File"));
m_fileMenu->addAction(m_newProjectAct);
m_fileMenu->addAction(m_importPlyAct);
m_fileMenu->addAction(m_importOutAct);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_exitAct);
menuBar()->addSeparator();
m_helpMenu = menuBar()->addMenu(tr("&Help"));
m_helpMenu->addAction(m_aboutAct);
}
void MainWindow::NewProject()
{
m_sightExplorer->ClearSight();
}
void MainWindow::ImportPly()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Import ply files"), ".", tr("Ply Files(*.ply)"));
if(fileNames.length())
{
m_sightExplorer->LoadPlyFiles(fileNames, (int)fileNames.length());
}
}
void MainWindow::ImportOut()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Import Out files"), ".", tr("Out Files(*.out)"));
if(fileNames.length())
{
m_sightExplorer->LoadOutFiles(fileNames, (int)fileNames.length());
}
}
void MainWindow::About()
{
QMessageBox::about(this, tr("About SightViewer"), tr("The <b>SightViewer</b> made by Qingan Yan."));
}
void MainWindow::CreateActions()
{
m_newProjectAct = new QAction(QIcon("../yan-SightExplorer12-C-v1/icons/new.png"), tr("&New Project"), this);
m_newProjectAct->setShortcut(QKeySequence::New);
connect(m_newProjectAct, SIGNAL(triggered()), this, SLOT(NewProject()));
m_importPlyAct = new QAction(QIcon("../yan-SightExplorer12-C-v1/icons/open.png"), tr("Import &Ply Files"), this);
m_importPlyAct->setShortcut(QKeySequence::New);
connect(m_importPlyAct, SIGNAL(triggered()), this, SLOT(ImportPly()));
m_importOutAct = new QAction(QIcon("../yan-SightExplorer12-C-v1/icons/open.png"), tr("Import &Out Files"), this);
m_importOutAct->setShortcut(QKeySequence::New);
connect(m_importOutAct, SIGNAL(triggered()), this, SLOT(ImportOut()));
m_exitAct = new QAction(QIcon(""), tr("&Exit"), this);
m_exitAct->setShortcut(QKeySequence::New);
connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close()));
m_aboutAct = new QAction(QIcon(""), tr("&About"), this);
m_aboutAct->setShortcut(QKeySequence::New);
connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(About()));
}