mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 02:12:37 -04:00
Added device error message to file open error messages
Thanks to Mike W9MDB for contributing this as a patch. Also added a few more in elsewhere. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4883 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
3d80de5b03
commit
a9957c3193
@ -161,7 +161,7 @@ void HRDTransceiver::do_start ()
|
|||||||
QFile HRD_info_file {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("HRD Interface Information.txt")};
|
QFile HRD_info_file {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("HRD Interface Information.txt")};
|
||||||
if (!HRD_info_file.open (QFile::WriteOnly | QFile::Text | QFile::Truncate))
|
if (!HRD_info_file.open (QFile::WriteOnly | QFile::Text | QFile::Truncate))
|
||||||
{
|
{
|
||||||
throw error {tr ("Failed to open file \"%1\".").arg (HRD_info_file.fileName ())};
|
throw error {tr ("Failed to open file \"%1\": %2.").arg (HRD_info_file.fileName ()).arg (HRD_info_file.errorString ())};
|
||||||
}
|
}
|
||||||
QTextStream HRD_info {&HRD_info_file};
|
QTextStream HRD_info {&HRD_info_file};
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ namespace
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw_qstring (QObject::tr ("Error opening waterfall palette file \"%1\".").arg (file.fileName ()));
|
throw_qstring (QObject::tr ("Error opening waterfall palette file \"%1\": %2.").arg (file.fileName ()).arg (file.errorString ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return colours;
|
return colours;
|
||||||
@ -255,7 +255,7 @@ namespace
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw_qstring (QObject::tr ("Error writing waterfall palette file \"%1\".").arg (file.fileName ()));
|
throw_qstring (QObject::tr ("Error writing waterfall palette file \"%1\": %2.").arg (file.fileName ()).arg (file.errorString ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
|||||||
if (!f.open (QIODevice::WriteOnly | QIODevice::Text))
|
if (!f.open (QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QMessageBox mb;
|
QMessageBox mb;
|
||||||
mb.setText ("Cannot open \"" + f.fileName () + "\".");
|
mb.setText ("Cannot open \"" + f.fileName () + "\" for writing:" + f.errorString ());
|
||||||
mb.exec();
|
mb.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void LogQSO::accept()
|
|||||||
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
|
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
|
||||||
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
||||||
QMessageBox m;
|
QMessageBox m;
|
||||||
m.setText("Cannot open file \"" + f.fileName () + "\".");
|
m.setText("Cannot open file \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||||
m.exec();
|
m.exec();
|
||||||
} else {
|
} else {
|
||||||
QString logEntry=m_dateTime.date().toString("yyyy-MMM-dd,") +
|
QString logEntry=m_dateTime.date().toString("yyyy-MMM-dd,") +
|
||||||
|
@ -902,11 +902,17 @@ void MainWindow::qsy (Frequency f)
|
|||||||
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
||||||
|
|
||||||
QFile f2 {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
QFile f2 {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
if (f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||||
|
{
|
||||||
QTextStream out(&f2);
|
QTextStream out(&f2);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
||||||
<< " " << (m_dialFreq / 1.e6) << " MHz " << m_mode << endl;
|
<< " " << (m_dialFreq / 1.e6) << " MHz " << m_mode << endl;
|
||||||
f2.close();
|
f2.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox("Cannot open \"" + f2.fileName () + "\" for append:" + f2.errorString ());
|
||||||
|
}
|
||||||
if (m_config.spot_to_psk_reporter ())
|
if (m_config.spot_to_psk_reporter ())
|
||||||
{
|
{
|
||||||
pskSetLocal ();
|
pskSetLocal ();
|
||||||
@ -957,8 +963,7 @@ void MainWindow::statusChanged()
|
|||||||
<< ui->rptSpinBox->value() << ";" << m_modeTx << endl;
|
<< ui->rptSpinBox->value() << ";" << m_modeTx << endl;
|
||||||
f.close();
|
f.close();
|
||||||
} else {
|
} else {
|
||||||
msgBox("Cannot open file \"" + f.fileName () + "\".");
|
msgBox("Cannot open \"" + f.fileName () + "\" for writing:" + f.errorString ());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1194,7 +1199,7 @@ void MainWindow::on_actionKeyboard_shortcuts_triggered()
|
|||||||
{
|
{
|
||||||
QFile f(":/shortcuts.txt");
|
QFile f(":/shortcuts.txt");
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\".");
|
msgBox("Cannot open \"" + f.fileName () + "\" for reading:"+f.errorString ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_shortcuts.reset (new QTextEdit);
|
m_shortcuts.reset (new QTextEdit);
|
||||||
@ -1222,7 +1227,7 @@ void MainWindow::on_actionSpecial_mouse_commands_triggered()
|
|||||||
{
|
{
|
||||||
QFile f(":/mouse_commands.txt");
|
QFile f(":/mouse_commands.txt");
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\".");
|
msgBox("Cannot open \"" + f.fileName () + "\" for reading:" + f.errorString ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_mouseCmnds.reset (new QTextEdit);
|
m_mouseCmnds.reset (new QTextEdit);
|
||||||
@ -1348,7 +1353,8 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||||
|
{
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
if(m_RxLog==1) {
|
if(m_RxLog==1) {
|
||||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
||||||
@ -1358,6 +1364,11 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
int n=t.length();
|
int n=t.length();
|
||||||
out << t.mid(0,n-2) << endl;
|
out << t.mid(0,n-2) << endl;
|
||||||
f.close();
|
f.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||||
|
}
|
||||||
|
|
||||||
if(m_config.insert_blank () && m_blankLine)
|
if(m_config.insert_blank () && m_blankLine)
|
||||||
{
|
{
|
||||||
@ -1549,12 +1560,18 @@ void MainWindow::guiUpdate()
|
|||||||
last_tx_label->setText("Last Tx: " + t);
|
last_tx_label->setText("Last Tx: " + t);
|
||||||
if(m_restart) {
|
if(m_restart) {
|
||||||
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||||
|
{
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
||||||
<< " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx
|
<< " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx
|
||||||
<< ": " << t << endl;
|
<< ": " << t << endl;
|
||||||
f.close();
|
f.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||||
|
}
|
||||||
if (m_config.TX_messages ())
|
if (m_config.TX_messages ())
|
||||||
{
|
{
|
||||||
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,ui->TxFreqSpinBox->value ());
|
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,ui->TxFreqSpinBox->value ());
|
||||||
@ -1617,13 +1634,19 @@ void MainWindow::guiUpdate()
|
|||||||
if(!m_tune)
|
if(!m_tune)
|
||||||
{
|
{
|
||||||
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||||
|
{
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
||||||
<< " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx
|
<< " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx
|
||||||
<< ": " << t << endl;
|
<< ": " << t << endl;
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_config.TX_messages () && !m_tune)
|
if (m_config.TX_messages () && !m_tune)
|
||||||
{
|
{
|
||||||
@ -2146,7 +2169,7 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
|
|
||||||
QFile f1 {m_dataDir.absoluteFilePath ("CALL3.TXT")};
|
QFile f1 {m_dataDir.absoluteFilePath ("CALL3.TXT")};
|
||||||
if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f1.fileName () + "\".");
|
msgBox("Cannot open \"" + f1.fileName () + "\" for read/write:" + f1.errorString ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(f1.size()==0) {
|
if(f1.size()==0) {
|
||||||
@ -2157,7 +2180,7 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
}
|
}
|
||||||
QFile f2 {m_dataDir.absoluteFilePath ("CALL3.TMP")};
|
QFile f2 {m_dataDir.absoluteFilePath ("CALL3.TMP")};
|
||||||
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f2.fileName () + "\".");
|
msgBox("Cannot open \"" + f2.fileName () + "\" for writing:" + f2.errorString ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTextStream in(&f1); //Read from CALL3.TXT
|
QTextStream in(&f1); //Read from CALL3.TXT
|
||||||
@ -2940,7 +2963,7 @@ void MainWindow::on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered()
|
|||||||
{
|
{
|
||||||
QFile f(":/prefixes.txt");
|
QFile f(":/prefixes.txt");
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\".");
|
msgBox("Cannot open \"" + f.fileName () + "\" for reading:" + f.errorString ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_prefixes.reset (new QTextEdit);
|
m_prefixes.reset (new QTextEdit);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user