combine setActive and rideSelected

And pay attention to MainWindow::activeTab, such that only the active
tab redraws itself when changing rides.  This change really increases
GC's responsiveness when scrolling through the ride list.
This commit is contained in:
Sean Rhea
2010-03-11 09:24:02 -05:00
parent a95f374195
commit ac0876ac3c
17 changed files with 54 additions and 45 deletions

View File

@@ -46,7 +46,7 @@ ModelWindow::addStandardChannels(QComboBox *box)
}
ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
QWidget(parent), home(home), main(parent), active(false), ride(NULL)
QWidget(parent), home(home), main(parent), ride(NULL)
{
// Layouts
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -165,7 +165,7 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
// now connect up the widgets
connect(main, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
connect(main, SIGNAL(intervalSelected()), this, SLOT(rideSelected()));
connect(main, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
connect(presetValues, SIGNAL(currentIndexChanged(int)), this, SLOT(applyPreset(int)));
connect(xSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
connect(ySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
@@ -182,17 +182,13 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
connect(zpane, SIGNAL(valueChanged(int)), this, SLOT(setZPane(int)));
}
void
ModelWindow::setActive(bool active)
{
this->active = active;
if (active) setData(true);
}
void
ModelWindow::rideSelected()
{
if (main->activeTab() != this)
return;
ride = main->rideItem();
if (active) setData(true);
setData(true);
}
void
@@ -227,6 +223,8 @@ ModelWindow::setZPane(int z)
void
ModelWindow::intervalSelected()
{
if (main->activeTab() != this)
return;
setData(false);
}