Skip to content

Instantly share code, notes, and snippets.

@ihewitt
Created February 18, 2016 23:57
Show Gist options
  • Save ihewitt/d958bf846758201e8357 to your computer and use it in GitHub Desktop.
Save ihewitt/d958bf846758201e8357 to your computer and use it in GitHub Desktop.
diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp
index 6844cd0..92dd9ef 100644
--- a/src/AllPlot.cpp
+++ b/src/AllPlot.cpp
@@ -7012,31 +7012,6 @@ AllPlot::intervalHover(IntervalItem *chosen)
replot();
}
-void
-AllPlot::nextStep( int& step )
-{
- if( step < 50 )
- {
- step += 10;
- }
- else if( step == 50 )
- {
- step = 100;
- }
- else if( step >= 100 && step < 1000 )
- {
- step += 100;
- }
- else if( step >= 1000 && step < 5000)
- {
- step += 500;
- }
- else
- {
- step += 1000;
- }
-}
-
bool
AllPlot::eventFilter(QObject *obj, QEvent *event)
{
diff --git a/src/AllPlot.h b/src/AllPlot.h
index 910e8a0..d5ec04c 100644
--- a/src/AllPlot.h
+++ b/src/AllPlot.h
@@ -731,7 +731,27 @@ class AllPlot : public QwtPlot
QFont labelFont;
void setAltSlopePlotStyle (AllPlotSlopeCurve *curve);
- static void nextStep( int& step );
+ static inline void nextStep( int& step ) {
+ if (step >= 5000)
+ {
+ step += 1000;
+ } else if( step < 50 )
+ {
+ step += 10;
+ }
+ else if( step == 50 )
+ {
+ step = 100;
+ }
+ else if( step >= 100 && step < 1000 )
+ {
+ step += 100;
+ }
+ else //if( step >= 1000 && step < 5000)
+ {
+ step += 500;
+ }
+ }
};
diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp
index 45d4188..b698092 100644
--- a/src/HomeWindow.cpp
+++ b/src/HomeWindow.cpp
@@ -1136,8 +1136,8 @@ GcWindowDialog::exec()
// is easier to follow and modify... for now.
static QString xmlprotect(QString string)
{
- QTextEdit trademark("&#8482;"); // process html encoding of(TM)
- QString tm = trademark.toPlainText();
+ // get local TM character code
+ static QString tm = QTextEdit("&#8482;").toPlainText();
QString s = string;
s.replace( tm, "&#8482;" );
@@ -1152,8 +1152,7 @@ static QString xmlprotect(QString string)
static QString unprotect(QString buffer)
{
// get local TM character code
- QTextEdit trademark("&#8482;"); // process html encoding of(TM)
- QString tm = trademark.toPlainText();
+ static QString tm = QTextEdit("&#8482;").toPlainText();
// remove quotes
QString s = buffer.trimmed();
diff --git a/src/SpecialFields.cpp b/src/SpecialFields.cpp
index 33aa12e..30a461d 100644
--- a/src/SpecialFields.cpp
+++ b/src/SpecialFields.cpp
@@ -63,10 +63,14 @@ SpecialFields::SpecialFields()
// now add all the metric fields (for metric overrides)
const RideMetricFactory &factory = RideMetricFactory::instance();
+
+ QTextEdit processHTML;
+ QTextEdit processHTMLinternal;
+
for (int i=0; i<factory.metricCount(); i++) {
const RideMetric *add = factory.rideMetric(factory.metricName(i));
- QTextEdit processHTML(add->name());
- QTextEdit processHTMLinternal(add->internalName());
+ processHTML.setText(add->name());
+ processHTMLinternal.setText(add->internalName());
// add->internalName() used for compatibility win metadata.xml, could be replaced by factory.metricName(i) or add->symbol()
namesmap.insert(processHTMLinternal.toPlainText(), processHTML.toPlainText());
metricmap.insert(processHTMLinternal.toPlainText(), add);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment