-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnewdialog.cpp
93 lines (88 loc) · 2.7 KB
/
newdialog.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
#include <QMessageBox>
#include "newdialog.h"
#include "ui_newdialog.h"
NewDialog::NewDialog(NewSettingsType *settings,QWidget *parent) :
QDialog(parent),
ui(new Ui::NewDialog)
{
m_pSettings = settings;
ui->setupUi(this);
ui->ClusterSizeComboBox->addItem(QString("512"));
ui->ClusterSizeComboBox->addItem(QString("256"));
ui->ClusterSizeComboBox->addItem(QString("64"));
ui->ClusterSizeComboBox->addItem(tr("Custom"));
m_Settings = *m_pSettings; //get detected values
if (CLUSTER_512 == m_Settings.IOClusterSize)
{
ui->ClusterSizeComboBox->setCurrentIndex(0);
ui->ImageSizeSpinBox->setValue(512);//just a prediction
}
else if (CLUSTER_256 == m_Settings.IOClusterSize)
{
ui->ClusterSizeComboBox->setCurrentIndex(1);
ui->ImageSizeSpinBox->setValue(512);//just a prediction
}
else if (CLUSTER_64 == m_Settings.IOClusterSize)
{
ui->ClusterSizeComboBox->setCurrentIndex(2);
ui->ImageSizeSpinBox->setValue(32);//just a prediction
}
else if (CLUSTER_CUSTOM == m_Settings.IOClusterSize)
{
ui->ClusterSizeComboBox->setCurrentIndex(3);\
ui->ImageSizeSpinBox->setValue(512);//just a prediction
}
if (CLUSTER_CUSTOM == m_Settings.IOClusterSize)
{
ui->label_3->setDisabled(false);
ui->CustomClusterSizeSpinBox->setDisabled(false);
}
else
{
ui->label_3->setDisabled(true);
ui->CustomClusterSizeSpinBox->setDisabled(true);
}
this->setWindowTitle(this->windowTitle().append(" ").append(APP_VERSION));
}
NewDialog::~NewDialog()
{
delete ui;
}
void NewDialog::on_ClusterSizeComboBox_currentIndexChanged(int index)
{
ui->label_3->setDisabled(true);
ui->CustomClusterSizeSpinBox->setDisabled(true);
switch (index)
{
case 0:
m_Settings.IOClusterSize = CLUSTER_512;
break;
case 1:
m_Settings.IOClusterSize = CLUSTER_256;
break;
case 2:
m_Settings.IOClusterSize = CLUSTER_64;
break;
case 3:
m_Settings.IOClusterSize = CLUSTER_CUSTOM;
ui->label_3->setDisabled(false);
ui->CustomClusterSizeSpinBox->setDisabled(false);
break;
}
}
void NewDialog::on_buttonBox_accepted()
{
m_Settings.iImageSize = ui->ImageSizeSpinBox->value();
m_Settings.iIOCustomClusterSize = ui->CustomClusterSizeSpinBox->value();
m_pSettings[0] = m_Settings;
}
void NewDialog::on_ImageSizeSpinBox_editingFinished()
{
if (ui->ImageSizeSpinBox->value() > 16384)
{
QMessageBox msgBox;
msgBox.setText(tr("Image size is too big. Saturn's hard limit is 16MBytes (128MBit) "));
msgBox.exec();
ui->ImageSizeSpinBox->setValue(16384);
}
}