View Single Post
Old 09-03-2024, 06:50 PM   #39
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 874
Karma: 3501146
Join Date: Jan 2017
Location: Poland
Device: Various
Debug with changed MainWindow.cpp

My changes to multiple debug:
Spoiler:

Code:
bool MainWindow::LoadFile(const QString &fullfilepath, bool is_internal)
{
    if (!Utility::IsFileReadable(fullfilepath)) {
        return false;
    }

    try {
        DBG qDebug() << "01";
        ImporterFactory importerFactory;
        // Create the new book, clean up the old one
        // (destructors take care of that)
        DBG qDebug() << "02";
        Importer *importer = importerFactory.GetImporter(fullfilepath);
        DBG qDebug() << "03";
        if (!importer) {
            throw tr("No importer for file type: %1").arg(QFileInfo(fullfilepath).suffix().toLower());
        }
        DBG qDebug() << "04";
        XhtmlDoc::WellFormedError error = importer->CheckValidToLoad();
        DBG qDebug() << "05";
        if (error.line != -1) {
            // Warn the user their content is invalid.
            Utility::DisplayStdErrorDialog(tr("The following file was not loaded due to invalid content or not well formed XML:\n\n%1 (line %2: %3)\n\nTry setting the Clean Source preference to Mend XHTML Source Code on Open and reloading the file.")
                                           .arg(QDir::toNativeSeparators(fullfilepath))
                                           .arg(error.line)
                                           .arg(error.message));
        } else {
            DBG qDebug() << "06";
            ShowMessageOnStatusBar(tr("Loading file..."), 0);
            DBG qDebug() << "07";
            m_Book->SetModified(false);
            DBG qDebug() << "08";
            SetNewBook(importer->GetBook());

            // The m_IsModified state variable is set in GetBook() to indicate whether the OPF
            // file was invalid and had to be recreated.
            // Since this happens before the connections have been established, it needs to be
            // tested and retoggled if true in order to indicate the actual state.
            DBG qDebug() << "09";
            if (m_Book->IsModified()) {
                m_Book->SetModified(false);
                m_Book->SetModified(true);
            }
            DBG qDebug() << "10";
            m_SaveACopyFilename = "";
            DBG qDebug() << "11";
            ShowMessageOnStatusBar(tr("File loaded."));

            // Get any warnings - if our main window is not currently visible they will be
            // shown when the window is displayed.
            DBG qDebug() << "12";
            m_LastOpenFileWarnings.append(importer->GetLoadWarnings());
            DBG qDebug() << "13";
            if (!m_IsInitialLoad) {
                ShowLastOpenFileWarnings();
            }
            DBG qDebug() << "14";
            if (!is_internal) {
                DBG qDebug() << "15";
                // Store the folder the user opened from
                m_LastFolderOpen = QFileInfo(fullfilepath).absolutePath();
                // Clear the last inserted file
                DBG qDebug() << "16";
                m_LastInsertedFile = "";
                DBG qDebug() << "17";
                UpdateUiWithCurrentFile(fullfilepath);
            } else {
                DBG qDebug() << "18";
                UpdateUiWithCurrentFile(QFileInfo(fullfilepath).fileName(), true);
                DBG qDebug() << "19";
                m_Book->SetModified();
            }
            DBG qDebug() << "20";
            return true;
        }
   } catch (FileEncryptedWithDrm&) {
       DBG qDebug() << "21";
       ShowMessageOnStatusBar();
       // ImportHTML/ImportEPUB use wait cursor and can throw exceptions caught here
       DBG qDebug() << "22";
       QApplication::restoreOverrideCursor();
       DBG qDebug() << "23";
       Utility::DisplayStdErrorDialog(
           tr("The creator of this file has encrypted it with DRM. "
              "Sigil cannot open such files."));
   } catch (EPUBLoadParseError& epub_load_error) {
       DBG qDebug() << "24";
       ShowMessageOnStatusBar();
       // ImportHTML/ImportEPUB use wait cursor and can throw exceptions caught here
       DBG qDebug() << "25";
       QApplication::restoreOverrideCursor();
       DBG qDebug() << "26";
       const QString errors = QString(epub_load_error.what());
       DBG qDebug() << "27";
       Utility::DisplayStdErrorDialog(
           tr("Cannot load EPUB: %1").arg(QDir::toNativeSeparators(fullfilepath)), errors);
   } catch (const std::runtime_error &e) {
       DBG qDebug() << "28";
       ShowMessageOnStatusBar();
       // ImportHTML/ImportEPUB use wait cursor and can throw exceptions caught here
       DBG qDebug() << "29";
       QApplication::restoreOverrideCursor();
       DBG qDebug() << "30";
       Utility::DisplayExceptionErrorDialog(tr("Cannot load file %1: %2")
                                             .arg(QDir::toNativeSeparators(fullfilepath))
                                             .arg(e.what()));
   } catch (QString& err) {
       DBG qDebug() << "31";
       ShowMessageOnStatusBar();
       // ImportHTML/ImportEPUB use wait cursor and can throw exceptions caught here
       DBG qDebug() << "32";
       QApplication::restoreOverrideCursor();
       DBG qDebug() << "33";
       Utility::DisplayStdErrorDialog(err);
   }

    // If we got to here some sort of error occurred while loading the file
    // and potentially has left the GUI in a nasty state (like on initial startup)
    // Fallback to displaying a new book instead so GUI integrity is maintained.
    DBG qDebug() << "34";
    CreateNewBook();
    DBG qDebug() << "35";
    return false;
}


Debug file:
Spoiler:
Code:
Debug: Current windows platform args:  QList("altgr")
Debug: New windows platform args:  "windows:altgr"
Debug: initial styleHints colorScheme:  Qt::ColorScheme::Dark
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: Application Palette Changed
Debug: ------
Debug: In ChangeEvent:  QEvent(WindowTitleChange, 0x5d7acfba90)
Debug: ------
Debug: In ReadSettings
Debug: ------
Debug: In ChangeEvent:  QWindowStateChangeEvent(WindowStateChange, 0x5d7acfd720)
Debug: old state QFlags<Qt::WindowState>(WindowNoState)
Debug: visible:  false
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1693 749
Debug: central widget:  0 0 100 30
Debug: tab manager:  0 0 100 30
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: Main Window new state: maximized
Debug: ------
Debug: In ChangeEvent:  QEvent(PaletteChange, 0x5d7acfcd70)
Debug: visible:  false
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1693 749
Debug: central widget:  262 132 1152 589
Debug: tab manager:  0 0 100 30
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: old size:  QSize(-1, -1)
Debug: new size:  QSize(1693, 749)
Debug: primary screen total size:  QRect(0,0 1920x1200)
Debug: primary screen available size:  QRect(0,0 1920x1119)
Debug: visible:  false
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1693 749
Debug: central widget:  262 132 1152 589
Debug: tab manager:  0 0 100 30
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: ------
Debug: In ReadSettings before restoreState
Debug: visible:  true
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1693 749
Debug: central widget:  262 132 1152 589
Debug: tab manager:  1 1 1150 587
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: d01
Debug: 01
Debug: 02
Debug: 03
Debug: 04
Debug: 05
Debug: 06
Debug: 07
Debug: 08
Debug: 28
Debug: 29
Debug: 30
Debug: ------
Debug: In ChangeEvent:  QEvent(ActivationChange, 0x5d7acf61d0)
Debug: Main Window is transitioning from inactive to active: 
Debug: MW: UpdatePreview()
Debug: Primary Screen:  "DELL U2410" "Dell Inc." "F525M21HA83L"
Debug:     geo        :  QRect(0,0 1920x1200)
Debug:     avail   geo:  QRect(0,0 1920x1119)
Debug:     devideRatio:  1
Debug:     logical dpi:  96 96
Debug:     physic  dpi:  94.1467 94.0741
Debug: 

All Screens
Debug: Screen:  0 "DELL U2410" "Dell Inc." "F525M21HA83L"
Debug:     geo        :  QRect(0,0 1920x1200)
Debug:     avail   geo:  QRect(0,0 1920x1119)
Debug:     devideRatio:  1
Debug:     logical dpi:  96 96
Debug:     physic  dpi:  94.1467 94.0741
Debug: visible:  true
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1693 749
Debug: central widget:  206 104 734 617
Debug: tab manager:  1 1 732 615
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: focus changed:  QWidget(0x0) TabBar(0x242ae47e540)
Debug: old size:  QSize(1693, 749)
Debug: new size:  QSize(1920, 1096)
Debug: primary screen total size:  QRect(0,0 1920x1200)
Debug: primary screen available size:  QRect(0,0 1920x1119)
Debug: visible:  true
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  152 342 1920 1096
Debug: central widget:  206 104 961 964
Debug: tab manager:  1 1 959 962
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: visible:  true
Debug: maximized:  true
Debug: full screen:  false
Debug: main window:  0 23 1920 1096
Debug: central widget:  206 104 961 964
Debug: tab manager:  1 1 959 962
Debug: find replace:  0 0 566 127
Debug: find replace visible:  false
Debug: ------
Debug: In ChangeEvent:  QEvent(ActivationChange, 0x5d7acf61d0)
Debug: Main Window is transitioning from active to inactive
Debug: focus changed:  TabBar(0x242ae47e540) QPushButton(0x242ba0142c0)


As you can see Debug “34” is never called.
BeckyEbook is online now   Reply With Quote