mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use the same code for command line and gui for file handling.
The Command line execution of Subsurface happened before the GUI was created, this leaded to various bugs by me(tm) over time. This patch seems to fix all of those, by reusing the same code for GUI interaction and CommandLine interaction. I had to rework how the main.c worked, it used to be C code calling C++ code, and this is non desirable, since C doesn't really understand C++. I Moved all of C-related code to 'subsurfacestartup.c/h' and created a tiny wrapper to call it, so all of the C code is still C code, and the new main.cpp calls the mainwindow->loadFiles and mainWindow->importFiles to get rid of the bugs that happened before. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
6a7256fdd5
commit
96d1cc570e
9 changed files with 167 additions and 129 deletions
21
qt-gui.cpp
21
qt-gui.cpp
|
@ -70,18 +70,6 @@ static QApplication *application = NULL;
|
|||
int error_count;
|
||||
const char *existing_filename;
|
||||
|
||||
void init_qt_ui(int *argcp, char ***argvp, char *errormessage)
|
||||
{
|
||||
application->installTranslator(new Translator(application));
|
||||
MainWindow *window = new MainWindow();
|
||||
window->showError(errormessage);
|
||||
window->show();
|
||||
if (existing_filename && existing_filename[0] != '\0')
|
||||
window->setTitle(MWTF_FILENAME);
|
||||
else
|
||||
window->setTitle(MWTF_DEFAULT);
|
||||
}
|
||||
|
||||
const char *getSetting(QSettings &s, QString name)
|
||||
{
|
||||
QVariant v;
|
||||
|
@ -127,6 +115,15 @@ void init_ui(int *argcp, char ***argvp)
|
|||
default_dive_computer_product = getSetting(s,"dive_computer_product");
|
||||
default_dive_computer_device = getSetting(s, "dive_computer_device");
|
||||
s.endGroup();
|
||||
|
||||
application->installTranslator(new Translator(application));
|
||||
MainWindow *window = new MainWindow();
|
||||
window->show();
|
||||
if (existing_filename && existing_filename[0] != '\0')
|
||||
window->setTitle(MWTF_FILENAME);
|
||||
else
|
||||
window->setTitle(MWTF_DEFAULT);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue