Skip to content

Commit e74eb7e

Browse files
committed
Codestyle fixes
1 parent 0a5b6dc commit e74eb7e

8 files changed

+119
-121
lines changed

Diff for: core/misescalcelast.cpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* misescalcelast.cpp
3-
* Copyright (C) 2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2018-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -26,25 +26,25 @@
2626
#endif
2727

2828
MisesCalcElast::MisesCalcElast()
29-
:iterations_(ZERO),
30-
startAngle_(ZERO),
31-
youngModule_(ZERO),
32-
trussLength_(ZERO),
33-
csArea_(ZERO),
34-
forceAngle_(ZERO),
35-
supportStfns_(ZERO),
36-
hwM_(ZERO),
37-
Afcal_(ZERO),
38-
tgA_(ZERO),
39-
tgB_(ZERO),
40-
sinA_(ZERO),
41-
cosA_(ZERO),
42-
scale_(ZERO),
43-
extremum_(QPointF()),
44-
curveFx_(QVector<QPointF>()),
45-
allkeM_(QVector<QPointF>()),
46-
extremums_(QVector<QPointF>()),
47-
angles_(QVector<QString>())
29+
:iterations_(ZERO),
30+
startAngle_(ZERO),
31+
youngModule_(ZERO),
32+
trussLength_(ZERO),
33+
csArea_(ZERO),
34+
forceAngle_(ZERO),
35+
supportStfns_(ZERO),
36+
hwM_(ZERO),
37+
Afcal_(ZERO),
38+
tgA_(ZERO),
39+
tgB_(ZERO),
40+
sinA_(ZERO),
41+
cosA_(ZERO),
42+
scale_(ZERO),
43+
extremum_(QPointF()),
44+
curveFx_(QVector<QPointF>()),
45+
allkeM_(QVector<QPointF>()),
46+
extremums_(QVector<QPointF>()),
47+
angles_(QVector<QString>())
4848
{
4949
}
5050

@@ -160,7 +160,7 @@ void MisesCalcElast::obtainForcesVectors(const double &angle)
160160
++i;
161161
}
162162
#ifdef IS_DEBUG
163-
qDebug() << allkeM_;
163+
qDebug() << allkeM_;
164164
#endif
165165
}
166166

Diff for: core/misescalcelast.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* misescalcelast.h
3-
* Copyright (C) 2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2018-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by

Diff for: core/misescalcnelast.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* misescalcnelast.cpp
3-
* Copyright (C) 2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2018-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -48,8 +48,8 @@ MisesCalcNonElast::MisesCalcNonElast():
4848
double MisesCalcNonElast::getForce(const double &value) const
4949
{
5050
const double A = fZeroCheck(csArea_) || fZeroCheck(youngModule_)
51-
? ZERO
52-
: value*trussLength_*supportStfns_/(youngModule_*csArea_);
51+
? ZERO
52+
: value*trussLength_*supportStfns_/(youngModule_*csArea_);
5353
const double var1 = fZeroCheck(tgA_) ? ZERO : 1.0/tgA_ - value;
5454
const double var12 = pow2(var1);
5555
const double var4 = 1.0-value*tgB_;
@@ -79,8 +79,8 @@ double MisesCalcNonElast::getDfDx(const double &value) const
7979
const double dC = (-1.0)/sqrt(var32+var22);
8080
const double dD = (-1.0)*var2*(-2*tgB_*var3-2*var2)/(2*sqrt(var5));
8181
const double dE = fZeroCheck(csArea_) || fZeroCheck(youngModule_)
82-
? ZERO
83-
: trussLength_*supportStfns_/(csArea_*youngModule_);
82+
? ZERO
83+
: trussLength_*supportStfns_/(csArea_*youngModule_);
8484
return dA+dB+dC+dD+dE + 2*sinA_;
8585
}
8686

Diff for: core/misescalcnelast.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* misescalcnelast.h
3-
* Copyright (C) 2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2018-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by

Diff for: defines.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define ORGANIZATION "thesomeprojects"
55
#define APPNAME "qmisestruss"
6-
#define APPVERISON "0.0.4"
6+
#define APPVERISON "0.0.5"
77

88
#define NumIter "ITERATIONS"
99
#define NumStartAngle "START_ANGLE"

Diff for: gui/mainwindow.cpp

+29-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* mainwindow.cpp
3-
* Copyright (C) 2015-2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2015-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -45,16 +45,16 @@
4545
#include <qwt_legend.h>
4646

4747
MainWindow::MainWindow(QWidget *parent) :
48-
QMainWindow(parent),
49-
ui(new Ui::MainWindow),
50-
misesNE_(MisesCalcNonElast::Ptr(new MisesCalcNonElast())),
51-
misesE_(MisesCalcElast::Ptr(new MisesCalcElast())),
52-
grid_(new QwtPlotGrid()),
53-
buffer_(QString()),
54-
lastDir_(QDir::home().absolutePath()),
55-
log_(QString()),
56-
popupMenu_(new QMenu(this)),
57-
copyAction_(new QAction(tr("&Copy Data"), popupMenu_))
48+
QMainWindow(parent),
49+
ui(new Ui::MainWindow),
50+
misesNE_(MisesCalcNonElast::Ptr(new MisesCalcNonElast())),
51+
misesE_(MisesCalcElast::Ptr(new MisesCalcElast())),
52+
grid_(new QwtPlotGrid()),
53+
buffer_(QString()),
54+
lastDir_(QDir::home().absolutePath()),
55+
log_(QString()),
56+
popupMenu_(new QMenu(this)),
57+
copyAction_(new QAction(tr("&Copy Data"), popupMenu_))
5858
{
5959
ui->setupUi(this);
6060
QSettings settings(this);
@@ -207,11 +207,11 @@ void MainWindow::onExit()
207207
void MainWindow::onAbout()
208208
{
209209
const QString message(tr("<!DOCTYPE html><html><body>"
210-
"<p><b>Calculation of von Mises truss parameters</b></p>"
211-
"<p>Written using Qt</p>"
212-
"<p>2015-2018 (c) Vitaly Tonkacheyev <address><a href=\"mailto:[email protected]\">&lt;EMail&gt;</a></address></p>"
213-
"<a href=\"http://sites.google.com/site/thesomeprojects/\">Program WebSite</a>"
214-
"<p>version: <b>%1</b></p></body></html>").arg(APPVERISON));
210+
"<p><b>Calculation of von Mises truss parameters</b></p>"
211+
"<p>Written using Qt</p>"
212+
"<p>2015-2019 (c) Vitaly Tonkacheyev <address><a href=\"mailto:[email protected]\">&lt;EMail&gt;</a></address></p>"
213+
"<a href=\"http://sites.google.com/site/thesomeprojects/\">Program WebSite</a>"
214+
"<p>version: <b>%1</b></p></body></html>").arg(APPVERISON));
215215
const QString appLogo = ":/icons/f(x)48.png";
216216
QMessageBox about;
217217
about.setIconPixmap(QPixmap(appLogo));
@@ -281,11 +281,11 @@ void MainWindow::calculate()
281281
ui->progressBar->setValue(index+1);
282282
}
283283
log_ = tr("Number of items in curve: %1\n").arg(QString::number(curveFx_.count()))
284-
+tr("Number of iderivatives: %1\n").arg(QString::number(curvedFx_.count()))
285-
+tr("Number of KeM: %1\n").arg(QString::number(kems.count()))
286-
+tr("Number of item in elastic calculation: %1\n").arg(QString::number(elastCurve.count()))
287-
+tr("GCS Plot Scale: %1\n").arg(QString::number(misesNE_->scale()))
288-
+tr("S. Bilyk Plot Scale: %1\n").arg(QString::number(misesE_->scale()));
284+
+tr("Number of iderivatives: %1\n").arg(QString::number(curvedFx_.count()))
285+
+tr("Number of KeM: %1\n").arg(QString::number(kems.count()))
286+
+tr("Number of item in elastic calculation: %1\n").arg(QString::number(elastCurve.count()))
287+
+tr("GCS Plot Scale: %1\n").arg(QString::number(misesNE_->scale()))
288+
+tr("S. Bilyk Plot Scale: %1\n").arg(QString::number(misesE_->scale()));
289289

290290
ui->cLog->setText(log_);
291291
ui->tableWidget->setColumnWidth(0, 150);
@@ -452,10 +452,9 @@ void MainWindow::copyToClipboard()
452452

453453
void MainWindow::saveSelection()
454454
{
455-
QStringList lines;
456-
lines << QString("%1\t%2\t%3\n").arg("alpha_0")
457-
.arg(ui->extremums->horizontalHeaderItem(1)->text())
458-
.arg(ui->extremums->horizontalHeaderItem(2)->text());
455+
QStringList lines({QString("%1\t%2\t%3\n").arg("alpha_0")
456+
.arg(ui->extremums->horizontalHeaderItem(1)->text())
457+
.arg(ui->extremums->horizontalHeaderItem(2)->text())});
459458
for (int row =0; row < ui->extremums->rowCount(); ++row) {
460459
QStringList line;
461460
for (int column = 0; column < ui->extremums->columnCount(); ++column) {
@@ -465,11 +464,11 @@ void MainWindow::saveSelection()
465464
}
466465
QString result = lines.join("");
467466
QString filename = QFileDialog::getSaveFileName(this,
468-
tr("Save file"),
469-
lastDir_,
470-
tr("CSV Table (*.csv)"),
471-
nullptr,
472-
nullptr);
467+
tr("Save file"),
468+
lastDir_,
469+
tr("CSV Table (*.csv)"),
470+
nullptr,
471+
nullptr);
473472
if (!filename.isEmpty()) {
474473
int dotIndex = filename.lastIndexOf(".");
475474
if (dotIndex < 0) {

Diff for: gui/mainwindow.h

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* mainwindow.h
3-
* Copyright (C) 2015-2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2015-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -34,67 +34,67 @@ class MainWindow;
3434

3535
class MainWindow : public QMainWindow
3636
{
37-
Q_OBJECT
37+
Q_OBJECT
3838

3939
public:
4040
explicit MainWindow(QWidget *parent = nullptr);
41-
~MainWindow();
41+
~MainWindow();
4242

4343
protected slots:
44-
//DoubleSpinbox slots
45-
void startAnlgeChanged(const double &value);
46-
void youngModuleChanged(const double &value);
47-
void trussLengthChanged(const double &value);
48-
void csAreaChnged(const double &value);
49-
void forceAngleChanged(const double &value);
50-
void supportStfnsChanged(const double &value);
51-
void iterationChanged(const double &value);
44+
//DoubleSpinbox slots
45+
void startAnlgeChanged(const double &value);
46+
void youngModuleChanged(const double &value);
47+
void trussLengthChanged(const double &value);
48+
void csAreaChnged(const double &value);
49+
void forceAngleChanged(const double &value);
50+
void supportStfnsChanged(const double &value);
51+
void iterationChanged(const double &value);
5252
void hwChanged(const double &value);
5353
void AfcalChanged(const double &value);
54-
//Buttons
55-
void onCountBtn();
56-
void onCountExtremums();
57-
void onSaveBtn();
54+
//Buttons
55+
void onCountBtn();
56+
void onCountExtremums();
57+
void onSaveBtn();
5858
void calculateKv();
5959
void onPlus();
6060
void onSubst();
61-
//Table1
62-
void onTableSelectionChanged();
63-
void onPopup(const QPoint& point);
64-
void onCopy(bool);
65-
//TabWidget
66-
void onTabChanged(int index);
67-
//Menu
68-
void onExit();
69-
void onAbout();
61+
//Table1
62+
void onTableSelectionChanged();
63+
void onPopup(const QPoint& point);
64+
void onCopy(bool);
65+
//TabWidget
66+
void onTabChanged(int index);
67+
//Menu
68+
void onExit();
69+
void onAbout();
7070

7171
protected:
72-
void closeEvent(QCloseEvent *e);
72+
void closeEvent(QCloseEvent *e);
7373

7474
private:
75-
void calculate();
76-
void calculateExtremums();
77-
void checkVars();
78-
void keyPressEvent(QKeyEvent * event);
79-
void copyToClipboard();
80-
void saveSelection();
81-
void saveSettings();
75+
void calculate();
76+
void calculateExtremums();
77+
void checkVars();
78+
void keyPressEvent(QKeyEvent * event);
79+
void copyToClipboard();
80+
void saveSelection();
81+
void saveSettings();
8282
void showDoneDialog(const QString &text);
8383
bool fZeroCheck(const double &a) const { return (qAbs(a-ZERO) < EPSILON_);}
8484
double TextToDouble(const QString &text) const;
8585
QString DoubleToText(const double &value, const int &size) const;
8686
void enableButtons(bool enabled);
8787

8888
private:
89-
Ui::MainWindow *ui;
89+
Ui::MainWindow *ui;
9090
MisesCalcNonElast::Ptr misesNE_;
9191
MisesCalcElast::Ptr misesE_;
92-
QSharedPointer<QwtPlotGrid> grid_;
93-
QString buffer_;
94-
QString lastDir_;
92+
QSharedPointer<QwtPlotGrid> grid_;
93+
QString buffer_;
94+
QString lastDir_;
9595
QString log_;
96-
QMenu *popupMenu_;
97-
QAction *copyAction_;
96+
QMenu *popupMenu_;
97+
QAction *copyAction_;
9898
};
9999

100100
#endif // MAINWINDOW_H

Diff for: main.cpp

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* main.cpp
3-
* Copyright (C) 2015-2018 Vitaly Tonkacheyev
3+
* Copyright (C) 2015-2019 Vitaly Tonkacheyev
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -23,28 +23,27 @@
2323

2424
int main(int argc, char *argv[])
2525
{
26-
QApplication a(argc, argv);
27-
a.setOrganizationName(QString(ORGANIZATION));
28-
a.setApplicationName(QString(APPNAME));
29-
a.setApplicationVersion(QString(APPVERISON));
30-
QTranslator translator;
31-
const QStringList localeDirs = QStringList()
32-
<< qApp->applicationDirPath()
33-
<< QString("%1/langs").arg(QDir::currentPath())
34-
<< QString("%1/langs").arg(qApp->applicationDirPath())
35-
<< QString("../share/%1/langs").arg(APPNAME)
36-
<< QString("/usr/share/%1/langs").arg(QString(APPNAME))
37-
<< QString("/usr/local/share/%1/langs").arg(QString(APPNAME))
38-
<< QString("%1/.local/share/%2/langs").arg(QDir::home().absolutePath(),QString(APPNAME));
39-
const QString langFile(APPNAME);
40-
foreach(const QString &dir, localeDirs){
41-
if (translator.load(QLocale::system(),langFile, "_", dir )) {
42-
qApp->installTranslator(&translator);
43-
break;
44-
}
45-
}
46-
MainWindow w;
47-
w.show();
26+
QApplication a(argc, argv);
27+
a.setOrganizationName(QString(ORGANIZATION));
28+
a.setApplicationName(QString(APPNAME));
29+
a.setApplicationVersion(QString(APPVERISON));
30+
QTranslator translator;
31+
const QStringList localeDirs({qApp->applicationDirPath(),
32+
QString("%1/langs").arg(QDir::currentPath()),
33+
QString("%1/langs").arg(qApp->applicationDirPath()),
34+
QString("../share/%1/langs").arg(APPNAME),
35+
QString("/usr/share/%1/langs").arg(QString(APPNAME)),
36+
QString("/usr/local/share/%1/langs").arg(QString(APPNAME)),
37+
QString("%1/.local/share/%2/langs").arg(QDir::home().absolutePath(),QString(APPNAME))});
38+
const QString langFile(APPNAME);
39+
foreach(const QString &dir, localeDirs){
40+
if (translator.load(QLocale::system(),langFile, "_", dir )) {
41+
qApp->installTranslator(&translator);
42+
break;
43+
}
44+
}
45+
MainWindow w;
46+
w.show();
4847

49-
return a.exec();
48+
return a.exec();
5049
}

0 commit comments

Comments
 (0)