00001 #include <unistd.h>
00002
00003 #include <stdlib.h>
00004 #include <unistd.h>
00005 #include <iostream>
00006 #include <cstdlib>
00007 #include <sys/wait.h>
00008
00009
00010 #include <qdir.h>
00011 #include <qapplication.h>
00012
00013
00014 #include <mythtv/mythcontext.h>
00015 #include <mythtv/mythwidgets.h>
00016 #include <mythtv/libmythtv/remoteutil.h>
00017 #include <mythtv/libmythtv/programinfo.h>
00018
00019
00020 #include "archiveutil.h"
00021 #include "mythburnwizard.h"
00022 #include "editmetadata.h"
00023 #include "fileselector.h"
00024 #include "thumbfinder.h"
00025 #include "recordingselector.h"
00026 #include "videoselector.h"
00027
00028
00029 const int LAST_PAGE = 4;
00030
00031
00032 const int MAX_DVDR_SIZE_SL = 4482;
00033 const int MAX_DVDR_SIZE_DL = 8964;
00034
00035 MythburnWizard::MythburnWizard(MythMainWindow *parent, QString window_name,
00036 QString theme_filename, const char *name)
00037 : MythThemedDialog(parent, window_name, theme_filename, name, true)
00038 {
00039 themeDir = gContext->GetShareDir() + "mytharchive/themes/";
00040
00041
00042 QString thumbDir = getTempDirectory() + "/config/thumbs";
00043 QDir dir(thumbDir);
00044 if (dir.exists())
00045 system("rm -rf " + thumbDir);
00046
00047 archiveList = NULL;
00048 popupMenu = NULL;
00049 profileList = NULL;
00050 setContext(1);
00051 wireUpTheme();
00052 assignFirstFocus();
00053 updateForeground();
00054 bReordering = false;
00055
00056 bCreateISO = false;
00057 bDoBurn = false;
00058 bEraseDvdRw = false;
00059 saveFilename = "";
00060
00061 loadConfiguration();
00062
00063 updateSizeBar();
00064 }
00065
00066 MythburnWizard::~MythburnWizard(void)
00067 {
00068 saveConfiguration();
00069
00070 if (archiveList)
00071 delete archiveList;
00072 if (profileList)
00073 delete profileList;
00074 }
00075
00076 void MythburnWizard::keyPressEvent(QKeyEvent *e)
00077 {
00078 bool handled = false;
00079 QStringList actions;
00080 gContext->GetMainWindow()->TranslateKeyPress("Archive", e, actions);
00081
00082 for (unsigned int i = 0; i < actions.size() && !handled; i++)
00083 {
00084 QString action = actions[i];
00085 handled = true;
00086
00087 if (action == "ESCAPE")
00088 {
00089 done(Rejected);
00090 }
00091 else if (action == "DOWN")
00092 {
00093 if (getCurrentFocusWidget() == archive_list)
00094 {
00095 archive_list->MoveDown(UIListBtnType::MoveItem);
00096 archive_list->refresh();
00097 }
00098 else if (getCurrentFocusWidget() == selected_list)
00099 {
00100 if (bReordering)
00101 {
00102 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00103 item->moveUpDown(false);
00104 reloadSelectedList();
00105 }
00106 else
00107 selected_list->MoveDown(UIListBtnType::MoveItem);
00108
00109 selected_list->refresh();
00110 }
00111 else
00112 nextPrevWidgetFocus(true);
00113 }
00114 else if (action == "UP")
00115 {
00116 if (getCurrentFocusWidget() == archive_list)
00117 {
00118 archive_list->MoveUp(UIListBtnType::MoveItem);
00119 archive_list->refresh();
00120 }
00121 else if (getCurrentFocusWidget() == selected_list)
00122 {
00123 if (bReordering)
00124 {
00125 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00126 item->moveUpDown(true);
00127 reloadSelectedList();
00128 }
00129 else
00130 selected_list->MoveUp(UIListBtnType::MoveItem);
00131
00132 selected_list->refresh();
00133 }
00134 else
00135 nextPrevWidgetFocus(false);
00136 }
00137 else if (action == "PAGEDOWN")
00138 {
00139 if (getCurrentFocusWidget() == archive_list)
00140 {
00141 archive_list->MoveDown(UIListBtnType::MovePage);
00142 archive_list->refresh();
00143 }
00144 }
00145 else if (action == "PAGEUP")
00146 {
00147 if (getCurrentFocusWidget() == archive_list)
00148 {
00149 archive_list->MoveUp(UIListBtnType::MovePage);
00150 archive_list->refresh();
00151 }
00152 }
00153 else if (action == "LEFT")
00154 {
00155 if (bReordering)
00156 {
00157 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00158 if (item)
00159 item->setPixmap(NULL);
00160 bReordering = false;
00161 selected_list->refresh();
00162 }
00163
00164 if (getCurrentFocusWidget() == theme_selector)
00165 theme_selector->push(false);
00166 else if (getCurrentFocusWidget() == profile_selector)
00167 profile_selector->push(false);
00168 else if (getCurrentFocusWidget() == destination_selector)
00169 destination_selector->push(false);
00170 else
00171 nextPrevWidgetFocus(false);
00172 }
00173 else if (action == "RIGHT")
00174 {
00175 if (bReordering)
00176 {
00177 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00178 if (item)
00179 item->setPixmap(NULL);
00180
00181 bReordering = false;
00182 selected_list->refresh();
00183 }
00184
00185 if (getCurrentFocusWidget() == theme_selector)
00186 theme_selector->push(true);
00187 else if (getCurrentFocusWidget() == profile_selector)
00188 profile_selector->push(true);
00189 else if (getCurrentFocusWidget() == destination_selector)
00190 destination_selector->push(true);
00191 else
00192 nextPrevWidgetFocus(true);
00193 }
00194 else if (action == "SELECT")
00195 {
00196 if (getCurrentFocusWidget() == selected_list)
00197 toggleReorderState();
00198 else
00199 activateCurrent();
00200 }
00201 else if (action == "MENU")
00202 {
00203 showMenu();
00204 }
00205 else if (action == "INFO")
00206 {
00207 if (getContext() == LAST_PAGE)
00208 {
00209 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00210
00211 if (!item)
00212 return;
00213
00214 ArchiveItem *a = (ArchiveItem *) item->getData();
00215
00216 ThumbFinder finder(a, theme_list[theme_no], gContext->GetMainWindow(),
00217 "thumbfinder", "mythburn-", "thumb finder");
00218 finder.exec();
00219 }
00220 }
00221 else if (action == "TOGGLECUT")
00222 {
00223 UIListBtnTypeItem *item = archive_list->GetItemCurrent();
00224 ArchiveItem *a = (ArchiveItem *) item->getData();
00225
00226 if (usecutlist_check && a->hasCutlist)
00227 {
00228 usecutlist_check->setState(!usecutlist_check->getState());
00229 toggleUseCutlist(usecutlist_check->getState());
00230 }
00231 }
00232 else
00233 handled = false;
00234 }
00235
00236 if (!handled)
00237 MythThemedDialog::keyPressEvent(e);
00238 }
00239
00240 void MythburnWizard::toggleReorderState()
00241 {
00242 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00243 if (bReordering)
00244 {
00245 bReordering = false;
00246 item->setPixmap(NULL);
00247 }
00248 else
00249 {
00250 bReordering = true;
00251 item->setPixmap(movePixmap);
00252 }
00253
00254 selected_list->refresh();
00255 }
00256
00257
00258 void MythburnWizard::reloadSelectedList()
00259 {
00260 archiveList->clear();
00261
00262 for (int x = 0; x < selected_list->GetCount(); x++)
00263 {
00264 UIListBtnTypeItem *item = selected_list->GetItemAt(x);
00265 if (item)
00266 archiveList->push_back((ArchiveItem *) item->getData());
00267 }
00268 }
00269
00270 void MythburnWizard::updateSizeBar(void)
00271 {
00272 bool show = (getContext() == 2 || getContext() == 4);
00273
00274 if (show)
00275 {
00276 maxsize_text->show();
00277 minsize_text->show();
00278 size_bar->show();
00279 currentsize_error_text->show();
00280 currentsize_text->show();
00281 }
00282 else
00283 {
00284 maxsize_text->hide();
00285 minsize_text->hide();
00286 size_bar->hide();
00287 currentsize_error_text->hide();
00288 currentsize_text->hide();
00289 }
00290
00291 long long size = 0;
00292 ArchiveItem *a;
00293 vector<ArchiveItem *>::iterator i = archiveList->begin();
00294 for ( ; i != archiveList->end(); i++)
00295 {
00296 a = *i;
00297 size += a->newsize;
00298 }
00299
00300 usedSpace = size / 1024 / 1024;
00301
00302 QString tmpSize;
00303
00304 if (size_bar)
00305 {
00306 size_bar->SetTotal(freeSpace);
00307 size_bar->SetUsed(usedSpace);
00308 }
00309
00310 tmpSize.sprintf("%0d Mb", freeSpace);
00311
00312 maxsize_text->SetText(tmpSize);
00313
00314 minsize_text->SetText("0 Mb");
00315
00316 tmpSize.sprintf("%0d Mb", usedSpace);
00317
00318 if (usedSpace > freeSpace)
00319 {
00320 currentsize_text->hide();
00321
00322 currentsize_error_text->SetText(tmpSize);
00323 if (show)
00324 currentsize_error_text->show();
00325 }
00326 else
00327 {
00328 currentsize_error_text->hide();
00329
00330 currentsize_text->SetText(tmpSize);
00331 if (show)
00332 currentsize_text->show();
00333 }
00334
00335 size_bar->refresh();
00336
00337 if (show)
00338 selectedChanged(selected_list->GetItemCurrent());
00339 }
00340
00341 void MythburnWizard::wireUpTheme()
00342 {
00343
00344 movePixmap = gContext->LoadScalePixmap("ma_updown.png");
00345
00346
00347 createISO_check = getUICheckBoxType("makeisoimage_check");
00348 if (createISO_check)
00349 {
00350 connect(createISO_check, SIGNAL(pushed(bool)),
00351 this, SLOT(toggleCreateISO(bool)));
00352 }
00353
00354
00355 doBurn_check = getUICheckBoxType("burntodvdr_check");
00356 if (doBurn_check)
00357 {
00358 connect(doBurn_check, SIGNAL(pushed(bool)),
00359 this, SLOT(toggleDoBurn(bool)));
00360 }
00361 doBurn_text = getUITextType("burntodvdr_text");
00362
00363
00364 eraseDvdRw_check = getUICheckBoxType("erasedvdrw_check");
00365 if (eraseDvdRw_check)
00366 {
00367 connect(eraseDvdRw_check, SIGNAL(pushed(bool)),
00368 this, SLOT(toggleEraseDvdRw(bool)));
00369 }
00370 eraseDvdRw_text = getUITextType("erasedvdrw_text");
00371
00372
00373 intro_image = getUIImageType("intro_image");
00374 mainmenu_image = getUIImageType("mainmenu_image");
00375 chapter_image = getUIImageType("chapter_image");
00376 details_image = getUIImageType("details_image");
00377
00378
00379 themedesc_text = getUITextType("themedescription");
00380 theme_image = getUIImageType("theme_image");
00381 theme_selector = getUISelectorType("theme_selector");
00382 if (theme_selector)
00383 {
00384 getThemeList();
00385 connect(theme_selector, SIGNAL(pushed(int)),
00386 this, SLOT(setTheme(int)));
00387 }
00388
00389
00390 next_button = getUITextButtonType("next_button");
00391 if (next_button)
00392 {
00393 next_button->setText(tr("Next"));
00394 connect(next_button, SIGNAL(pushed()), this, SLOT(handleNextPage()));
00395 }
00396
00397
00398 prev_button = getUITextButtonType("prev_button");
00399 if (prev_button)
00400 {
00401 prev_button->setText(tr("Previous"));
00402 connect(prev_button, SIGNAL(pushed()), this, SLOT(handlePrevPage()));
00403 }
00404
00405
00406 cancel_button = getUITextButtonType("cancel_button");
00407 if (cancel_button)
00408 {
00409 cancel_button->setText(tr("Cancel"));
00410 connect(cancel_button, SIGNAL(pushed()), this, SLOT(handleCancel()));
00411 }
00412
00413
00414 destination_selector = getUISelectorType("destination_selector");
00415 if (destination_selector)
00416 {
00417 connect(destination_selector, SIGNAL(pushed(int)),
00418 this, SLOT(setDestination(int)));
00419
00420 for (int x = 0; x < ArchiveDestinationsCount; x++)
00421 destination_selector->addItem(ArchiveDestinations[x].type,
00422 ArchiveDestinations[x].name);
00423 }
00424
00425 destination_text = getUITextType("destination_text");
00426
00427
00428 find_button = getUITextButtonType("find_button");
00429 if (find_button)
00430 {
00431 find_button->setText(tr("Choose File..."));
00432 connect(find_button, SIGNAL(pushed()), this, SLOT(handleFind()));
00433 }
00434
00435 filename_edit = getUIRemoteEditType("filename_edit");
00436 if (filename_edit)
00437 {
00438 filename_edit->createEdit(this);
00439 connect(filename_edit, SIGNAL(loosingFocus()), this,
00440 SLOT(filenameEditLostFocus()));
00441 }
00442
00443 freespace_text = getUITextType("freespace_text");
00444
00445 setDestination(0);
00446
00447 title_text = getUITextType("progtitle");
00448 datetime_text = getUITextType("progdatetime");
00449 description_text = getUITextType("progdescription");
00450 filesize_text = getUITextType("filesize");
00451 usecutlist_text = getUITextType("usecutlist_text");
00452 nocutlist_text = getUITextType("nocutlist_text");;
00453 nofiles_text = getUITextType("nofiles");
00454
00455 usecutlist_check = getUICheckBoxType("usecutlist_check");
00456 if (usecutlist_check)
00457 {
00458 connect(usecutlist_check, SIGNAL(pushed(bool)),
00459 this, SLOT(toggleUseCutlist(bool)));
00460 }
00461
00462 selected_list = getUIListBtnType("selectedlist");
00463 if (selected_list)
00464 {
00465 connect(selected_list, SIGNAL(itemSelected(UIListBtnTypeItem *)),
00466 this, SLOT(selectedChanged(UIListBtnTypeItem *)));
00467 }
00468
00469 archive_list = getUIListBtnType("archivelist");
00470 if (archive_list)
00471 {
00472 connect(archive_list, SIGNAL(itemSelected(UIListBtnTypeItem *)),
00473 this, SLOT(titleChanged(UIListBtnTypeItem *)));
00474 }
00475
00476
00477 addrecording_button = getUITextButtonType("addrecording_button");
00478 if (addrecording_button)
00479 {
00480 addrecording_button->setText(tr("Add Recording"));
00481 connect(addrecording_button, SIGNAL(pushed()), this, SLOT(handleAddRecording()));
00482 }
00483
00484
00485 addvideo_button = getUITextButtonType("addvideo_button");
00486 if (addvideo_button)
00487 {
00488 addvideo_button->setText(tr("Add Video"));
00489 connect(addvideo_button, SIGNAL(pushed()), this, SLOT(handleAddVideo()));
00490 }
00491
00492
00493 addfile_button = getUITextButtonType("addfile_button");
00494 if (addfile_button)
00495 {
00496 addfile_button->setText(tr("Add File"));
00497 connect(addfile_button, SIGNAL(pushed()), this, SLOT(handleAddFile()));
00498 }
00499
00500 maxsize_text = getUITextType("maxsize");
00501 minsize_text = getUITextType("minsize");
00502 currentsize_error_text = getUITextType("currentsize_error");
00503 currentsize_text = getUITextType("currentsize");
00504
00505 size_bar = getUIStatusBarType("size_bar");
00506
00507 profile_selector = getUISelectorType("profile_selector");
00508 if (profile_selector)
00509 {
00510 connect(profile_selector, SIGNAL(pushed(int)),
00511 this, SLOT(setProfile(int)));
00512 }
00513
00514 profile_text = getUITextType("profile_text");
00515 loadEncoderProfiles();
00516
00517 oldsize_text = getUITextType("oldfilesize");
00518 newsize_text = getUITextType("newfilesize");
00519
00520 getArchiveList();
00521
00522 buildFocusList();
00523 }
00524
00525 void MythburnWizard::loadEncoderProfiles()
00526 {
00527 profileList = new vector<EncoderProfile*>;
00528
00529 profile_selector->addItem(0, tr("Don't re-encode"));
00530 EncoderProfile *item = new EncoderProfile;
00531 item->name = "NONE";
00532 item->description = "";
00533 item->bitrate = 0.0f;
00534 profileList->push_back(item);
00535
00536
00537
00538 QString filename = MythContext::GetConfDir() +
00539 "/MythArchive/ffmpeg_dvd_" +
00540 ((gContext->GetSetting("MythArchiveVideoFormat", "pal")
00541 .lower() == "ntsc") ? "ntsc" : "pal") + ".xml";
00542
00543 if (!QFile::exists(filename))
00544 {
00545
00546 filename = gContext->GetShareDir() +
00547 "mytharchive/encoder_profiles/ffmpeg_dvd_" +
00548 ((gContext->GetSetting("MythArchiveVideoFormat", "pal")
00549 .lower() == "ntsc") ? "ntsc" : "pal") + ".xml";
00550 }
00551
00552 VERBOSE(VB_IMPORTANT, QString("MythArchive: Loading encoding profiles from %1")
00553 .arg(filename));
00554
00555 QDomDocument doc("mydocument");
00556 QFile file(filename);
00557 if (!file.open(IO_ReadOnly))
00558 return;
00559
00560 if (!doc.setContent( &file ))
00561 {
00562 file.close();
00563 return;
00564 }
00565 file.close();
00566
00567 QDomElement docElem = doc.documentElement();
00568 QDomNodeList profileNodeList = doc.elementsByTagName("profile");
00569 QString name, desc, bitrate;
00570
00571 for (int x = 0; x < (int) profileNodeList.count(); x++)
00572 {
00573 QDomNode n = profileNodeList.item(x);
00574 QDomElement e = n.toElement();
00575 QDomNode n2 = e.firstChild();
00576 while (!n2.isNull())
00577 {
00578 QDomElement e2 = n2.toElement();
00579 if(!e2.isNull())
00580 {
00581 if (e2.tagName() == "name")
00582 name = e2.text();
00583 if (e2.tagName() == "description")
00584 desc = e2.text();
00585 if (e2.tagName() == "bitrate")
00586 bitrate = e2.text();
00587
00588 }
00589 n2 = n2.nextSibling();
00590
00591 }
00592 profile_selector->addItem(x + 1, name);
00593
00594 EncoderProfile *item = new EncoderProfile;
00595 item->name = name;
00596 item->description = desc;
00597 item->bitrate = bitrate.toFloat();
00598 profileList->push_back(item);
00599 }
00600
00601 profile_selector->setToItem(0);
00602 }
00603
00604 void MythburnWizard::setProfile(int itemNo)
00605 {
00606 EncoderProfile *profile = profileList->at(itemNo);
00607 UIListBtnTypeItem *item = selected_list->GetItemCurrent();
00608 if (item)
00609 {
00610 ArchiveItem *a = (ArchiveItem *) item->getData();
00611 setProfile(profile, a);
00612 }
00613 }
00614
00615 void MythburnWizard::recalcItemSize(ArchiveItem *item)
00616 {
00617 if (!item)
00618 return;
00619
00620 if (!item->encoderProfile)
00621 return;
00622
00623 if (item->encoderProfile->name == "NONE")
00624 {
00625 if (item->hasCutlist && item->useCutlist)
00626 item->newsize = (long long) (item->size /
00627 ((float)item->duration / (float)item->cutDuration));
00628 else
00629 item->newsize = item->size;
00630 }
00631 else
00632 item->newsize = recalcSize(item->encoderProfile, item);
00633
00634 if (newsize_text)
00635 {
00636 newsize_text->SetText(tr("New Size ") + formatSize(item->newsize / 1024, 2));
00637 }
00638
00639 updateSizeBar();
00640 }
00641
00642 void MythburnWizard::setProfile(EncoderProfile *profile, ArchiveItem *item)
00643 {
00644 if (profile)
00645 {
00646 profile_text->SetText(profile->description);
00647 if (item)
00648 {
00649 item->encoderProfile = profile;
00650 recalcItemSize(item);
00651
00652 if (newsize_text)
00653 {
00654 newsize_text->SetText(tr("New Size ") + formatSize(item->newsize / 1024, 2));
00655 }
00656
00657 updateSizeBar();
00658 }
00659 }
00660 }
00661
00662 long long MythburnWizard::recalcSize(EncoderProfile *profile, ArchiveItem *a)
00663 {
00664 if (a->duration == 0)
00665 return 0;
00666
00667 int length;
00668
00669 if (a->hasCutlist && a->useCutlist)
00670 length = a->cutDuration;
00671 else
00672 length = a->duration;
00673
00674 float len = (float) length / 3600;
00675 return (long long) (len * profile->bitrate * 1024 * 1024);
00676 }
00677
00678 void MythburnWizard::toggleUseCutlist(bool state)
00679 {
00680 UIListBtnTypeItem *item = archive_list->GetItemCurrent();
00681 ArchiveItem *a = (ArchiveItem *) item->getData();
00682
00683 if (!a)
00684 return;
00685
00686 if (!a->hasCutlist)
00687 return;
00688
00689 a->useCutlist = state;
00690
00691 recalcItemSize(a);
00692
00693 updateSelectedArchiveList();
00694 }
00695
00696 void MythburnWizard::titleChanged(UIListBtnTypeItem *item)
00697 {
00698 ArchiveItem *a;
00699
00700 a = (ArchiveItem *) item->getData();
00701
00702 if (!a)
00703 return;
00704
00705 if (title_text)
00706 title_text->SetText(a->title);
00707
00708 if (datetime_text)
00709 datetime_text->SetText(a->startDate + " " + a->startTime);
00710
00711 if (description_text)
00712 description_text->SetText(
00713 (a->subtitle != "" ? a->subtitle + "\n" : "") + a->description);
00714
00715 if (filesize_text)
00716 {
00717 filesize_text->SetText(formatSize(a->size / 1024, 2));
00718 }
00719
00720 if (a->hasCutlist)
00721 {
00722
00723 if (usecutlist_text)
00724 usecutlist_text->show();
00725
00726 if (usecutlist_check)
00727 {
00728 usecutlist_check->show();
00729
00730 usecutlist_check->setState(a->useCutlist);
00731 }
00732
00733 if (nocutlist_text)
00734 nocutlist_text->hide();
00735 }
00736 else
00737 {
00738
00739 if (usecutlist_text)
00740 usecutlist_text->hide();
00741 if (usecutlist_check)
00742 usecutlist_check->hide();
00743 if (nocutlist_text)
00744 nocutlist_text->show();
00745 }
00746
00747 buildFocusList();
00748 }
00749
00750 void MythburnWizard::selectedChanged(UIListBtnTypeItem *item)
00751 {
00752 if (!item)
00753 return;
00754
00755 ArchiveItem *a;
00756
00757 a = (ArchiveItem *) item->getData();
00758
00759 if (!a)
00760 return;
00761
00762 if (oldsize_text)
00763 {
00764 oldsize_text->SetText(tr("Original Size ") + formatSize(a->size / 1024, 2));
00765 }
00766
00767 if (newsize_text)
00768 {
00769 newsize_text->SetText(tr("New Size ") + formatSize(a->newsize / 1024, 2));
00770 }
00771
00772 if (a->encoderProfile->name == "NONE")
00773 profile_selector->setToItem(tr("Don't re-encode"));
00774 else
00775 profile_selector->setToItem(a->encoderProfile->name);
00776
00777 profile_text->SetText(a->encoderProfile->description);
00778 }
00779
00780 void MythburnWizard::handleNextPage()
00781 {
00782 if (getContext() == 2 && archiveList->size() == 0)
00783 {
00784 MythPopupBox::showOkPopup(gContext->GetMainWindow(), tr("Myth Archive"),
00785 tr("You need to add at least one item to archive!"));
00786 return;
00787 }
00788
00789 if (getContext() == LAST_PAGE)
00790 {
00791 runScript();
00792 done(Accepted);
00793 }
00794 else
00795 setContext(getContext() + 1);
00796
00797 if (next_button)
00798 {
00799 if (getContext() == LAST_PAGE)
00800 next_button->setText(tr("Finish"));
00801 else
00802 next_button->setText(tr("Next"));
00803 }
00804
00805 updateSizeBar();
00806 updateForeground();
00807 buildFocusList();
00808 }
00809
00810 void MythburnWizard::handlePrevPage()
00811 {
00812 if (getContext() == 1)
00813 done(Rejected);
00814
00815 if (getContext() > 1)
00816 setContext(getContext() - 1);
00817
00818 if (next_button)
00819 next_button->setText(tr("Next"));
00820
00821 updateSizeBar();
00822 updateForeground();
00823 buildFocusList();
00824 }
00825
00826 void MythburnWizard::handleCancel()
00827 {
00828 done(Rejected);
00829 }
00830
00831 void MythburnWizard::getThemeList(void)
00832 {
00833 theme_list.clear();
00834 QDir d;
00835
00836 d.setPath(themeDir);
00837 if (d.exists())
00838 {
00839 const QFileInfoList *list = d.entryInfoList("*", QDir::Dirs, QDir::Name);
00840 QFileInfoListIterator it(*list);
00841 QFileInfo *fi;
00842
00843 int count = 0;
00844 while ( (fi = it.current()) != 0 )
00845 {
00846
00847 if (QFile::exists(themeDir + fi->fileName() + "/preview.png"))
00848 {
00849 theme_list.append(fi->fileName());
00850 if (theme_selector)
00851 theme_selector->addItem(count, fi->fileName());
00852 ++count;
00853 }
00854 ++it;
00855 }
00856
00857 if (theme_selector)
00858 theme_selector->setToItem(0);
00859
00860 setTheme(0);
00861 }
00862 else
00863 cout << "MythArchive: Theme directory does not exist!" << endl;
00864 }
00865
00866 void MythburnWizard::setTheme(int item)
00867 {
00868 if (item < 0 || item > (int)theme_list.count() - 1)
00869 item = 0;
00870
00871 theme_no = item;
00872 if (theme_image)
00873 {
00874 if (QFile::exists(themeDir + theme_list[item] + "/preview.png"))
00875 theme_image->SetImage(themeDir + theme_list[item] + "/preview.png");
00876 else
00877 theme_image->SetImage("blank.png");
00878 theme_image->LoadImage();
00879 }
00880
00881 if (intro_image)
00882 {
00883 if (QFile::exists(themeDir + theme_list[item] + "/intro_preview.png"))
00884 intro_image->SetImage(themeDir + theme_list[item] + "/intro_preview.png");
00885 else
00886 intro_image->SetImage("blank.png");
00887 intro_image->LoadImage();
00888 }
00889
00890 if (mainmenu_image)
00891 {
00892 if (QFile::exists(themeDir + theme_list[item] + "/mainmenu_preview.png"))
00893 mainmenu_image->SetImage(themeDir + theme_list[item] + "/mainmenu_preview.png");
00894 else
00895 mainmenu_image->SetImage("blank.png");
00896 mainmenu_image->LoadImage();
00897 }
00898
00899 if (chapter_image)
00900 {
00901 if (QFile::exists(themeDir + theme_list[item] + "/chaptermenu_preview.png"))
00902 chapter_image->SetImage(themeDir + theme_list[item] + "/chaptermenu_preview.png");
00903 else
00904 chapter_image->SetImage("blank.png");
00905 chapter_image->LoadImage();
00906 }
00907
00908 if (details_image)
00909 {
00910 if (QFile::exists(themeDir + theme_list[item] + "/details_preview.png"))
00911 details_image->SetImage(themeDir + theme_list[item] + "/details_preview.png");
00912 else
00913 details_image->SetImage("blank.png");
00914 details_image->LoadImage();
00915 }
00916
00917 if (description_text)
00918 {
00919 if (QFile::exists(themeDir + theme_list[item] + "/description.txt"))
00920 {
00921 QString desc = loadFile(themeDir + theme_list[item] + "/description.txt");
00922 themedesc_text->SetText(desc);
00923 }
00924 else
00925 themedesc_text->SetText("No description found!");
00926 }
00927 }
00928
00929 QString MythburnWizard::loadFile(const QString &filename)
00930 {
00931 QString res = "";
00932
00933 QFile file(filename);
00934
00935 if (!file.exists())
00936 return "";
00937
00938 if (file.open( IO_ReadOnly ))
00939 {
00940 QTextStream stream(&file);
00941
00942 while ( !stream.atEnd() )
00943 {
00944 res = res + stream.readLine();
00945 }
00946 file.close();
00947 }
00948 else
00949 return "";
00950
00951 return res;
00952 }
00953
00954 void MythburnWizard::updateArchiveList(void)
00955 {
00956 archive_list->Reset();
00957
00958 if (archiveList->size() == 0)
00959 {
00960 if (title_text)
00961 title_text->SetText("");
00962
00963 if (datetime_text)
00964 datetime_text->SetText("");
00965
00966 if (description_text)
00967 description_text->SetText("");
00968
00969 if (filesize_text)
00970 filesize_text->SetText("");
00971
00972 if (nofiles_text)
00973 nofiles_text->show();
00974
00975 if (usecutlist_text)
00976 usecutlist_text->hide();
00977
00978 if (usecutlist_check)
00979 usecutlist_check->hide();
00980
00981 if (nocutlist_text)
00982 nocutlist_text->hide();
00983 }
00984 else
00985 {
00986 ArchiveItem *a;
00987 vector<ArchiveItem *>::iterator i = archiveList->begin();
00988 for ( ; i != archiveList->end(); i++)
00989 {
00990 a = *i;
00991
00992
00993 if (a->duration == 0)
00994 getFileDetails(a);
00995
00996
00997 if (a->encoderProfile == NULL)
00998 {
00999 a->encoderProfile = getDefaultProfile(a);
01000 setProfile(a->encoderProfile, a);
01001 }
01002
01003 UIListBtnTypeItem* item = new UIListBtnTypeItem(archive_list, a->title);
01004 item->setCheckable(false);
01005 item->setData(a);
01006 }
01007
01008 if (nofiles_text)
01009 nofiles_text->hide();
01010
01011 archive_list->SetItemCurrent(archive_list->GetItemFirst());
01012 titleChanged(archive_list->GetItemCurrent());
01013 }
01014
01015 archive_list->refresh();
01016 updateSizeBar();
01017 updateSelectedArchiveList();
01018 }
01019
01020 bool MythburnWizard::isArchiveItemValid(const QString &type, const QString &filename)
01021 {
01022 if (type == "Recording")
01023 {
01024 QString baseName = getBaseName(filename);
01025
01026 MSqlQuery query(MSqlQuery::InitCon());
01027 query.prepare("SELECT title FROM recorded WHERE basename = :FILENAME");
01028 query.bindValue(":FILENAME", baseName);
01029 query.exec();
01030 if (query.isActive() && query.numRowsAffected())
01031 return true;
01032 else
01033 {
01034 doRemoveArchiveItem(filename);
01035 VERBOSE(VB_IMPORTANT, QString("MythArchive: Recording not found (%1)").arg(filename));
01036 }
01037 }
01038 else if (type == "Video")
01039 {
01040 MSqlQuery query(MSqlQuery::InitCon());
01041 query.prepare("SELECT title FROM videometadata WHERE filename = :FILENAME");
01042 query.bindValue(":FILENAME", filename);
01043 query.exec();
01044 if (query.isActive() && query.numRowsAffected())
01045 return true;
01046 else
01047 {
01048 doRemoveArchiveItem(filename);
01049 VERBOSE(VB_IMPORTANT, QString("MythArchive: Video not found (%1)").arg(filename));
01050 }
01051 }
01052 else if (type == "File")
01053 {
01054 if (QFile::exists(filename))
01055 return true;
01056 else
01057 {
01058 doRemoveArchiveItem(filename);
01059 VERBOSE(VB_IMPORTANT, QString("MythArchive: File not found (%1)").arg(filename));
01060 }
01061 }
01062
01063 VERBOSE(VB_IMPORTANT, "MythArchive: Archive item removed from list");
01064
01065 return false;
01066 }
01067
01068 bool MythburnWizard::hasCutList(QString &type, QString &filename)
01069 {
01070 bool res = false;
01071
01072 if (type.lower() == "recording")
01073 {
01074 QString chanID, startTime;
01075
01076 if (extractDetailsFromFilename(filename, chanID, startTime))
01077 {
01078 ProgramInfo *pinfo = ProgramInfo::GetProgramFromRecorded(chanID, startTime);
01079
01080 if (pinfo)
01081 {
01082 res = (pinfo->programflags & FL_CUTLIST);
01083 delete pinfo;
01084 }
01085 }
01086 }
01087
01088 return res;
01089 }
01090
01091 void MythburnWizard::getArchiveListFromDB(void)
01092 {
01093 if (!archiveList)
01094 archiveList = new vector<ArchiveItem*>;
01095
01096 archiveList->clear();
01097
01098 MSqlQuery query(MSqlQuery::InitCon());
01099 query.prepare("SELECT intid, type, title, subtitle, description, size, "
01100 "startdate, starttime, filename, hascutlist "
01101 "FROM archiveitems ORDER BY intid");
01102 query.exec();
01103 if (query.isActive() && query.numRowsAffected())
01104 {
01105 while (query.next())
01106 {
01107
01108 QString type = query.value(1).toString();
01109 QString filename = QString::fromUtf8(query.value(8).toString());
01110 if (isArchiveItemValid(type, filename))
01111 {
01112 ArchiveItem *item = new ArchiveItem;
01113
01114 item->id = query.value(0).toInt();
01115 item->type = type;
01116 item->title = QString::fromUtf8(query.value(2).toString());
01117 item->subtitle = QString::fromUtf8(query.value(3).toString());
01118 item->description = QString::fromUtf8(query.value(4).toString());
01119 item->size = query.value(5).toLongLong();
01120 item->newsize = query.value(5).toLongLong();
01121 item->encoderProfile = NULL;
01122 item->startDate = QString::fromUtf8(query.value(6).toString());
01123 item->startTime = QString::fromUtf8(query.value(7).toString());
01124 item->filename = filename;
01125 item->hasCutlist = hasCutList(type, filename);
01126 item->useCutlist = false;
01127 item->editedDetails = false;
01128 item->duration = 0;
01129 item->cutDuration = 0;
01130 item->fileCodec = "";
01131 item->videoCodec = "";
01132 item->videoWidth = 0;
01133 item->videoHeight = 0;
01134 item->thumbList.setAutoDelete(true);
01135 archiveList->push_back(item);
01136 }
01137 }
01138 }
01139 }
01140
01141 EncoderProfile *MythburnWizard::getDefaultProfile(ArchiveItem *item)
01142 {
01143 if (!item)
01144 return profileList->at(0);
01145
01146 EncoderProfile *profile = NULL;
01147
01148
01149 if (item->videoCodec.lower() == "mpeg2video")
01150 {
01151
01152 if (gContext->GetSetting("MythArchiveVideoFormat", "pal").lower() == "ntsc")
01153 {
01154 if ((item->videoWidth == 720 && item->videoHeight == 480) ||
01155 (item->videoWidth == 704 && item->videoHeight == 480) ||
01156 (item->videoWidth == 352 && item->videoHeight == 480) ||
01157 (item->videoWidth == 352 && item->videoHeight == 240))
01158 {
01159
01160 profile = profileList->at(0);
01161 }
01162 }
01163 else
01164 {
01165 if ((item->videoWidth == 720 && item->videoHeight == 576) ||
01166 (item->videoWidth == 704 && item->videoHeight == 576) ||
01167 (item->videoWidth == 352 && item->videoHeight == 576) ||
01168 (item->videoWidth == 352 && item->videoHeight == 288))
01169 {
01170
01171 profile = profileList->at(0);
01172 }
01173 }
01174 }
01175
01176 if (!profile)
01177 {
01178
01179 QString defaultProfile =
01180 gContext->GetSetting("MythArchiveDefaultEncProfile", "SP");
01181
01182 for (uint x = 0; x < profileList->size(); x++)
01183 if (profileList->at(x)->name == defaultProfile)
01184 profile = profileList->at(x);
01185 }
01186
01187 return profile;
01188 }
01189
01190 void MythburnWizard::getArchiveList(void)
01191 {
01192 getArchiveListFromDB();
01193 updateArchiveList();
01194 }
01195
01196 void MythburnWizard::createConfigFile(const QString &filename)
01197 {
01198 QDomDocument doc("mythburn");
01199
01200 QDomElement root = doc.createElement("mythburn");
01201 doc.appendChild(root);
01202
01203 QDomElement job = doc.createElement("job");
01204 job.setAttribute("theme", theme_list[theme_no]);
01205 root.appendChild(job);
01206
01207 QDomElement media = doc.createElement("media");
01208 job.appendChild(media);
01209
01210
01211 ArchiveItem *a;
01212
01213 vector<ArchiveItem *>::iterator i = archiveList->begin();
01214 for ( ; i != archiveList->end(); i++)
01215 {
01216 a = *i;
01217
01218 QDomElement file = doc.createElement("file");
01219 file.setAttribute("type", a->type.lower() );
01220 file.setAttribute("usecutlist", a->useCutlist);
01221 file.setAttribute("filename", a->filename);
01222 file.setAttribute("encodingprofile", a->encoderProfile->name);
01223 if (a->editedDetails)
01224 {
01225 QDomElement details = doc.createElement("details");
01226 file.appendChild(details);
01227 details.setAttribute("title", a->title.utf8());
01228 details.setAttribute("subtitle", a->subtitle.utf8());
01229 details.setAttribute("startdate", a->startDate.utf8());
01230 details.setAttribute("starttime", a->startTime.utf8());
01231 QDomText desc = doc.createTextNode(a->description.utf8());
01232 details.appendChild(desc);
01233 }
01234
01235 if (a->thumbList.count() > 0)
01236 {
01237 QDomElement thumbs = doc.createElement("thumbimages");
01238 file.appendChild(thumbs);
01239
01240 for (uint x = 0; x < a->thumbList.count(); x++)
01241 {
01242 QDomElement thumb = doc.createElement("thumb");
01243 thumbs.appendChild(thumb);
01244 ThumbImage *thumbImage = a->thumbList.at(x);
01245 thumb.setAttribute("caption", thumbImage->caption.utf8());
01246 thumb.setAttribute("filename", thumbImage->filename);
01247 thumb.setAttribute("frame", (int) thumbImage->frame);
01248 }
01249 }
01250
01251 media.appendChild(file);
01252 }
01253
01254
01255 QDomElement options = doc.createElement("options");
01256 options.setAttribute("createiso", bCreateISO);
01257 options.setAttribute("doburn", bDoBurn);
01258 options.setAttribute("mediatype", archiveDestination.type);
01259 options.setAttribute("dvdrsize", freeSpace);
01260 options.setAttribute("erasedvdrw", bEraseDvdRw);
01261 options.setAttribute("savefilename", saveFilename);
01262 job.appendChild(options);
01263
01264
01265 QFile f(filename);
01266 if (!f.open(IO_WriteOnly))
01267 {
01268 cout << "MythburnWizard::createConfigFile: Failed to open file for writing - "
01269 << filename << endl;
01270 return;
01271 }
01272
01273 QTextStream t(&f);
01274 t << doc.toString(4);
01275 f.close();
01276 }
01277
01278 void MythburnWizard::loadConfiguration(void)
01279 {
01280 theme_selector->setToItem(
01281 gContext->GetSetting("MythBurnMenuTheme", ""));
01282 setTheme(theme_list.findIndex(theme_selector->getCurrentString()));
01283
01284 bCreateISO = (gContext->GetSetting("MythBurnCreateISO", "0") == "1");
01285 createISO_check->setState(bCreateISO);
01286
01287 bDoBurn = (gContext->GetSetting("MythBurnBurnDVDr", "1") == "1");
01288 doBurn_check->setState(bDoBurn);
01289
01290 bEraseDvdRw = (gContext->GetSetting("MythBurnEraseDvdRw", "0") == "1");
01291 eraseDvdRw_check->setState(bEraseDvdRw);
01292 }
01293
01294 void MythburnWizard::saveConfiguration(void)
01295 {
01296 gContext->SaveSetting("MythBurnMenuTheme",
01297 theme_selector->getCurrentString());
01298 gContext->SaveSetting("MythBurnCreateISO",
01299 (createISO_check->getState() ? "1" : "0"));
01300 gContext->SaveSetting("MythBurnBurnDVDr",
01301 (doBurn_check->getState() ? "1" : "0"));
01302 gContext->SaveSetting("MythBurnEraseDvdRw",
01303 (eraseDvdRw_check->getState() ? "1" : "0"));
01304 }
01305
01306 void MythburnWizard::updateSelectedArchiveList(void)
01307 {
01308 selected_list->Reset();
01309
01310 ArchiveItem *a;
01311
01312 vector<ArchiveItem *>::iterator i = archiveList->begin();
01313 for ( ; i != archiveList->end(); i++)
01314 {
01315 a = *i;
01316
01317 QString s = a->title;
01318 if (a->subtitle != "")
01319 s += " ~ " + a->subtitle;
01320 if (a->type == "Recording" && a->startDate != "")
01321 s += " ~ " + a->startDate + " " + a->startTime;
01322 UIListBtnTypeItem* item = new UIListBtnTypeItem(selected_list, s);
01323 item->setCheckable(true);
01324 if (a->useCutlist)
01325 item->setChecked(UIListBtnTypeItem::FullChecked);
01326 else
01327 item->setChecked(UIListBtnTypeItem::NotChecked);
01328 item->setData(a);
01329 }
01330 }
01331
01332 void MythburnWizard::showMenu()
01333 {
01334 if (popupMenu || getContext() != 2 || archiveList->size() == 0)
01335 return;
01336
01337 popupMenu = new MythPopupBox(gContext->GetMainWindow(),
01338 "popupMenu");
01339
01340 QButton *button;
01341 button = popupMenu->addButton(tr("Edit Details"), this, SLOT(editDetails()));
01342 button->setFocus();
01343
01344 popupMenu->addButton(tr("Remove Item"), this, SLOT(removeItem()));
01345 popupMenu->addButton(tr("Cancel"), this, SLOT(closePopupMenu()));
01346
01347 popupMenu->ShowPopup(this, SLOT(closePopupMenu()));
01348 }
01349
01350 void MythburnWizard::closePopupMenu(void)
01351 {
01352 if (popupMenu)
01353 {
01354 popupMenu->deleteLater();
01355 popupMenu = NULL;
01356 }
01357 }
01358
01359 void MythburnWizard::editDetails()
01360 {
01361 if (!popupMenu)
01362 return;
01363
01364 showEditMetadataDialog();
01365 closePopupMenu();
01366 }
01367
01368 void MythburnWizard::removeItem()
01369 {
01370 if (!popupMenu)
01371 return;
01372
01373 UIListBtnTypeItem *item = archive_list->GetItemCurrent();
01374 ArchiveItem *curItem = (ArchiveItem *) item->getData();
01375
01376 if (!curItem)
01377 return;
01378
01379 if (doRemoveArchiveItem(curItem->filename))
01380 getArchiveList();
01381
01382 closePopupMenu();
01383 }
01384
01385 bool MythburnWizard::doRemoveArchiveItem(const QString &filename)
01386 {
01387 MSqlQuery query(MSqlQuery::InitCon());
01388 query.prepare("DELETE FROM archiveitems WHERE filename = :FILENAME;");
01389 query.bindValue(":FILENAME", filename);
01390 query.exec();
01391
01392 return (query.isActive() && query.numRowsAffected());
01393 }
01394
01395 void MythburnWizard::showEditMetadataDialog()
01396 {
01397 UIListBtnTypeItem *item = archive_list->GetItemCurrent();
01398 ArchiveItem *curItem = (ArchiveItem *) item->getData();
01399
01400 if (!curItem)
01401 return;
01402
01403 EditMetadataDialog editDialog(curItem, gContext->GetMainWindow(),
01404 "edit_metadata", "mythburn-", "edit metadata");
01405 if (kDialogCodeRejected != editDialog.exec())
01406 {
01407
01408 titleChanged(item);
01409 item->setText(curItem->title);
01410 }
01411 }
01412
01413 void MythburnWizard::setDestination(int item)
01414 {
01415 if (item < 0 || item > ArchiveDestinationsCount - 1)
01416 item = 0;
01417
01418 destination_no = item;
01419 if (destination_text)
01420 {
01421 destination_text->SetText(ArchiveDestinations[item].description);
01422 }
01423
01424 archiveDestination = ArchiveDestinations[item];
01425
01426 switch(item)
01427 {
01428 case AD_DVD_SL:
01429 case AD_DVD_DL:
01430 filename_edit->hide();
01431 find_button->hide();
01432 eraseDvdRw_check->hide();
01433 eraseDvdRw_text->hide();
01434 doBurn_check->show();
01435 doBurn_text->show();
01436 break;
01437 case AD_DVD_RW:
01438 filename_edit->hide();
01439 find_button->hide();
01440 eraseDvdRw_check->show();
01441 eraseDvdRw_text->show();
01442 doBurn_check->show();
01443 doBurn_text->show();
01444 break;
01445 case AD_FILE:
01446 long long dummy;
01447 ArchiveDestinations[item].freeSpace =
01448 getDiskSpace(filename_edit->getText(), dummy, dummy);
01449
01450 filename_edit->show();
01451 find_button->show();
01452 eraseDvdRw_check->hide();
01453 eraseDvdRw_text->hide();
01454 doBurn_check->hide();
01455 doBurn_text->hide();
01456 break;
01457 }
01458
01459
01460 if (ArchiveDestinations[item].freeSpace != -1)
01461 {
01462 freespace_text->SetText(formatSize(ArchiveDestinations[item].freeSpace, 2));
01463 freeSpace = ArchiveDestinations[item].freeSpace / 1024;
01464 }
01465 else
01466 {
01467 freespace_text->SetText("Unknown");
01468 freeSpace = 0;
01469 }
01470
01471 buildFocusList();
01472 }
01473
01474 void MythburnWizard::handleFind(void)
01475 {
01476 FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(),
01477 "file_selector", "mytharchive-", "file selector");
01478 qApp->unlock();
01479 bool res = (kDialogCodeRejected != selector.exec());
01480
01481 if (res)
01482 {
01483 filename_edit->setText(selector.getSelected());
01484 filenameEditLostFocus();
01485 }
01486 qApp->lock();
01487 }
01488
01489 void MythburnWizard::filenameEditLostFocus()
01490 {
01491 long long dummy;
01492 ArchiveDestinations[AD_FILE].freeSpace =
01493 getDiskSpace(filename_edit->getText(), dummy, dummy);
01494
01495 saveFilename = filename_edit->getText();
01496
01497
01498
01499 if (ArchiveDestinations[AD_FILE].freeSpace == -1)
01500 {
01501 QString dir = filename_edit->getText();
01502 int pos = dir.findRev('/');
01503 if (pos > 0)
01504 dir = dir.left(pos);
01505 else
01506 dir = "/";
01507
01508 ArchiveDestinations[AD_FILE].freeSpace = getDiskSpace(dir, dummy, dummy);
01509 }
01510
01511 if (ArchiveDestinations[AD_FILE].freeSpace != -1)
01512 {
01513 freespace_text->SetText(formatSize(ArchiveDestinations[AD_FILE].freeSpace, 2));
01514 freeSpace = ArchiveDestinations[AD_FILE].freeSpace / 1024;
01515 }
01516 else
01517 {
01518 freespace_text->SetText("Unknown");
01519 freeSpace = 0;
01520 }
01521 }
01522
01523 void MythburnWizard::runScript()
01524 {
01525 QString tempDir = getTempDirectory();
01526 QString logDir = tempDir + "logs";
01527 QString configDir = tempDir + "config";
01528 QString commandline;
01529
01530
01531 if (QFile::exists(logDir + "/progress.log"))
01532 QFile::remove(logDir + "/progress.log");
01533
01534
01535 if (QFile::exists(logDir + "/mythburncancel.lck"))
01536 QFile::remove(logDir + "/mythburncancel.lck");
01537
01538 createConfigFile(configDir + "/mydata.xml");
01539 commandline = "python " + gContext->GetShareDir() + "mytharchive/scripts/mythburn.py";
01540 commandline += " -j " + configDir + "/mydata.xml";
01541 commandline += " -l " + logDir + "/progress.log";
01542 commandline += " > " + logDir + "/mythburn.log 2>&1 &";
01543
01544 gContext->SaveSetting("MythArchiveLastRunStatus", "Running");
01545
01546 int state = system(commandline);
01547
01548 if (state != 0)
01549 {
01550 MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Myth Archive"),
01551 QObject::tr("It was not possible to create the DVD. "
01552 " An error occured when running the scripts") );
01553 done(Rejected);
01554 return;
01555 }
01556
01557 done(Accepted);
01558 }
01559
01560 void MythburnWizard::handleAddRecording()
01561 {
01562 RecordingSelector selector(gContext->GetMainWindow(),
01563 "recording_selector", "mytharchive-", "recording selector");
01564 selector.exec();
01565
01566 getArchiveList();
01567 }
01568
01569 void MythburnWizard::handleAddVideo()
01570 {
01571 MSqlQuery query(MSqlQuery::InitCon());
01572 query.prepare("SELECT title FROM videometadata");
01573 query.exec();
01574 if (query.isActive() && query.numRowsAffected())
01575 {
01576 }
01577 else
01578 {
01579 MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Video Selector"),
01580 QObject::tr("You don't have any videos!"));
01581 return;
01582 }
01583
01584 VideoSelector selector(gContext->GetMainWindow(),
01585 "video_selector", "mytharchive-", "video selector");
01586 selector.exec();
01587
01588 getArchiveList();
01589 }
01590
01591 void MythburnWizard::handleAddFile()
01592 {
01593 QString filter = gContext->GetSetting("MythArchiveFileFilter",
01594 "*.mpg *.mpeg *.mov *.avi *.nuv");
01595
01596 FileSelector selector(FSTYPE_FILELIST, "/", filter, gContext->GetMainWindow(),
01597 "file_selector", "mytharchive-", "file selector");
01598 selector.exec();
01599
01600 getArchiveList();
01601 }
01602
01603