Skip to content

Commit

Permalink
Fix initial enabling of widgets in vector dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
netterfield committed Jan 5, 2014
1 parent 099413d commit f43f356
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
13 changes: 10 additions & 3 deletions src/libkstapp/vectordialog.cpp
Expand Up @@ -32,7 +32,7 @@
namespace Kst {

VectorTab::VectorTab(ObjectStore *store, QWidget *parent)
: DataTab(parent), validating(false), _mode(DataVector), _store(store), _initField(QString()), _requestID(0) {
: DataTab(parent), validating(false), _mode(DataVector), _store(store), _initField(QString()), _requestID(0), _valid(false) {

setupUi(this);
setTabTitle(tr("Vector"));
Expand Down Expand Up @@ -76,7 +76,7 @@ VectorTab::~VectorTab() {
void VectorTab::updateUpdateBox()
{
if (_dataSource) {
_updateBox->setEnabled(true);
_updateBox->setEnabled(_mode == DataVector);
switch (_dataSource->updateType()) {
case DataSource::Timer: _updateBox->setCurrentIndex(0); break;
case DataSource::File: _updateBox->setCurrentIndex(1); break;
Expand Down Expand Up @@ -119,6 +119,9 @@ void VectorTab::setVectorMode(VectorMode mode) {
_dataVectorGroup->setChecked(true);
_dataRange->setEnabled(true);
_generatedVectorGroup->setChecked(false);
_field->setEnabled(_valid);
_configure->setEnabled(_valid);
updateUpdateBox();
} else {
_generatedVectorGroup->setChecked(true);
_dataVectorGroup->setChecked(false);
Expand Down Expand Up @@ -261,6 +264,7 @@ void VectorTab::sourceValid(QString filename, int requestID) {
if (_requestID != requestID) {
return;
}
_valid = true;
_dataSource = DataSourcePluginManager::findOrLoadSource(_store, filename);
_field->setEnabled(true);

Expand All @@ -271,7 +275,7 @@ void VectorTab::sourceValid(QString filename, int requestID) {
setField(_initField);
}
_field->setEditable(!_dataSource->vector().isListComplete());
_configure->setEnabled(_dataSource->hasConfigWidget());
_configure->setEnabled(_dataSource->hasConfigWidget() && (_mode == DataVector));

updateUpdateBox();
updateIndexList(_dataSource);
Expand All @@ -282,6 +286,7 @@ void VectorTab::sourceValid(QString filename, int requestID) {
validating = false;

_store->cleanUpDataSourceList();
_field->setEnabled(_mode == DataVector);

emit sourceChanged();
}
Expand All @@ -291,6 +296,8 @@ void VectorTab::fileNameChanged(const QString &file) {
_field->clear();
_field->setEnabled(false);
_configure->setEnabled(false);
_valid = false;

clearIndexList();
emit sourceChanged();

Expand Down
1 change: 1 addition & 0 deletions src/libkstapp/vectordialog.h
Expand Up @@ -97,6 +97,7 @@ class VectorTab : public DataTab, Ui::VectorTab {
QString _initField;
int _requestID;
void updateUpdateBox();
bool _valid;
};

class VectorDialog : public DataDialog {
Expand Down
10 changes: 3 additions & 7 deletions src/libkstapp/vectortab.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>743</width>
<height>550</height>
<width>741</width>
<height>548</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -191,11 +191,7 @@
</widget>
</item>
<item>
<widget class="Kst::ComboBox" name="_field">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="Kst::ComboBox" name="_field"/>
</item>
<item>
<layout class="QHBoxLayout">
Expand Down

0 comments on commit f43f356

Please sign in to comment.