Index: BrowseWindow.h =================================================================== --- BrowseWindow.h (revision 225) +++ BrowseWindow.h (working copy) @@ -32,7 +32,7 @@ // typedef QValueVector IntVector; - BrowseWindow::BrowseWindow(MythMainWindow *parent, MSqlQuery *db, + BrowseWindow(MythMainWindow *parent, MSqlQuery *db, QString window_name, QString theme_filename, const char *name=0, const char *filename=0); Index: ViewRecipeWindow.h =================================================================== --- ViewRecipeWindow.h (revision 225) +++ ViewRecipeWindow.h (working copy) @@ -31,7 +31,7 @@ // Now featuring a themed constructor ... YAH!!! // - ViewRecipeWindow::ViewRecipeWindow(MythMainWindow *parent, MSqlQuery *db, + ViewRecipeWindow(MythMainWindow *parent, MSqlQuery *db, QString window_name, QString theme_filename, const char *name=0, const char *recipen_name=0); Index: ScanSiteWindow.h =================================================================== --- ScanSiteWindow.h (revision 225) +++ ScanSiteWindow.h (working copy) @@ -25,7 +25,7 @@ public: - ScanSiteWindow::ScanSiteWindow(MythMainWindow *parent, MSqlQuery *db, + ScanSiteWindow(MythMainWindow *parent, MSqlQuery *db, QString window_name, QString theme_filename, const char *name=0); ~ScanSiteWindow(void); Index: ScanXML.h =================================================================== --- ScanXML.h (revision 225) +++ ScanXML.h (working copy) @@ -26,13 +26,13 @@ public: - ScanXML::ScanXML(MythMainWindow *parent, MSqlQuery *db, + ScanXML(MythMainWindow *parent, MSqlQuery *db, QString window_name, QString theme_filename, const char *name=0); ~ScanXML(void); void keyPressEvent(QKeyEvent *e); - void ScanXML::importXML( QString &filepath ); + void importXML( QString &filepath ); public slots: Index: ModuleWindow.h =================================================================== --- ModuleWindow.h (revision 225) +++ ModuleWindow.h (working copy) @@ -33,7 +33,7 @@ // typedef QValueVector IntVector; - ModuleWindow::ModuleWindow(MythMainWindow *parent, MSqlQuery *db, + ModuleWindow(MythMainWindow *parent, MSqlQuery *db, QString window_name, QString theme_filename, const char *name=0); ~ModuleWindow(void); Index: RecipeDB.h =================================================================== --- RecipeDB.h (revision 225) +++ RecipeDB.h (working copy) @@ -26,7 +26,7 @@ public: - RecipeDB::RecipeDB(QObject *parent=0, const char *name=0, MSqlQuery *db=0); + RecipeDB(QObject *parent=0, const char *name=0, MSqlQuery *db=0); ~RecipeDB(void); Index: main.cpp =================================================================== --- main.cpp (revision 225) +++ main.cpp (working copy) @@ -12,7 +12,7 @@ #include "BrowseWindow.h" #include "ScanXML.h" -#include +#include #include #include #include @@ -46,11 +46,12 @@ void ModuleCallback(void *data, QString &selection) { - ModuleData *ddata = (ModuleData *)data; + //ModuleData *ddata = (ModuleData *)data; QString sel = selection.lower(); - (void)ddata; + //(void)ddata; + MSqlQuery query(MSqlQuery::InitCon()); if (sel == "recipe_settings") { runRecipeSettings(); } else if (sel == "recipe_music_settings") { @@ -62,8 +63,10 @@ } else if (sel == "import_recipe_ml") { // ModuleHandler::processAllModule(); // runImportRecipeML(); + + ScanXML modulewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-scan-site-", "Recipe"); @@ -80,7 +83,7 @@ // runScanRecipeSites(); ScanSiteWindow modulewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-scan-site-", "Recipe"); @@ -93,7 +96,7 @@ // ModuleHandler::processAllModule(); ModuleWindow modulewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-", "Recipe"); @@ -102,7 +105,7 @@ } else if (sel == "browse_recipes-0") { // ModuleHandler::processAllModule(); ModuleWindow modulewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-new-01-", // "Recipe-0-", "Recipe"); @@ -110,7 +113,7 @@ } else if (sel == "browse_recipes-1") { // ModuleHandler::processAllModule(); ModuleWindow modulewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-new-02-", "Recipe"); @@ -119,7 +122,7 @@ // ModuleHandler::processAllModule(); BrowseWindow browsewindow(gContext->GetMainWindow(), - ddata->db, + &query, "Recipe", "Recipe-bf-", "Recipe", @@ -138,27 +141,39 @@ void runMenu(QString which_menu) { + + cout << "Starting MythRecipie runMenu() " << endl; + QString themedir = gContext->GetThemeDir(); - ThemedMenu *diag = new ThemedMenu(themedir.ascii(), which_menu, - gContext->GetMainWindow(), "Module menu"); +// MythThemedMenu *diag = new MythThemedMenu(themedir.ascii(), which_menu, +// gContext->GetMainWindow(), "Module menu"); + cout << "Starting MythRecipie themedir= "<< themedir << endl; + MythThemedMenu *diag = new MythThemedMenu(themedir.ascii(), which_menu, + GetMythMainWindow()->GetMainStack(), "Module menu"); + + ModuleData data; data.db = new MSqlQuery(MSqlQuery::InitCon()); - + cout << "in MythRecipie runMenu() 1" << endl; diag->setCallback(ModuleCallback, &data); diag->setKillable(); - + cout << "in MythRecipie runMenu() 2" << endl; if (diag->foundTheme()) { if (class LCD * lcd = LCD::Get()) { lcd->switchToTime(); } - diag->exec(); +// diag->exec(); + cout << "in MythRecipie runMenu() 3 calling GetMythMainWindow()->GetMainStack() " << endl; + GetMythMainWindow()->GetMainStack()->AddScreen(diag); + cout << "in MythRecipie runMenu() 4 returning GetMythMainWindow()->GetMainStack() " << endl; } else { cerr << QString("Couldn't find theme %1").arg(themedir) << endl; + delete diag; } - delete diag; + } @@ -169,7 +184,7 @@ } - +// void setupKeys(void) { // // These are the jump points for the plugin @@ -261,6 +276,8 @@ QString paths = gContext->GetSetting("Recipe"); + gContext->addCurrentLocation("mythRecipe"); // karl + ModuleWindow modulewindow(gContext->GetMainWindow(), db, "Recipe", "Recipe-", @@ -274,7 +291,10 @@ int mythplugin_run(void) { // runModule(); + + cout << " in mythplugin_run for recipe " << endl; runMenu("Recipemain-ui.xml"); + return 0; } Index: GetLynxFile.cpp =================================================================== --- GetLynxFile.cpp (revision 225) +++ GetLynxFile.cpp (working copy) @@ -14,12 +14,12 @@ bool ok=false; static int cnt=0; QDir mythdir( PREFIX "/share/mythtv/themes/default/recipes/."); -/* - cout << "ScanSiteWindow::getUrlFile() " << endl - << "\tusr is " << url.data() << endl - << "\ttmp file is " << lynx_file_name.data() + + cout << "LynxFile::getUrlFile() " << endl + << "\t usr is " << url.data() << endl + << "\t tmp file is " << lynx_file_name.data() << endl; -*/ + if (use_lynx) { tmp_lynx_file_name = lynx_file_name; } else { @@ -96,12 +96,37 @@ this, SLOT(readFromStdout()) ); connect( lynx_proc, SIGNAL(processExited()), this, SLOT(lynx_process_done()) ); - + + + // debug + QStringList arg_list = lynx_proc->arguments(); + QString args_string= arg_list.join(" "); + cout << " lynx_proc args =" << args_string << endl; + if ( !lynx_proc->start() ) { cout <<"\terror executing lynx... !?"<isRunning()) { } + cout <<"Started lynx Waiting for exit....." << endl; + sleep(1); + + int timeout_count=0; + while (lynx_proc->isRunning()) + { + usleep(10000); // 10ms + timeout_count++; + if (timeout_count > 2000) // 20 sec timeout + { + cout << "killing lynx_proc.. NOTE: use lynx 2.8.5. 2.8.6 is broke " << endl; + lynx_proc->kill(); + disconnect( lynx_proc, SIGNAL(readyReadStdout()), + this, SLOT(readFromStdout()) ); + disconnect( lynx_proc, SIGNAL(processExited()), + this, SLOT(lynx_process_done()) ); + return false; + } + } + cout <<"lynx finished....." << endl; disconnect( lynx_proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()) ); disconnect( lynx_proc, SIGNAL(processExited()), Index: ViewRecipeWindow.cpp =================================================================== --- ViewRecipeWindow.cpp (revision 225) +++ ViewRecipeWindow.cpp (working copy) @@ -31,7 +31,8 @@ QString window_name, QString theme_filename, const char *name, const char *recipe_name) - : MythThemedDialog(parent, window_name, theme_filename, name) { + : MythThemedDialog(parent, window_name, theme_filename, name) +{ QString str; Index: ScanSiteWindow.cpp =================================================================== --- ScanSiteWindow.cpp (revision 225) +++ ScanSiteWindow.cpp (working copy) @@ -96,6 +96,7 @@ */ void ScanSiteWindow::scanSites( ) { QString s; + cout << " in ScanSiteWindow::scanSites( ) " << endl; recipes_at_atime=gContext->GetSetting("RecipeGetNumRecipesAtATime", QString("%1").arg(MINRECIPESATATIME)).toInt(); @@ -134,6 +135,7 @@ int total_recipes_scanned=0; int pagenum = 1; + cout << " in ScanSiteWindow::scan_cooking_com( ) " << endl; coursenum = gContext->GetSetting("RecipeCourseStart","1").toInt(); end_coursenum = gContext->GetSetting("RecipeCourseEnd", QString("%1").arg(MAXCOURSES)).toInt(); @@ -147,6 +149,7 @@ if ((end_coursenumtotal_courses)) end_coursenum = total_courses; + while (coursenum <= end_coursenum) { MythProgressDialog *pd1=NULL; QStringList reclist; @@ -172,6 +175,7 @@ QString tmpfile; QString url; + cout << "while coursenum="<< coursenum << " end_coursenum=" << end_coursenum << endl; if (pd0) pd0->setProgress( coursenum ); @@ -671,6 +675,7 @@ QStringList pagecnt; // page count found on page QRegExp rx; // search away ... + cout << "in canSiteWindow::processCoursePage" << endl; referencelist = QStringList::split(" ",""); // cout << "ScanSiteWindow::processCoursePage() " << endl; @@ -805,9 +810,10 @@ QString photo=0; QString line=0; QRegExp rx; + QStringList strlist =QStringList::split("\n", buffer); - // cout << "ScanSiteWindow::scanCourseRecipe() " << endl; + cout << "ScanSiteWindow::scanCourseRecipe() " << endl; for ( QStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it ) { Index: Modulesettings.h =================================================================== --- Modulesettings.h (revision 225) +++ Modulesettings.h (working copy) @@ -8,7 +8,7 @@ #include "mythtv/mythcontext.h" -#define MYTHRECIPEVERSION "0.19.1" +#define MYTHRECIPEVERSION "0.20.0" /* class GlobalSetting: public SimpleDBStorage, virtual public Configurable {