-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectoptions.ui.h
266 lines (242 loc) · 8.83 KB
/
projectoptions.ui.h
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
/*
ktigcc - TIGCC IDE for KDE
Copyright (C) 2004-2006 Kevin Kofler
Copyright (C) 2006 Joey Adams
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; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <qaccel.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kprocess.h>
#include "ktigcc.h"
#include "tpr.h"
#include "programoptions.h"
ProgramOptions *programoptions;
//the program options subdialog is created at initialization of a ProjectOptions and remains existant until the ProjectOptions is destroyed.
void ProjectOptions::init()
{
if (!have_fargo) FargoProgram->hide();
if (!have_flashos) FlashOperatingSystem->hide();
//Create the Program Options dialog
programoptions=new ProgramOptions(this);
//Toggle controls to match settings.
ImportSettings();
//Update stuff
CheckOncalcNames();
UpdateVisibilities();
}
void ProjectOptions::destroy()
{
//Save settings
if (result()==QDialog::Accepted)
ExportSettings();
delete(programoptions);
}
void ProjectOptions::ImportSettings(void)
{
Boolean isregular;
//Tab: General
OncalcVariableName_1->setText(settings.data_var);
if (settings.copy_data_var)
{
if (settings.copy_data_var_arc)
CreateCopyIfArchived->setChecked(TRUE);
else
CreateCopyAlways->setChecked(TRUE);
}
OncalcVariableName_2->setText(settings.pack_name);
isregular=TRUE;
if (settings.fargo)
FargoProgram->setChecked(TRUE),isregular=FALSE;
if (settings.flash_os)
FlashOperatingSystem->setChecked(TRUE),isregular=FALSE;
if (settings.archive)
FunctionArchive->setChecked(TRUE),isregular=FALSE;
if (isregular)
{
if (settings.use_data_var)
{
ExternalDataVariable->setChecked(TRUE);
LOncalcVariableName_1->setEnabled(TRUE);
OncalcVariableName_1->setEnabled(TRUE);
LCreateCopyNever->setEnabled(TRUE);
CreateCopyNever->setEnabled(TRUE);
CreateCopyIfArchived->setEnabled(TRUE);
CreateCopyAlways->setEnabled(TRUE);
}
if (settings.pack)
{
CompressProgram->setChecked(TRUE);
LOncalcVariableName_2->setEnabled(TRUE);
OncalcVariableName_2->setEnabled(TRUE);
}
}
else
{
ExternalDataVariable->setEnabled(FALSE);
CompressProgram->setEnabled(FALSE);
}
//Tab: Compilation
GCCSwitches->setText(settings.cc_switches);
AsSwitches->setText(settings.as_switches);
A68kSwitches->setText(settings.a68k_switches);
GenerateDebugInformation->setChecked(settings.debug_info);
//Tab: Linking
NOPs->setChecked(settings.optimize_nops);
ReturnSequences->setChecked(settings.optimize_returns);
Branches->setChecked(settings.optimize_branches);
MoveLoadPushInstructions->setChecked(settings.optimize_moves);
TestCompareInstructions->setChecked(settings.optimize_tests);
CalculationInstructions->setChecked(settings.optimize_calcs);
RemoveUnusedSections->setChecked(settings.remove_unused);
ReorderSections->setChecked(settings.reorder_sections);
CutUnusedRanges->setChecked(settings.cut_ranges);
MergeConstants->setChecked(settings.merge_constants);
LinkAgainstStandardLibrary->setChecked(settings.std_lib);
InitializeBSSSection->setChecked(settings.initialize_bss);
OutputVariableImageWithoutWrapper->setChecked(settings.outputbin);
//Tab: Post-Build
CallAfterBuilding->setText(settings.post_build);
Parameters->setText(settings.cmd_line);
programoptions->ImportSettings();
}
void ProjectOptions::ExportSettings(void)
{
//Tab: General
settings.fargo=FALSE;
settings.flash_os=FALSE;
settings.archive=FALSE;
settings.use_data_var=FALSE;
settings.pack=FALSE;
if (FargoProgram->isChecked())
settings.fargo=TRUE;
else if (FlashOperatingSystem->isChecked())
settings.flash_os=TRUE;
else if (FunctionArchive->isChecked())
settings.archive=TRUE;
else if (RegularProgram->isChecked()) //the original TIGCC IDE automatically unchecked External data variable and Compress program when you toggled away from Regular Program, so we will only consider these two if Regular Program is toggled
{
if (ExternalDataVariable->isChecked())
settings.use_data_var=TRUE;
if (CompressProgram->isChecked())
settings.pack=TRUE;
}
//Subselections for External data variable and Compress program are always preserved.
settings.data_var=OncalcVariableName_1->text();
settings.copy_data_var_arc=FALSE;
if (CreateCopyNever->isChecked())
settings.copy_data_var=FALSE;
else
{
settings.copy_data_var=TRUE;
if (CreateCopyIfArchived->isChecked())
settings.copy_data_var_arc=TRUE;
}
settings.pack_name=OncalcVariableName_2->text();
//Tab: Compilation
settings.cc_switches=GCCSwitches->text();
settings.as_switches=AsSwitches->text();
settings.a68k_switches=A68kSwitches->text();
settings.debug_info=GenerateDebugInformation->isChecked();
//Tab: Linking
settings.optimize_nops=NOPs->isChecked();
settings.optimize_returns=ReturnSequences->isChecked();
settings.optimize_branches=Branches->isChecked();
settings.optimize_moves=MoveLoadPushInstructions->isChecked();
settings.optimize_tests=TestCompareInstructions->isChecked();
settings.optimize_calcs=CalculationInstructions->isChecked();
settings.remove_unused=RemoveUnusedSections->isChecked();
settings.reorder_sections=ReorderSections->isChecked();
settings.cut_ranges=CutUnusedRanges->isChecked();
settings.merge_constants=MergeConstants->isChecked();
settings.std_lib=LinkAgainstStandardLibrary->isChecked();
settings.initialize_bss=InitializeBSSSection->isChecked();
settings.outputbin=OutputVariableImageWithoutWrapper->isChecked();
//Tab: Post-Build
settings.post_build=CallAfterBuilding->text();
settings.cmd_line=Parameters->text();
programoptions->ExportSettings();
}
void ProjectOptions::RegularProgram_toggled(bool state)
{
if (!state)
{
ExternalDataVariable->setChecked(FALSE);
CompressProgram->setChecked(FALSE);
ExternalDataVariable_toggled(FALSE);
CompressProgram_toggled(FALSE);
}
ExternalDataVariable->setEnabled(state);
CompressProgram->setEnabled(state);
}
void ProjectOptions::ExternalDataVariable_toggled(bool state)
{
LOncalcVariableName_1->setEnabled(state);
OncalcVariableName_1->setEnabled(state);
LCreateCopyNever->setEnabled(state);
CreateCopyNever->setEnabled(state);
CreateCopyIfArchived->setEnabled(state);
CreateCopyAlways->setEnabled(state);
CheckOncalcNames();
}
void ProjectOptions::CompressProgram_toggled(bool state)
{
LOncalcVariableName_2->setEnabled(state);
OncalcVariableName_2->setEnabled(state);
CheckOncalcNames();
}
void ProjectOptions::CheckOncalcNames()
{
const QString &edvname=OncalcVariableName_1->text();
const QString &compname=OncalcVariableName_2->text();
Boolean edvon=OncalcVariableName_1->isEnabled();
Boolean compon=OncalcVariableName_2->isEnabled();
if ((edvon&&edvname.isEmpty()) || (compon&&compname.isEmpty()) || (edvon&&compon&&!edvname.compare(compname)))
buttonOk->setEnabled(FALSE);
else
buttonOk->setEnabled(TRUE);
}
void ProjectOptions::UpdateVisibilities()
{
Boolean regularprogram=RegularProgram->isChecked();
Boolean functionarchive=FunctionArchive->isChecked();
if (regularprogram)
ProgramOptionsButton->show();
else
ProgramOptionsButton->hide();
PO_TabWidget->setTabEnabled(PO_TabWidget->page(2),!functionarchive);
PO_TabWidget->setTabEnabled(PO_TabWidget->page(3),!functionarchive);
}
void ProjectOptions::ProgramOptionsFunc()
{
programoptions->exec();
}
void ProjectOptions::browseButton_clicked()
{
QString ret=KFileDialog::getOpenFileName("/usr/bin",
"application/x-executable application/x-executable-script",this,
"Choose executable");
if (!ret.isEmpty())
CallAfterBuilding->setText(KProcess::quote(ret)+" \"($TI89File)\" \"($TI92PlusFile)\" \"($V200File)\"");
}