-
Notifications
You must be signed in to change notification settings - Fork 2
/
AddEmulationDeviceDialog.cpp
63 lines (50 loc) · 1.57 KB
/
AddEmulationDeviceDialog.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
/**
* AddEmulationDeviceDialog.cpp
* Copyright (c) 2014 ROBLOX Corp. All Rights Reserved.
*/
#include "stdafx.h"
#include "AddEmulationDeviceDialog.h"
// Qt Headers
#include <QSettings>
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
#include <QApplication>
#include <QDesktopWidget>
// Roblox Studio Headers
#include "AuthoringSettings.h"
#include "RobloxApplicationManager.h"
#include "RobloxDocManager.h"
#include "RobloxIDEDoc.h"
#include "RobloxMainWindow.h"
#include "StudioDeviceEmulator.h"
#include "UpdateUIManager.h"
AddEmulationDeviceDialog::AddEmulationDeviceDialog(QWidget* Parent)
: QDialog(Parent,Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
setAttribute(Qt::WA_DeleteOnClose,false);
m_UI.setupUi(this);
setFixedSize(size());
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint);
m_UI.dpiValue->setText(QString("%1 DPI").arg(QApplication::desktop()->physicalDpiX()));
connect(m_UI.cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
connect(m_UI.okButton, SIGNAL(clicked()), this, SLOT(submitDevice()));
}
/**
* Callback for closing the dialog.
*
*/
void AddEmulationDeviceDialog::closeEvent(QCloseEvent* event)
{
QDialog::closeEvent(event);
}
void AddEmulationDeviceDialog::onCancel()
{
accept();
}
void AddEmulationDeviceDialog::submitDevice()
{
StudioDeviceEmulator::EmulationDevice device(m_UI.lineEditName->text(), QApplication::desktop()->physicalDpiX(), m_UI.spinBoxWidth->value(), m_UI.spinBoxHeight->value(), m_UI.checkBoxMobile->checkState());
StudioDeviceEmulator::Instance().addDevice(device);
accept();
}