[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] src/kdefrontend/datasources: check ok button when import preview is refreshed (data source
From: Stefan Gerlach <null () kde ! org>
Date: 2018-07-01 7:34:44
Message-ID: E1fZWse-00026z-3M () code ! kde ! org
[Download RAW message or body]
Git commit ead1126415e329fb2c678b7cff2b2c4b2f2290a4 by Stefan Gerlach.
Committed on 01/07/2018 at 06:18.
Pushed by sgerlach into branch 'master'.
check ok button when import preview is refreshed (data source may be available now)
M +2 -4 src/kdefrontend/datasources/ImportFileDialog.cpp
M +6 -3 src/kdefrontend/datasources/ImportFileWidget.cpp
M +3 -2 src/kdefrontend/datasources/ImportFileWidget.h
https://commits.kde.org/labplot/ead1126415e329fb2c678b7cff2b2c4b2f2290a4
diff --git a/src/kdefrontend/datasources/ImportFileDialog.cpp b/src/kdefrontend/datasources/ImportFileDialog.cpp
index c301b502..7c962f36 100644
--- a/src/kdefrontend/datasources/ImportFileDialog.cpp
+++ b/src/kdefrontend/datasources/ImportFileDialog.cpp
@@ -115,6 +115,7 @@ void ImportFileDialog::loadSettings() {
connect(m_importFileWidget, SIGNAL(sourceTypeChanged()), this, SLOT(checkOkButton()));
connect(m_importFileWidget, SIGNAL(hostChanged()), this, SLOT(checkOkButton()));
connect(m_importFileWidget, SIGNAL(portChanged()), this, SLOT(checkOkButton()));
+ connect(m_importFileWidget, SIGNAL(previewRefreshed()), this, SLOT(checkOkButton()));
connect(m_optionsButton, SIGNAL(clicked()), this, SLOT(toggleOptions()));
checkOkButton();
@@ -355,7 +356,7 @@ void ImportFileDialog::checkOkButton() {
fileName = QDir::homePath() + QDir::separator() + fileName;
#endif
-
+ DEBUG("Data Source Type: " << ENUM_TO_STRING(LiveDataSource, SourceType, m_importFileWidget->currentSourceType()));
switch (m_importFileWidget->currentSourceType()) {
case LiveDataSource::SourceType::FileOrPipe: {
DEBUG("fileName = " << fileName.toUtf8().constData());
@@ -369,7 +370,6 @@ void ImportFileDialog::checkOkButton() {
break;
}
case LiveDataSource::SourceType::LocalSocket: {
- DEBUG(" Local Socket");
const bool enable = QFile::exists(fileName);
if (enable) {
QLocalSocket lsocket{this};
@@ -398,7 +398,6 @@ void ImportFileDialog::checkOkButton() {
break;
}
case LiveDataSource::SourceType::NetworkTcpSocket: {
- DEBUG(" TCP Socket");
const bool enable = !m_importFileWidget->host().isEmpty() && !m_importFileWidget->port().isEmpty();
if (enable) {
QTcpSocket socket(this);
@@ -419,7 +418,6 @@ void ImportFileDialog::checkOkButton() {
break;
}
case LiveDataSource::SourceType::NetworkUdpSocket: {
- DEBUG(" UDP Socket");
const bool enable = !m_importFileWidget->host().isEmpty() && !m_importFileWidget->port().isEmpty();
if (enable) {
QUdpSocket socket(this);
diff --git a/src/kdefrontend/datasources/ImportFileWidget.cpp b/src/kdefrontend/datasources/ImportFileWidget.cpp
index d4387bad..d327a879 100644
--- a/src/kdefrontend/datasources/ImportFileWidget.cpp
+++ b/src/kdefrontend/datasources/ImportFileWidget.cpp
@@ -547,8 +547,8 @@ void ImportFileWidget::selectFile() {
KConfigGroup conf(KSharedConfig::openConfig(), "ImportFileWidget");
QString dir = conf.readEntry("LastDir", "");
QString path = QFileDialog::getOpenFileName(this, i18n("Select the File Data Source"), dir);
- if (path.isEmpty())
- return; //cancel was clicked in the file-dialog
+ if (path.isEmpty()) //cancel was clicked in the file-dialog
+ return;
int pos = path.lastIndexOf(QDir::separator());
if (pos != -1) {
@@ -832,7 +832,7 @@ void ImportFileWidget::refreshPreview() {
if (!fileName.isEmpty() && fileName.at(0) != QDir::separator())
fileName = QDir::homePath() + QDir::separator() + fileName;
#endif
- DEBUG("refreshPreview() file name = " << fileName.toStdString());
+ DEBUG("refreshPreview(): file name = " << fileName.toStdString());
QVector<QStringList> importedStrings;
LiveDataSource::FileType fileType = (LiveDataSource::FileType)ui.cbFileType->currentIndex();
@@ -1063,6 +1063,9 @@ void ImportFileWidget::refreshPreview() {
} else {
m_fileEmpty = true;
}
+
+ emit previewRefreshed();
+
RESET_CURSOR;
}
diff --git a/src/kdefrontend/datasources/ImportFileWidget.h b/src/kdefrontend/datasources/ImportFileWidget.h
index e2d53718..b693938f 100644
--- a/src/kdefrontend/datasources/ImportFileWidget.h
+++ b/src/kdefrontend/datasources/ImportFileWidget.h
@@ -68,8 +68,8 @@ public:
QString host() const;
QString port() const;
- QString serialPort() const;
- int baudRate() const;
+ QString serialPort() const;
+ int baudRate() const;
void initializeAndFillPortsAndBaudRates();
private:
@@ -110,6 +110,7 @@ signals:
void sourceTypeChanged();
void hostChanged();
void portChanged();
+ void previewRefreshed();
void checkedFitsTableToMatrix(const bool enable);
friend class HDF5OptionsWidget; // to access refreshPreview()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic