Skip to content

Commit

Permalink
TableView3D: Rapid/holddown keypresses on 3d table now act appropriatly
Browse files Browse the repository at this point in the history
A key-holddown will now send 3 updates per second, and one final updates
once the key is released. This gives the UI a fluid feel of scrolling, while
not slamming on the COM link. This does mean that the UI is technically out
of sync with the ECU for 1/3 of a second, but that is acceptable to retain a
good UI experience
  • Loading branch information
malcom2073 committed Aug 1, 2014
1 parent e887ab1 commit 93f078d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions core/src/tableview3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ TableView3D::TableView3D(QWidget *parent)
}
void TableView3D::inputTimerTimeout()
{
setRange(m_queuedValList);
if (!m_firstKeypress)
{
setRange(m_queuedValList);
}
m_inputTimer->stop();
}

Expand Down Expand Up @@ -324,12 +327,14 @@ void TableView3D::hotKeyPressed(int key,Qt::KeyboardModifier modifier)
//Timer is already active, too soon!
//Let the table continue to increment... but don't fire off
m_queuedValList = vallist;
m_inputTimer->stop();
m_inputTimer->start(250);
m_firstKeypress = false;
//m_inputTimer->stop();
//m_inputTimer->start(250);
}
else
{
m_inputTimer->start(250);
m_firstKeypress = true;
m_inputTimer->start(350);
setRange(vallist);
}
}
Expand Down Expand Up @@ -412,11 +417,13 @@ void TableView3D::hotKeyPressed(int key,Qt::KeyboardModifier modifier)
//Timer is already active, too soon!
//Let the table continue to increment... but don't fire off
m_queuedValList = vallist;
m_inputTimer->stop();
m_inputTimer->start(250);
m_firstKeypress = false;
//m_inputTimer->stop();
//m_inputTimer->start(250);
}
else
{
m_firstKeypress = true;
m_inputTimer->start(250);
setRange(vallist);
}
Expand Down
1 change: 1 addition & 0 deletions core/src/tableview3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class TableView3D : public DataView
bool setData(QString name,DataBlock *data);
void passDatalog(QVariantMap data);
private:
bool m_firstKeypress;
QTimer *m_inputTimer;
void reColorTable(int rownum,int colnum);
QList<QPair<int,int> > m_highlightItemList;
Expand Down

0 comments on commit 93f078d

Please sign in to comment.