Ticket #5677: schemawiz.patch

File schemawiz.patch, 3.1 KB (added by Nigel, 16 years ago)
  • libs/libmyth/schemawizard.cpp

     
    11#include <unistd.h>      // for isatty() on Windows
    22
    3 #include "dialogbox.h"
    43#include "langsettings.h"
    54#include "mythcontext.h"
    65#include "schemawizard.h"
    76#include "util.h"
    87
    98#include "libmythdb/mythtimer.h"
     9#include "libmythui/mythdialogbox.h"
    1010#include "libmythui/mythmainwindow.h"
     11#include "libmythui/myththemebase.h"
    1112#include "libmythui/mythuihelper.h"
    1213
    1314
    1415static SchemaUpgradeWizard * c_wizard = 0;
    1516
     17static MythThemeBase * themeBase = 0;
    1618
    1719SchemaUpgradeWizard::SchemaUpgradeWizard(const QString &DBSchemaSetting,
    1820                                         const QString &upgradeSchemaVal)
     
    328330 
    329331    if (gui)
    330332    {
    331         DialogBox       * dlg;
     333        MythDialogBox   * dlg;
    332334        MythScreenStack * pop;
    333335        MythMainWindow  * win = gContext->GetMainWindow();
    334336
     
    336338            win = TempMainWindow(true);
    337339
    338340        pop = win->GetStack("popup stack");
     341        if (!pop)
     342            pop = win->GetMainStack();
     343        if (!pop)
     344            return MYTH_SCHEMA_ERROR;
    339345
    340         dlg = new DialogBox(win, message);
     346
     347
     348        dlg = new MythDialogBox(message, pop, "schema prompt");
     349        if (!dlg->Create())
     350            return MYTH_SCHEMA_ERROR;
     351
     352        pop->AddScreen(dlg);
    341353        dlg->AddButton(QObject::tr("Exit"));
    342354
    343355        if (returnValue == MYTH_SCHEMA_ERROR)
     
    349361            if (m_expertMode)
    350362                dlg->AddButton(QObject::tr("Use current schema"));
    351363
    352             DialogCode selected = dlg->exec();
     364            DialogCode selected = (DialogCode)(int)dlg->exec();
     365printf("Got exec() = %d\n", selected);
    353366
    354367            // The annoying extra confirmation:
    355368            if (kDialogCodeButton1 == selected ||
     
    376389                if (connections)
    377390                    message += "\n\n" + warnOtherCl;
    378391
    379                 DialogBox *dlg2 = new DialogBox(win, message);
     392                MythDialogBox *dlg2 = new MythDialogBox(message, pop,
     393                                                        "schema extra popup");
     394                if (!dlg2->Create())
     395                    return MYTH_SCHEMA_ERROR;
     396                pop->AddScreen(dlg2);
    380397
    381398                dlg2->AddButton(QObject::tr("Exit"));
    382399                if (upgradable)
     
    384401                if (m_expertMode)
    385402                    dlg2->AddButton(QObject::tr("Use current schema"));
    386403
    387                 selected = dlg2->exec();
     404                selected = (DialogCode)(int)dlg->exec();
    388405
    389406                dlg2->deleteLater();
    390407            }
     
    471488
    472489    win->Init();
    473490    gContext->SetMainWindow(win);
     491
     492    themeBase = new MythThemeBase();
     493
    474494    m_createdTempWindow = true;
    475495
    476496    LanguageSettings::prompt();
     
    481501
    482502void SchemaUpgradeWizard::EndTempWindow(void)
    483503{
     504    delete themeBase;
    484505    gContext->SetMainWindow(NULL);
    485506    DestroyMythMainWindow();
    486507    m_createdTempWindow = false;