mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-27 11:52:28 -04:00
Create the splash screen before assigning the application name
Even though the splash screen does not have a title it seems to interfere with JTAlert which enumerates window titles to identify WSJT-X instances. I'm not sure why this is necessary, but if it helps it should be benign. Ensure that the splash screen is hidden before any message boxes are shown, this is essential at startup if there is a stale lock file or rig control error. Be far less aggressive about bringing the splash screen to the top of the application window stack. This may cause the splash screen to be obscured on some platforms. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7025 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
5ad7b15a19
commit
cc178ab6fa
20
main.cpp
20
main.cpp
@ -106,13 +106,9 @@ int main(int argc, char *argv[])
|
||||
// instantiating QApplication so
|
||||
// that GUI has correct l18n
|
||||
|
||||
// Override programs executable basename as application name.
|
||||
a.setApplicationName ("WSJT-X");
|
||||
a.setApplicationVersion (version ());
|
||||
bool multiple {false};
|
||||
|
||||
QPixmap splash_pic {":/splash.png"};
|
||||
QSplashScreen splash {splash_pic, Qt::WindowStaysOnTopHint};
|
||||
splash.setWindowTitle (QString {});
|
||||
splash.showMessage ("<h2>" + QString {"Alpha Release: WSJT-X v" +
|
||||
QCoreApplication::applicationVersion() + " " +
|
||||
revision ()}.simplified () + "</h2>"
|
||||
@ -131,6 +127,10 @@ int main(int argc, char *argv[])
|
||||
splash.show ();
|
||||
a.processEvents ();
|
||||
|
||||
// Override programs executable basename as application name.
|
||||
a.setApplicationName ("WSJT-X");
|
||||
a.setApplicationVersion (version ());
|
||||
|
||||
#if QT_VERSION >= 0x050200
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription ("\nJT65A & JT9 Weak Signal Communications Program.");
|
||||
@ -149,6 +149,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (!parser.parse (a.arguments ()))
|
||||
{
|
||||
splash.hide ();
|
||||
MessageBox::critical_message (nullptr, a.translate ("main", "Command line error"), parser.errorText ());
|
||||
return -1;
|
||||
}
|
||||
@ -156,11 +157,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (parser.isSet (help_option))
|
||||
{
|
||||
splash.hide ();
|
||||
MessageBox::information_message (nullptr, a.translate ("main", "Command line help"), parser.helpText ());
|
||||
return 0;
|
||||
}
|
||||
else if (parser.isSet (version_option))
|
||||
{
|
||||
splash.hide ();
|
||||
MessageBox::information_message (nullptr, a.translate ("main", "Application version"), a.applicationVersion ());
|
||||
return 0;
|
||||
}
|
||||
@ -169,6 +172,7 @@ int main(int argc, char *argv[])
|
||||
QStandardPaths::setTestModeEnabled (parser.isSet (test_option));
|
||||
|
||||
// support for multiple instances running from a single installation
|
||||
bool multiple {false};
|
||||
if (parser.isSet (rig_option) || parser.isSet (test_option))
|
||||
{
|
||||
auto temp_name = parser.value (rig_option);
|
||||
@ -203,6 +207,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (QLockFile::LockFailedError == instance_lock.error ())
|
||||
{
|
||||
splash.hide ();
|
||||
auto button = MessageBox::query_message (nullptr
|
||||
, a.translate ("main", "Another instance may be running")
|
||||
, a.translate ("main", "try to remove stale lock file?")
|
||||
@ -221,6 +226,7 @@ int main(int argc, char *argv[])
|
||||
default:
|
||||
throw std::runtime_error {"Multiple instances must have unique rig names"};
|
||||
}
|
||||
splash.show ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -239,6 +245,7 @@ int main(int argc, char *argv[])
|
||||
if (!temp_dir.mkpath (unique_directory)
|
||||
|| !temp_dir.cd (unique_directory))
|
||||
{
|
||||
splash.hide ();
|
||||
MessageBox::critical_message (nullptr,
|
||||
a.translate ("main", "Failed to create a temporary directory"),
|
||||
a.translate ("main", "Path: \"%1\"").arg (temp_dir.absolutePath ()));
|
||||
@ -246,6 +253,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (!temp_dir.isReadable () || !(temp_ok = QTemporaryFile {temp_dir.absoluteFilePath ("test")}.open ()))
|
||||
{
|
||||
splash.hide ();
|
||||
auto button = MessageBox::critical_message (nullptr,
|
||||
a.translate ("main", "Failed to create a usable temporary directory"),
|
||||
a.translate ("main", "Another application may be locking the directory"),
|
||||
@ -255,6 +263,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
throw std::runtime_error {"Failed to create a usable temporary directory"};
|
||||
}
|
||||
splash.show ();
|
||||
temp_dir.cdUp (); // revert to parent as this one is no good
|
||||
}
|
||||
}
|
||||
@ -294,6 +303,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(!mem_jt9.attach()) {
|
||||
if (!mem_jt9.create(sizeof(struct dec_data))) {
|
||||
splash.hide ();
|
||||
MessageBox::critical_message (nullptr, a.translate ("main", "Shared memory error"),
|
||||
a.translate ("main", "Unable to create shared memory segment"));
|
||||
throw std::runtime_error {"Shared memory error"};
|
||||
|
@ -871,7 +871,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
|
||||
void MainWindow::splash_done ()
|
||||
{
|
||||
m_splash->close ();
|
||||
m_splash && m_splash->close ();
|
||||
}
|
||||
|
||||
void MainWindow::on_the_minute ()
|
||||
@ -1321,10 +1321,16 @@ void MainWindow::fastSink(qint64 frames)
|
||||
}
|
||||
|
||||
void MainWindow::showSoundInError(const QString& errorMsg)
|
||||
{MessageBox::critical_message (this, tr ("Error in Sound Input"), errorMsg);}
|
||||
{
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
MessageBox::critical_message (this, tr ("Error in Sound Input"), errorMsg);
|
||||
}
|
||||
|
||||
void MainWindow::showSoundOutError(const QString& errorMsg)
|
||||
{MessageBox::critical_message (this, tr ("Error in Sound Output"), errorMsg);}
|
||||
{
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
MessageBox::critical_message (this, tr ("Error in Sound Output"), errorMsg);
|
||||
}
|
||||
|
||||
void MainWindow::showStatusMessage(const QString& statusMsg)
|
||||
{statusBar()->showMessage(statusMsg);}
|
||||
@ -1613,6 +1619,7 @@ void MainWindow::statusChanged()
|
||||
<< ui->rptSpinBox->value() << ";" << m_modeTx << endl;
|
||||
f.close();
|
||||
} else {
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
MessageBox::warning_message (this, tr ("Status File Error")
|
||||
, tr ("Cannot open \"%1\" for writing: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
@ -1756,6 +1763,7 @@ void MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::
|
||||
if (argument.contains (' ')) argument = '"' + argument + '"';
|
||||
arguments << argument;
|
||||
}
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
MessageBox::critical_message (this, tr ("Subprocess Error")
|
||||
, tr ("Subprocess failed with exit code %1")
|
||||
.arg (exit_code)
|
||||
@ -1777,6 +1785,7 @@ void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError)
|
||||
if (argument.contains (' ')) argument = '"' + argument + '"';
|
||||
arguments << argument;
|
||||
}
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
MessageBox::critical_message (this, tr ("Subprocess error")
|
||||
, tr ("Running: %1\n%2")
|
||||
.arg (process->program () + ' ' + arguments.join (' '))
|
||||
@ -2563,8 +2572,6 @@ void MainWindow::guiUpdate()
|
||||
double txDuration;
|
||||
QString rt;
|
||||
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->raise ();
|
||||
|
||||
if(m_TRperiod==0) m_TRperiod=60;
|
||||
txDuration=0.0;
|
||||
if(m_modeTx=="JT4") txDuration=1.0 + 207.0*2520/11025.0; // JT4
|
||||
@ -4870,6 +4877,7 @@ void MainWindow::rigFailure (QString const& reason)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
m_rigErrorMessageBox.setDetailedText (reason);
|
||||
|
||||
// don't call slot functions directly to avoid recursion
|
||||
@ -5382,6 +5390,7 @@ void MainWindow::postWSPRDecode (bool is_new, QStringList parts)
|
||||
|
||||
void MainWindow::networkError (QString const& e)
|
||||
{
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
if (MessageBox::Retry == MessageBox::warning_message (this, tr ("Network Error")
|
||||
, tr ("Error: %1\nUDP server %2:%3")
|
||||
.arg (e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user