Skip to content

Commit 746d570

Browse files
[COSMETIC] Renames the method and attributes so they use camlCase (openscad#5628)
* [COSMETIC] Renames the method and attributes so they use camlCase It seems that both camlCase and joint_lower naming scheme are used in openScad, with more names in camlCase. In this PR I renames the ones that were using joint_lower scheme to unify with camlCase.
1 parent b7e760f commit 746d570

File tree

13 files changed

+271
-271
lines changed

13 files changed

+271
-271
lines changed

src/gui/Animate.cc

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ Animate::Animate(QWidget *parent) : QWidget(parent)
3232

3333
void Animate::initGUI()
3434
{
35-
this->anim_step = 0;
36-
this->anim_numsteps = 0;
37-
this->anim_tval = 0.0;
38-
this->anim_dumping = false;
39-
this->anim_dump_start_step = 0;
35+
this->animStep = 0;
36+
this->animNumSteps = 0;
37+
this->animTVal = 0.0;
38+
this->animDumping = false;
39+
this->animDumpStartStep = 0;
4040

4141
this->iconRun = QIcon::fromTheme("chokusen-animate-play");
4242
this->iconPause = QIcon::fromTheme("chokusen-animate-pause");
4343
this->iconDisabled = QIcon::fromTheme("chokusen-animate-disabled");
4444

45-
animate_timer = new QTimer(this);
46-
connect(animate_timer, SIGNAL(timeout()), this, SLOT(incrementTVal()));
45+
animateTimer = new QTimer(this);
46+
connect(animateTimer, SIGNAL(timeout()), this, SLOT(incrementTVal()));
4747

4848
connect(this->e_tval, SIGNAL(textChanged(QString)), this, SLOT(updatedAnimTval()));
4949
connect(this->e_fps, SIGNAL(textChanged(QString)), this, SLOT(updatedAnimFpsAndAnimSteps()));
@@ -66,44 +66,44 @@ void Animate::setMainWindow(MainWindow *mainWindow)
6666
void Animate::connectAction(QAction *action, QPushButton *button)
6767
{
6868
connect(action, &QAction::triggered, button, &QPushButton::click);
69-
this->action_list.append(action);
69+
this->actionList.append(action);
7070
}
7171

7272
void Animate::updatedAnimTval()
7373
{
74-
double t = this->e_tval->text().toDouble(&this->t_ok);
74+
double t = this->e_tval->text().toDouble(&this->tOK);
7575
// Clamp t to 0-1
76-
if (this->t_ok) {
76+
if (this->tOK) {
7777
t = t < 0 ? 0.0 : ((t > 1.0) ? 1.0 : t);
7878
} else {
7979
t = 0.0;
8080
}
8181

82-
this->anim_tval = t;
82+
this->animTVal = t;
8383
emit mainWindow->actionRenderPreview();
8484

8585
updatePauseButtonIcon();
8686
}
8787

8888
void Animate::updatedAnimFpsAndAnimSteps()
8989
{
90-
animate_timer->stop();
90+
animateTimer->stop();
9191

9292
int numsteps = this->e_fsteps->text().toInt(&this->steps_ok);
9393
if (this->steps_ok) {
94-
this->anim_numsteps = numsteps;
94+
this->animNumSteps = numsteps;
9595
} else {
96-
this->anim_numsteps = 0;
96+
this->animNumSteps = 0;
9797
}
98-
this->anim_dumping = false;
99-
100-
double fps = this->e_fps->text().toDouble(&this->fps_ok);
101-
animate_timer->stop();
102-
if (this->fps_ok && fps > 0 && this->anim_numsteps > 0) {
103-
this->anim_step = int(this->anim_tval * this->anim_numsteps) % this->anim_numsteps;
104-
animate_timer->setSingleShot(false);
105-
animate_timer->setInterval(int(1000 / fps));
106-
animate_timer->start();
98+
this->animDumping = false;
99+
100+
double fps = this->e_fps->text().toDouble(&this->fpsOK);
101+
animateTimer->stop();
102+
if (this->fpsOK && fps > 0 && this->animNumSteps > 0) {
103+
this->animStep = int(this->animTVal * this->animNumSteps) % this->animNumSteps;
104+
animateTimer->setSingleShot(false);
105+
animateTimer->setInterval(int(1000 / fps));
106+
animateTimer->start();
107107
}
108108

109109
QPalette defaultPalette;
@@ -116,7 +116,7 @@ void Animate::updatedAnimFpsAndAnimSteps()
116116
this->e_fsteps->setStyleSheet(redStyleSheet);
117117
}
118118

119-
if (this->fps_ok || this->e_fps->text() == "") {
119+
if (this->fpsOK || this->e_fps->text() == "") {
120120
this->e_fps->setStyleSheet("");
121121
} else {
122122
this->e_fps->setStyleSheet(redStyleSheet);
@@ -128,65 +128,65 @@ void Animate::updatedAnimFpsAndAnimSteps()
128128

129129
void Animate::updatedAnimDump(bool checked)
130130
{
131-
if (!checked) this->anim_dumping = false;
131+
if (!checked) this->animDumping = false;
132132

133133
updatePauseButtonIcon();
134134
}
135135

136136
// Only called from animate_timer
137137
void Animate::incrementTVal()
138138
{
139-
if (this->anim_numsteps == 0) return;
139+
if (this->animNumSteps == 0) return;
140140

141141
if (mainWindow->windowActionHideCustomizer->isVisible()) {
142142
if (mainWindow->activeEditor->parameterWidget->childHasFocus()) return;
143143
}
144144

145-
if (this->anim_numsteps > 1) {
146-
this->anim_step = (this->anim_step + 1) % this->anim_numsteps;
147-
this->anim_tval = 1.0 * this->anim_step / this->anim_numsteps;
148-
} else if (this->anim_numsteps > 0) {
149-
this->anim_step = 0;
150-
this->anim_tval = 0.0;
145+
if (this->animNumSteps > 1) {
146+
this->animStep = (this->animStep + 1) % this->animNumSteps;
147+
this->animTVal = 1.0 * this->animStep / this->animNumSteps;
148+
} else if (this->animNumSteps > 0) {
149+
this->animStep = 0;
150+
this->animTVal = 0.0;
151151
}
152152

153-
const QString txt = QString::number(this->anim_tval, 'f', 5);
153+
const QString txt = QString::number(this->animTVal, 'f', 5);
154154
this->e_tval->setText(txt);
155155

156156
updatePauseButtonIcon();
157157
}
158158

159159
void Animate::updateTVal()
160160
{
161-
if (this->anim_numsteps == 0) return;
161+
if (this->animNumSteps == 0) return;
162162

163-
if (this->anim_step < 0) {
164-
this->anim_step = this->anim_numsteps - this->anim_step - 2;
163+
if (this->animStep < 0) {
164+
this->animStep = this->animNumSteps - this->animStep - 2;
165165
}
166166

167-
if (this->anim_numsteps > 1) {
168-
this->anim_step = (this->anim_step) % this->anim_numsteps;
169-
this->anim_tval = 1.0 * this->anim_step / this->anim_numsteps;
170-
} else if (this->anim_numsteps > 0) {
171-
this->anim_step = 0;
172-
this->anim_tval = 0.0;
167+
if (this->animNumSteps > 1) {
168+
this->animStep = (this->animStep) % this->animNumSteps;
169+
this->animTVal = 1.0 * this->animStep / this->animNumSteps;
170+
} else if (this->animNumSteps > 0) {
171+
this->animStep = 0;
172+
this->animTVal = 0.0;
173173
}
174174

175-
const QString txt = QString::number(this->anim_tval, 'f', 5);
175+
const QString txt = QString::number(this->animTVal, 'f', 5);
176176
this->e_tval->setText(txt);
177177

178178
updatePauseButtonIcon();
179179
}
180180

181181
void Animate::pauseAnimation(){
182-
animate_timer->stop();
182+
animateTimer->stop();
183183
updatePauseButtonIcon();
184184
}
185185

186186
void Animate::on_pauseButton_pressed()
187187
{
188-
if (animate_timer->isActive()) {
189-
animate_timer->stop();
188+
if (animateTimer->isActive()) {
189+
animateTimer->stop();
190190
updatePauseButtonIcon();
191191
} else {
192192
this->updatedAnimFpsAndAnimSteps();
@@ -195,11 +195,11 @@ void Animate::on_pauseButton_pressed()
195195

196196
void Animate::updatePauseButtonIcon()
197197
{
198-
if (animate_timer->isActive()) {
198+
if (animateTimer->isActive()) {
199199
pauseButton->setIcon(this->iconPause);
200200
pauseButton->setToolTip(_("press to pause animation") );
201201
} else {
202-
if (this->fps_ok && this->steps_ok) {
202+
if (this->fpsOK && this->steps_ok) {
203203
pauseButton->setIcon(this->iconRun);
204204
pauseButton->setToolTip(_("press to start animation") );
205205
} else {
@@ -220,31 +220,31 @@ void Animate::editorContentChanged(){
220220
void Animate::animateUpdate()
221221
{
222222
if (mainWindow->animateDockContents->isVisible()) {
223-
double fps = this->e_fps->text().toDouble(&this->fps_ok);
224-
if (this->fps_ok && fps <= 0 && !animate_timer->isActive()) {
225-
animate_timer->stop();
226-
animate_timer->setSingleShot(true);
227-
animate_timer->setInterval(50);
228-
animate_timer->start();
223+
double fps = this->e_fps->text().toDouble(&this->fpsOK);
224+
if (this->fpsOK && fps <= 0 && !animateTimer->isActive()) {
225+
animateTimer->stop();
226+
animateTimer->setSingleShot(true);
227+
animateTimer->setInterval(50);
228+
animateTimer->start();
229229
}
230230
}
231231
}
232232

233233
bool Animate::dumpPictures(){
234-
return this->e_dump->isChecked() && this->animate_timer->isActive();
234+
return this->e_dump->isChecked() && this->animateTimer->isActive();
235235
}
236236

237237
int Animate::nextFrame(){
238-
if (anim_dumping && anim_dump_start_step == anim_step) {
239-
anim_dumping = false;
238+
if (animDumping && animDumpStartStep == animStep) {
239+
animDumping = false;
240240
e_dump->setChecked(false);
241241
} else {
242-
if (!anim_dumping) {
243-
anim_dumping = true;
244-
anim_dump_start_step = anim_step;
242+
if (!animDumping) {
243+
animDumping = true;
244+
animDumpStartStep = animStep;
245245
}
246246
}
247-
return anim_step;
247+
return animStep;
248248
}
249249

250250
void Animate::resizeEvent(QResizeEvent *event)
@@ -272,44 +272,44 @@ void Animate::resizeEvent(QResizeEvent *event)
272272
}
273273

274274
const QList<QAction *>& Animate::actions(){
275-
return action_list;
275+
return actionList;
276276
}
277277

278278
void Animate::onActionEvent(InputEventAction *event)
279279
{
280280
const std::string actionString = event->action;
281281
const std::string actionName = actionString.substr(actionString.find("::") + 2, std::string::npos);
282-
for (auto action : action_list) {
282+
for (auto action : actionList) {
283283
if (actionName == action->objectName().toStdString()) {
284284
action->trigger();
285285
}
286286
}
287287
}
288288

289-
double Animate::getAnim_tval(){
290-
return anim_tval;
289+
double Animate::getAnimTval(){
290+
return animTVal;
291291
}
292292

293293
void Animate::on_pushButton_MoveToBeginning_clicked(){
294294
pauseAnimation();
295-
this->anim_step = 0;
295+
this->animStep = 0;
296296
this->updateTVal();
297297
}
298298

299299
void Animate::on_pushButton_StepBack_clicked(){
300300
pauseAnimation();
301-
this->anim_step -= 1;
301+
this->animStep -= 1;
302302
this->updateTVal();
303303
}
304304

305305
void Animate::on_pushButton_StepForward_clicked(){
306306
pauseAnimation();
307-
this->anim_step += 1;
307+
this->animStep += 1;
308308
this->updateTVal();
309309
}
310310

311311
void Animate::on_pushButton_MoveToEnd_clicked(){
312312
pauseAnimation();
313-
this->anim_step = this->anim_numsteps - 1;
313+
this->animStep = this->animNumSteps - 1;
314314
this->updateTVal();
315315
}

src/gui/Animate.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class Animate : public QWidget, public Ui::AnimateWidget
3131
bool dumpPictures();
3232
int nextFrame();
3333

34-
QTimer *animate_timer;
34+
QTimer *animateTimer;
3535

3636
void setMainWindow(MainWindow *mainWindow);
3737

3838
const QList<QAction *>& actions();
39-
double getAnim_tval();
39+
double getAnimTval();
4040

4141
public slots:
4242
void animateUpdate();
@@ -60,22 +60,22 @@ public slots:
6060
void updatePauseButtonIcon();
6161
void connectAction(QAction *, QPushButton *);
6262

63-
double anim_tval;
64-
bool anim_dumping;
65-
int anim_dump_start_step;
66-
int anim_step;
67-
int anim_numsteps;
63+
double animTVal;
64+
bool animDumping;
65+
int animDumpStartStep;
66+
int animStep;
67+
int animNumSteps;
6868

69-
bool fps_ok;
70-
bool t_ok;
69+
bool fpsOK;
70+
bool tOK;
7171
bool steps_ok;
7272

7373
int initMinWidth;
7474

7575
QIcon iconRun;
7676
QIcon iconPause;
7777
QIcon iconDisabled;
78-
QList<QAction *> action_list;
78+
QList<QAction *> actionList;
7979
QColor errorBlendColor{"red"};
8080

8181
signals:

0 commit comments

Comments
 (0)