TuiNodeDateTime.cpp   TuiNodeDateTime.cpp 
skipping to change at line 16 skipping to change at line 16
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "TuiNodeDateTime.hpp" #include "TuiNodeDateTime.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTranslator.hpp"
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
TuiNodeDateTime::TuiNodeDateTime(const QString& text, QObject* receiver, co nst char* method, double defValue, TuiNode* parent, TuiNode* prev) TuiNodeDateTime::TuiNodeDateTime(const QString& text, QObject* receiver, co nst char* method, double defValue, TuiNode* parent, TuiNode* prev)
: TuiNodeEditable(text, parent, prev), value(defValue), editingPart( 0), typing(false) : TuiNodeEditable(text, parent, prev), value(defValue), editingPart( 0), typing(false)
{ {
this->connect(this, SIGNAL(setValue(double)), receiver, method); this->connect(this, SIGNAL(setValue(double)), receiver, method);
} }
skipping to change at line 121 skipping to change at line 122
emit(setValue(value)); emit(setValue(value));
} }
return response; return response;
} }
return response; return response;
} }
QString TuiNodeDateTime::getDisplayText() QString TuiNodeDateTime::getDisplayText()
{ {
QList<int> parts = getParts(value); QList<int> parts = getParts(value);
if (editing && editingPart==0) QString yy = QString("%1").arg(parts.at(0));
return displayText + QString(": >%1<-%2-%3 %4:%5:%6 UTC").a QString mm = QString("%1").arg(parts.at(1), 2, 10, QChar('0'));
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, QString dd = QString("%1").arg(parts.at(2), 2, 10, QChar('0'));
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC QString h = QString("%1").arg(parts.at(3), 2, 10, QChar('0'));
har('0')).arg(parts.at(5), 2, 10, QChar('0')); QString m = QString("%1").arg(parts.at(4), 2, 10, QChar('0'));
else if (editing && editingPart==1) QString s = QString("%1").arg(parts.at(5), 2, 10, QChar('0'));
return displayText + QString(": %1->%2<-%3 %4:%5:%6 UTC").a
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, //(Default format string when not editing anything)
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC const char* formatString = ": %1-%2-%3 %4:%5:%6 UTC";
har('0')).arg(parts.at(5), 2, 10, QChar('0')); if (editing)
else if (editing && editingPart==2) {
return displayText + QString(": %1-%2->%3< %4:%5:%6 UTC").a switch (editingPart)
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, {
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC case 0:
har('0')).arg(parts.at(5), 2, 10, QChar('0')); formatString = ": >%1<-%2-%3 %4:%5:%6 UTC"; //Year
else if (editing && editingPart==3) break;
return displayText + QString(": %1-%2-%3 >%4<:%5:%6 UTC").a case 1:
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, formatString = ": %1->%2<-%3 %4:%5:%6 UTC"; //Month
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC break;
har('0')).arg(parts.at(5), 2, 10, QChar('0')); case 2:
else if (editing && editingPart==4) formatString = ": %1-%2->%3< %4:%5:%6 UTC"; //Day
return displayText + QString(": %1-%2-%3 %4:>%5<:%6 UTC").a break;
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, case 3:
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC formatString = ": %1-%2-%3 >%4<:%5:%6 UTC"; //Hour
har('0')).arg(parts.at(5), 2, 10, QChar('0')); break;
else if (editing && editingPart==5) case 4:
return displayText + QString(": %1-%2-%3 %4:%5:>%6< UTC").a formatString = ": %1-%2-%3 %4:>%5<:%6 UTC"; //Minut
rg(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, e
QChar('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QC break;
har('0')).arg(parts.at(5), 2, 10, QChar('0')); case 5:
else formatString = ": %1-%2-%3 %4:%5:>%6< UTC"; //Secon
return displayText + QString(": %1-%2-%3 %4:%5:%6 UTC").arg d
(parts.at(0)).arg(parts.at(1), 2, 10, QChar('0')).arg(parts.at(2), 2, 10, Q default:
Char('0')).arg(parts.at(3), 2, 10, QChar('0')).arg(parts.at(4), 2, 10, QCha break;
r('0')).arg(parts.at(5), 2, 10, QChar('0')); }
}
QString result = prefixText + q_(displayText) + QString (formatStrin
g).arg(yy, mm, dd, h, m, s);
return result;
} }
void TuiNodeDateTime::incPart(int part, bool add) void TuiNodeDateTime::incPart(int part, bool add)
{ {
Q_UNUSED(part); Q_UNUSED(part);
int diff = 1; int diff = 1;
if (!add) if (!add)
diff *= -1; diff *= -1;
QList<int> parts = getParts(value); QList<int> parts = getParts(value);
 End of changes. 3 change blocks. 
36 lines changed or deleted 42 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/