-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
47 lines (34 loc) · 1.02 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QMessageBox>
#include <condition_variable>
using namespace Argo;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
QString MainWindow::LoadTorrentPicker() {
return QFileDialog::getOpenFileName(this, tr("Open Torrent"), "", tr("Torrents (*.torrent)"));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString torrent_file = LoadTorrentPicker();
std::shared_ptr<Argo::Torrent> torrent = _universe->LoadTorrent(torrent_file.toStdWString().c_str());
if (!torrent) {
QMessageBox::information(NULL, "Error! Error!", "Failed to load Torrent: [torrent name]");
return;
}
// Temporary storage until we get the listview ready
_torrents.push_back(torrent);
// Don't think we'll need these
std::mutex wait_mutex;
std::condition_variable wait_for_torrent_complete;
torrent->Start();
}