23 #include <QtCore/QRegExp>
31 #if QT_VERSION >= 0x050000
32 # include <QtWidgets/QAction>
33 # include <QtWidgets/QBoxLayout>
34 # include <QtWidgets/QLabel>
35 # include <QtWidgets/QMenu>
36 # include <QtWidgets/QMessageBox>
37 # include <QtWidgets/QPushButton>
38 # include <QtWidgets/QShortcut>
40 # include <QtGui/QAction>
41 # include <QtGui/QBoxLayout>
42 # include <QtGui/QLabel>
43 # include <QtGui/QMenu>
44 # include <QtGui/QMessageBox>
45 # include <QtGui/QPushButton>
46 # include <QtGui/QShortcut>
62 QBoxLayout *layout =
new QVBoxLayout(
this);
68 QBrush userRecordBrushF(QBrush(QColor(30, 90, 255)));
69 QBrush operatorRecordBrushF(QBrush(QColor(214, 61, 210)));
71 QRegExp reUserComment(
"^\\w{2}>(.+)", Qt::CaseInsensitive);
72 QRegExp reOperatorComment(
"readLogFile: station ([\\w\\s-+_]{1,8}): "
73 "\\d{4}/\\d{2}/\\d{2}\\s+(.+)", Qt::CaseInsensitive);
76 QStringList headerLabels;
83 for (
int i=0; i<
history_->size(); i++)
90 item->setData(0, Qt::TextAlignmentRole, Qt::AlignRight);
91 item->setData(0, Qt::UserRole, i);
92 item->setText(1, str.sprintf(
"%3d", rec->
getVersion()));
93 item->setData(1, Qt::TextAlignmentRole, Qt::AlignRight);
94 item->setText(2, rec->
getText());
95 item->setData(2, Qt::TextAlignmentRole, Qt::AlignLeft);
96 if (reUserComment.indexIn(rec->
getText()) != -1)
98 QFont fnt=item->font(2);
100 item->setFont(2, fnt);
101 item->setForeground(2, userRecordBrushF);
103 else if (reOperatorComment.indexIn(rec->
getText()) != -1)
105 QFont fnt=item->font(2);
107 item->setFont(2, fnt);
108 item->setForeground(2, operatorRecordBrushF);
112 twHistory_->header()->resizeSections(QHeaderView::ResizeToContents);
113 #if QT_VERSION >= 0x050000
114 twHistory_->header()->setSectionResizeMode(QHeaderView::Interactive);
116 twHistory_->header()->setResizeMode(QHeaderView::Interactive);
118 twHistory_->header()->setStretchLastSection(
true);
128 QBoxLayout *hLayout =
new QHBoxLayout();
129 layout->addLayout(hLayout);
132 QLabel *label =
new QLabel(
"&Add a record:",
this);
134 label->setMinimumSize(label->sizeHint());
138 hLayout->addWidget(label);
141 QPushButton *button =
new QPushButton(
"Submit",
this);
142 button->setMinimumSize(button->sizeHint());
143 button->setDefault(
true);
144 hLayout->addWidget(button);
148 QShortcut *shCut=
new QShortcut(QKeySequence(QKeySequence::Delete),
this);
149 connect(shCut, SIGNAL(activated()),
this, SLOT(
delHistoryLine()));
157 QBrush newRecordBrush(Qt::blue);
160 if (text.simplified() !=
"")
162 int version=
history_->last()->getVersion();
168 if (0<idx && !
history_->at(idx-1)->getIsEditable())
172 item->setData(0, Qt::TextAlignmentRole, Qt::AlignRight);
173 item->setData(0, Qt::ForegroundRole, newRecordBrush);
174 item->setData(0, Qt::UserRole, idx);
176 item->setText(1, str.sprintf(
"%3d", rec->
getVersion()));
177 item->setData(1, Qt::TextAlignmentRole, Qt::AlignRight);
178 item->setData(1, Qt::ForegroundRole, newRecordBrush);
179 item->setText(2, rec->
getText());
180 item->setData(2, Qt::TextAlignmentRole, Qt::AlignLeft);
181 item->setData(2, Qt::ForegroundRole, newRecordBrush);
197 int idx=item->data(0, Qt::UserRole).toInt(&isOk);
203 if (QMessageBox::warning(
this,
"Warning",
204 "Are you sure to delete the history record?\nThe record was issued on " +
206 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
209 ": delHistoryLine(): the history record \"" + rec->
getText() +
"\" sunk into oblivion");
214 else if (!
history_->at(idx-1)->getIsEditable())
216 if (idx<history_->size()-1)
229 it->setData(0, Qt::UserRole, idx++);
virtual QString className() const
SgGuiVlbiHistory(SgVlbiHistory *, QWidget *=0, Qt::WindowFlags=0)
virtual void write(LogLevel, quint32, const QString &, bool=false)
@ F_YYYYMMDDHHMMSSSS
Long verbose: Fri, the 2nd of Apr, 2010; 17hr 02min 43.6400sec.
QString toString(Format format=F_Verbose) const
static SgMJD currentMJD()
bool getIsEditable() const
const SgMJD & getEpoch() const
const QString & getText() const
void setFirstRecordFromUser(const QString &)