-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmainwindow.cpp
94 lines (82 loc) · 2.2 KB
/
mainwindow.cpp
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "scene3d.h"
#include <unistd.h>
#include <stdlib.h>
#include <QFileDialog>
#include <QString>
#include <fstream>
#include <experimental/filesystem>
#include <QTextBrowser>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <experimental/filesystem>
#include <iostream>
static QString xxx, yyy, zzz;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->Wido->setFocusPolicy (Qt::ClickFocus);
ui->Wido->flag_arr = 0;
ui->Wido->flag_pnt = 0;
}
MainWindow::~MainWindow()
{
ui->Wido->free_scene3D();
delete ui;
}
void MainWindow::on_Knopka_clicked()
{
xxx = ui->lineEdit_X->text();
yyy = ui->lineEdit_Y->text();
zzz = ui->lineEdit_Z->text();
ui->Wido->p[0] = xxx.toDouble();
ui->Wido->p[1] = yyy.toDouble();
ui->Wido->p[2] = zzz.toDouble();
ui->Wido->flag_arr = 1;
ui->Wido->flag_pnt = 1;
ui->Wido->update();
ui->Wido->paintGL();
ui->lineEdit_A->setText('(' + QString::number(ui->Wido->v[0]) + "; "
+ QString::number(ui->Wido->v[1]) + "; "
+ QString::number(ui->Wido->v[2]) + ')');
}
void MainWindow::on_Import_file_triggered()
{
QString path = QFileDialog::getOpenFileName(this,tr("Open asteroid"), "", tr("txt (*.txt);;All Files (*)"));
std::cout << "asteroid path is " << path.toStdString() << '\n';
if (path != NULL) {
ui->Wido->my_getArrays(path.toStdString());
ui->Wido->update();
}
}
void MainWindow::free_main_window()
{
ui->Wido->free_scene3D();
}
#include <stdio.h>
#ifdef WINDOWS
#include <direct.h>
#define GetCurrentDir _getcwd
#else
#include <unistd.h>
#define GetCurrentDir getcwd
#endif
#include<iostream>
std::string GetCurrentWorkingDir( void ) {
char buff[FILENAME_MAX];
GetCurrentDir( buff, FILENAME_MAX );
std::string current_working_dir(buff);
return current_working_dir;
}
void MainWindow::on_help_triggered()
{
std::string str;
str = GetCurrentWorkingDir();
str = str.substr(0, str.size() - 34);
str = "firefox " + str + "asteroid-4-sem/html/index.html";
system(str.c_str());
}