Skip to content

Commit

Permalink
Added shortcut to enable the advanced features - Raw Output and V800 …
Browse files Browse the repository at this point in the history
…FS Browser
  • Loading branch information
Christian Weber authored and Christian Weber committed Aug 13, 2014
1 parent 4a6d035 commit 1880dae
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 31 deletions.
34 changes: 22 additions & 12 deletions src/ui/v800main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>386</height>
<width>599</width>
<height>494</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -16,6 +16,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>-1</number>
</property>
<item>
<widget class="QTreeWidget" name="exerciseTree">
<column>
Expand All @@ -27,15 +30,12 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="rawChk">
<property name="text">
<string>Include
Raw
Output</string>
</property>
</widget>
</item>
<property name="spacing">
<number>-1</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QPushButton" name="downloadBtn">
<property name="text">
Expand All @@ -58,13 +58,23 @@ Sessions</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="rawChk">
<property name="text">
<string>Include
Raw
Output</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fsBtn">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="text">
<string>Browse V800...</string>
<string>Browse
V800...</string>
</property>
</widget>
</item>
Expand Down
41 changes: 22 additions & 19 deletions src/usb/v800usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,35 @@ void V800usb::get_all_sessions()
for(dates_iter = 0; dates_iter < dates.length(); dates_iter++)
{
times.clear();
times = get_v800_data(QString(tr("%1/%2E/")).arg(tr(V800_ROOT_DIR)).arg(dates[dates_iter]));

for(times_iter = 0; times_iter < times.length(); times_iter++)
if(dates[dates_iter].contains(tr("/")))
{
files.clear();
files = get_v800_data(QString(tr("%1/%2/E/%3/00/")).arg(tr(V800_ROOT_DIR)).arg(dates[dates_iter]).arg(times[times_iter]));
times = get_v800_data(QString(tr("%1/%2E/")).arg(tr(V800_ROOT_DIR)).arg(dates[dates_iter]));

for(files_iter = 0; files_iter < files.length(); files_iter++)
for(times_iter = 0; times_iter < times.length(); times_iter++)
{
if(QString(files[files_iter]).compare(tr("ROUTE.GZB")) == 0)
files.clear();
files = get_v800_data(QString(tr("%1/%2/E/%3/00/")).arg(tr(V800_ROOT_DIR)).arg(dates[dates_iter]).arg(times[times_iter]));

for(files_iter = 0; files_iter < files.length(); files_iter++)
{
session_exists = true;
break;
if(QString(files[files_iter]).compare(tr("ROUTE.GZB")) == 0)
{
session_exists = true;
break;
}
}
}

if(session_exists)
{
QString date(dates[dates_iter]);
QString time(times[times_iter]);
if(session_exists)
{
QString date(dates[dates_iter]);
QString time(times[times_iter]);

QString combined((QString(tr("%1%2")).arg(date).arg(time)));
QDateTime session_time = QDateTime::fromString(combined, tr("yyyyMMdd/HHmmss/"));
QString combined((QString(tr("%1%2")).arg(date).arg(time)));
QDateTime session_time = QDateTime::fromString(combined, tr("yyyyMMdd/HHmmss/"));

sessions.append(session_time.toString(Qt::TextDate));
session_exists = false;
sessions.append(session_time.toString(Qt::TextDate));
session_exists = false;
}
}
}
}
Expand Down Expand Up @@ -267,7 +270,7 @@ QList<QString> V800usb::get_v800_data(QString request, bool debug)
}
else
{
qDebug("Unknown file type!");
qDebug("Unknown file type! -> %s", request.toUtf8().constData());
}
}
else
Expand Down
23 changes: 23 additions & 0 deletions src/widgets/v800main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ V800Main::V800Main(QWidget *parent) :

connect(this, SIGNAL(get_sessions(QList<QString>, QString, bool)), usb, SLOT(get_sessions(QList<QString>, QString, bool)));

new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_A), this, SLOT(handle_advanced_shortcut()));

connect(usb_thread, SIGNAL(started()), usb, SLOT(start()));
usb_thread->start();

ui->setupUi(this);
ui->verticalLayout->setAlignment(Qt::AlignTop);
ui->verticalLayout->setSpacing(20);
ui->exerciseTree->setColumnCount(1);
ui->exerciseTree->setHeaderLabel(tr("Session"));

ui->fsBtn->setVisible(false);
ui->rawChk->setVisible(false);

disable_all();
this->show();

Expand Down Expand Up @@ -96,6 +103,21 @@ void V800Main::handle_sessions_done()
enable_all();
}

void V800Main::handle_advanced_shortcut()
{
if(ui->fsBtn->isVisible())
ui->fsBtn->setVisible(false);
else
ui->fsBtn->setVisible(true);

if(ui->rawChk->isVisible())
ui->rawChk->setVisible(false);
else
ui->rawChk->setVisible(true);

qDebug("Do advanced stuff");
}

void V800Main::enable_all()
{
ui->exerciseTree->setEnabled(true);
Expand Down Expand Up @@ -171,5 +193,6 @@ void V800Main::on_uncheckBtn_clicked()
void V800Main::on_fsBtn_clicked()
{
V800fs *fs = new V800fs(usb);
fs->setWindowModality(Qt::WindowModal);
fs->show();
}
1 change: 1 addition & 0 deletions src/widgets/v800main.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private slots:
void handle_all_sessions(QList<QString> sessions);
void handle_session_done();
void handle_sessions_done();
void handle_advanced_shortcut();

void on_downloadBtn_clicked();
void on_checkBtn_clicked();
Expand Down

0 comments on commit 1880dae

Please sign in to comment.