Ejemplo n.º 1
0
void FunctionDialog::setMonitorFunction(void)
{
    QString function = m_functionList->GetValue();
    bool enabled = (m_enabledCheck->GetCheckState() == MythUIStateType::Full);
    bool showNotifications = (m_notificationCheck->GetCheckState() == MythUIStateType::Full);

    LOG(VB_GENERAL, LOG_INFO,
        "Monitor id : " + QString::number(m_monitor->id) +
        " function change " + m_monitor->function + " -> " + function +
        ", enable value " + QString::number(m_monitor->enabled) + " -> " + QString::number(enabled) +
        ", notification value " + QString::number(m_monitor->showNotifications) + " -> " + QString::number(showNotifications));

    m_monitor->showNotifications = showNotifications;
    ZMClient::get()->saveNotificationMonitors();

    if ((m_monitor->function == function) && (m_monitor->enabled == enabled))
    {
        LOG(VB_GENERAL, LOG_WARNING,
            "Monitor Function/Enable values not changed so not updating.");
        emit haveResult(false);
        Close();
        return;
    }

    ZMClient::get()->setMonitorFunction(m_monitor->id, function, enabled);

    emit haveResult(true);

    Close();
}
Ejemplo n.º 2
0
void FileSelector::cancelPressed()
{
    if (m_selectorType == FSTYPE_FILELIST)
        emit haveResult(true);
    else
        emit haveResult(QString());
    Close();
}
Ejemplo n.º 3
0
void GameUI::searchStart(void)
{
    MythGenericTree *parent = m_gameUITree->GetCurrentNode()->getParent();

    if (parent != NULL)
    {
        QStringList childList;
        QList<MythGenericTree*>::iterator it;
        QList<MythGenericTree*> *children = parent->getAllChildren();

        for (it = children->begin(); it != children->end(); ++it)
        {
            MythGenericTree *child = *it;
            childList << child->GetText();
        }

        MythScreenStack *popupStack =
            GetMythMainWindow()->GetStack("popup stack");
        MythUISearchDialog *searchDialog = new MythUISearchDialog(popupStack,
            tr("Game Search"), childList, true, "");

        if (searchDialog->Create())
        {
            connect(searchDialog, SIGNAL(haveResult(QString)),
                    SLOT(searchComplete(QString)));

            popupStack->AddScreen(searchDialog);
        }
        else
            delete searchDialog;
    }
}
Ejemplo n.º 4
0
void EditMetadataDialog::searchGenre()
{
    QString msg = tr("Select a Genre");
    QStringList searchList = Metadata::fillFieldList("genre");
    // load genre list
    /*
    searchList.clear();
    for (int x = 0; x < genre_table_size; x++)
        searchList.push_back(QString(genre_table[x]));
    searchList.sort();
    */

    QString s = m_metadata->Genre();

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s);

    if (!searchDlg->Create())
    {
        delete searchDlg;
        return;
    }

    connect(searchDlg, SIGNAL(haveResult(QString)), SLOT(setGenre(QString)));

    popupStack->AddScreen(searchDlg);
}
Ejemplo n.º 5
0
void MetadataResultsDialog::sendResult(MythUIButtonListItem* item)
{
    RefCountHandler<MetadataLookup> lookup = m_results.takeAtAndDecr(item->GetData().value<uint>());
    m_results.clear();
    emit haveResult(lookup);
    Close();
}
Ejemplo n.º 6
0
void EditMetadataDialog::OnArtworkSearchDone(MetadataLookup *lookup)
{
    if (!lookup)
        return;

    if (m_busyPopup)
    {
        m_busyPopup->Close();
        m_busyPopup = NULL;
    }

    VideoArtworkType type = lookup->GetData().value<VideoArtworkType>();
    ArtworkList list = lookup->GetArtwork(type);

    if (list.isEmpty())
    {
        MythWarningNotification n(tr("No image found"), tr("Metadata Editor"));
        GetNotificationCenter()->Queue(n);
        return;
    }
    MythScreenStack *m_popupStack =
                     GetMythMainWindow()->GetStack("popup stack");

    ImageSearchResultsDialog *resultsdialog =
          new ImageSearchResultsDialog(m_popupStack, list, type);

    connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)),
            SLOT(OnSearchListSelection(ArtworkInfo, VideoArtworkType)));

    if (resultsdialog->Create())
        m_popupStack->AddScreen(resultsdialog);
}
Ejemplo n.º 7
0
void EditMetadataDialog::okPressed(void)
{
    m_sourceMetadata->title = m_titleEdit->GetText();
    m_sourceMetadata->subtitle = m_subtitleEdit->GetText();
    m_sourceMetadata->startDate = m_startdateEdit->GetText();
    m_sourceMetadata->startTime = m_starttimeEdit->GetText();
    m_sourceMetadata->description = m_descriptionEdit->GetText();
    m_sourceMetadata->editedDetails = true;

    emit haveResult(true, m_sourceMetadata);
    Close();
}
Ejemplo n.º 8
0
void SelectDestination::handleFind(void)
{
    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

    FileSelector *selector = new
            FileSelector(mainStack, NULL, FSTYPE_DIRECTORY, m_filenameEdit->GetText(), "*.*");

    connect(selector, SIGNAL(haveResult(QString)),
            this, SLOT(fileFinderClosed(QString)));

    if (selector->Create())
        mainStack->AddScreen(selector);
}
Ejemplo n.º 9
0
void MythTextInputDialog::sendResult()
{
    QString inputString = m_textEdit->GetText();
    emit haveResult(inputString);

    if (m_retObject)
    {
        DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0,
                                                            inputString, "");
        QCoreApplication::postEvent(m_retObject, dce);
    }

    Close();
}
Ejemplo n.º 10
0
void MythConfirmationDialog::sendResult(bool ok)
{
    emit haveResult(ok);

    if (m_retObject)
    {
        int res = 0;
        if (ok)
            res = 1;

        DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, "",
                                                               m_resultData);
        QCoreApplication::postEvent(m_retObject, dce);
    }

    Close();
}
Ejemplo n.º 11
0
void MythUISearchDialog::slotSendResult()
{
    if (!m_itemList->GetItemCurrent())
        return;

    QString result = m_itemList->GetValue();

    emit haveResult(result);

    if (m_retObject)
    {
        DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0,
                                                            result, "");
        QCoreApplication::postEvent(m_retObject, dce);
    }

    Close();
}
Ejemplo n.º 12
0
void EditMetadataDialog::searchAlbum()
{
    QString msg = tr("Select an Album");
    QStringList searchList = Metadata::fillFieldList("album");
    QString s = m_metadata->Album();

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s);

    if (!searchDlg->Create())
    {
        delete searchDlg;
        return;
    }

    connect(searchDlg, SIGNAL(haveResult(QString)), SLOT(setAlbum(QString)));

    popupStack->AddScreen(searchDlg);
}
Ejemplo n.º 13
0
void ImportNative::showList(const QString &caption, QString &value,
                            const char *slot)
{
    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");

    MythUISearchDialog *searchDialog = new
    MythUISearchDialog(popupStack, caption, m_searchList, true, value);

    if (!searchDialog->Create())
    {
        delete searchDialog;
        searchDialog = NULL;
        return;
    }

    connect(searchDialog, SIGNAL(haveResult(QString)), this, slot);

    popupStack->AddScreen(searchDialog);
}
Ejemplo n.º 14
0
void MythTimeInputDialog::okClicked(void)
{
    QDate date = m_dateList->GetDataValue().toDate();
    QTime time = m_timeList->GetDataValue().toTime();

    QDateTime dateTime = QDateTime(date, time, Qt::LocalTime).toUTC();

    emit haveResult(dateTime);

    if (m_retObject)
    {
        QVariant data(dateTime);
        DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, "",
                                                               data);
        QCoreApplication::postEvent(m_retObject, dce);
    }

    Close();
}
Ejemplo n.º 15
0
void BookmarkEditor::slotFindCategory(void)
{
    QStringList list;

    GetCategoryList(list);

    QString title = tr("Select a category");

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");

    m_searchDialog = new MythUISearchDialog(popupStack, title, list,
                                            true, m_categoryEdit->GetText());

    if (!m_searchDialog->Create())
    {
        delete m_searchDialog;
        m_searchDialog = NULL;
        return;
    }

    connect(m_searchDialog, SIGNAL(haveResult(QString)), SLOT(slotCategoryFound(QString)));

    popupStack->AddScreen(m_searchDialog);
}
Ejemplo n.º 16
0
void ImportFile::cancelPressed()
{
    emit haveResult(false);
    Close();
}
Ejemplo n.º 17
0
void EditMetadataDialog::cancelPressed(void)
{
    emit haveResult(false, m_sourceMetadata);
    Close();
}
Ejemplo n.º 18
0
    // returns true if no completion is required
    bool DoCheck()
    {
        ParentalLevel which_level(m_toLevel);

        // No password for level 1 and you can always switch down from your
        // current level.
        if (which_level == ParentalLevel::plLowest ||
            which_level <= ParentalLevel(m_fromLevel))
            return true;

        // If there isn't a password at the current level, and
        // none of the levels below, we are done.
        // The assumption is that if you password protected lower levels,
        // and a higher level does not have a password it is something
        // you've overlooked (rather than intended).
        if (!m_pm.FirstAtOrBelow(which_level.GetLevel()).length())
            return true;

        // See if we recently (and successfully) asked for a password
        QString last_time_stamp = gCoreContext->GetSetting("VideoPasswordTime");
        int last_parent_lvl = gCoreContext->GetNumSetting("VideoPasswordLevel", -1);

        if (!last_time_stamp.length() || last_parent_lvl == -1)
        {
            VERBOSE(VB_IMPORTANT,
                    QString("%1: Could not read password/pin time "
                            "stamp. This is only an issue if it "
                            "happens repeatedly.").arg(__FILE__));
        }
        else
        {
            QDateTime curr_time = QDateTime::currentDateTime();
            QDateTime last_time =
                    QDateTime::fromString(last_time_stamp, Qt::ISODate);

            if (ParentalLevel(last_parent_lvl) >= which_level &&
                last_time.secsTo(curr_time) < 120)
            {
                // Two minute window
                last_time_stamp = curr_time.toString(Qt::ISODate);
                gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
                gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
                return true;
            }
        }

        m_validPasswords = m_pm.AtOrAbove(which_level.GetLevel());

        // If there isn't a password for this level or higher levels, treat
        // the next lower password as valid. This is only done so people
        // cannot lock themselves out of the setup.
        if (!m_validPasswords.size())
        {
            QString pw = m_pm.FirstAtOrBelow(which_level.GetLevel());
            if (pw.length())
                m_validPasswords.push_back(pw);
        }

        // There are no suitable passwords.
        if (!m_validPasswords.size())
            return true;

        // If we got here, there is a password, and there's no backing down.
        MythScreenStack *popupStack =
                GetMythMainWindow()->GetStack("popup stack");

        MythTextInputDialog *pwd =
                new MythTextInputDialog(popupStack,
                        QObject::tr("Parental PIN:"), FilterNone, true);

        connect(pwd, SIGNAL(haveResult(QString)),
                SLOT(OnPasswordEntered(QString)));
        connect(pwd, SIGNAL(Exiting()), SLOT(OnPasswordExit()));

        if (pwd->Create())
            popupStack->AddScreen(pwd, false);

        return false;
    }
Ejemplo n.º 19
0
void ImageSearchResultsDialog::sendResult(MythUIButtonListItem* item)
{
    emit haveResult(qVariantValue<ArtworkInfo>(item->GetData()),
                    m_type);
    Close();
}
Ejemplo n.º 20
0
void RecordingSelector::OKPressed()
{
    // loop though selected recordings and add them to the list
    ProgramInfo *p;
    ArchiveItem *a;

    // remove any items that have been removed from the list
    QList<ArchiveItem *> tempAList;
    for (int x = 0; x < m_archiveList->size(); x++)
    {
        a = m_archiveList->at(x);
        bool found = false;

        for (int y = 0; y < m_selectedList.size(); y++)
        {
            p = m_selectedList.at(y);
            if (a->type != "Recording" || a->filename == p->GetPlaybackURL(false, true))
            {
                found = true;
                break;
            }
        }

        if (!found)
            tempAList.append(a);
    }

    for (int x = 0; x < tempAList.size(); x++)
        m_archiveList->removeAll(tempAList.at(x));

    // remove any items that are already in the list
    QList<ProgramInfo *> tempSList;
    for (int x = 0; x < m_selectedList.size(); x++)
    {
        p = m_selectedList.at(x);

        for (int y = 0; y < m_archiveList->size(); y++)
        {
            a = m_archiveList->at(y);
            if (a->filename == p->GetPlaybackURL(false, true))
            {
                tempSList.append(p);
                break;
            }
        }
    }

    for (int x = 0; x < tempSList.size(); x++)
        m_selectedList.removeAll(tempSList.at(x));

    // add all that are left
    for (int x = 0; x < m_selectedList.size(); x++)
    {
        p = m_selectedList.at(x);
        a = new ArchiveItem;
        a->type = "Recording";
        a->title = p->GetTitle();
        a->subtitle = p->GetSubtitle();
        a->description = p->GetDescription();
        a->startDate = p->GetScheduledStartTime().toString("dd MMM yy");
        a->startTime = p->GetScheduledStartTime().toString("(hh:mm)");
        a->size = p->GetFilesize();
        a->filename = p->GetPlaybackURL(false, true);
        a->hasCutlist = p->HasCutlist();
        a->useCutlist = false;
        a->duration = 0;
        a->cutDuration = 0;
        a->videoWidth = 0;
        a->videoHeight = 0;
        a->fileCodec = "";
        a->videoCodec = "";
        a->encoderProfile = NULL;
        a->editedDetails = false;
        m_archiveList->append(a);
    }

    emit haveResult(true);
    Close();
}
Ejemplo n.º 21
0
void RecordingSelector::cancelPressed()
{
    emit haveResult(false);
    Close();
}
Ejemplo n.º 22
0
void FileSelector::OKPressed()
{
    if (m_selectorType == FSTYPE_FILELIST && m_archiveList)
    {
        // loop though selected files and add them to the list
        QString f;
        ArchiveItem *a;

        // remove any items that have been removed from the list
        QList<ArchiveItem *> tempAList;
        for (int x = 0; x < m_archiveList->size(); x++)
        {
            a = m_archiveList->at(x);
            bool found = false;

            for (int y = 0; y < m_selectedList.size(); y++)
            {
                f = m_selectedList.at(y);
                if (a->type != "File" || a->filename == f)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
                tempAList.append(a);
        }

        for (int x = 0; x < tempAList.size(); x++)
            m_archiveList->removeAll(tempAList.at(x));

        // remove any items that are already in the list
        QStringList tempSList;
        for (int x = 0; x < m_selectedList.size(); x++)
        {
            f = m_selectedList.at(x);

            for (int y = 0; y < m_archiveList->size(); y++)
            {
                a = m_archiveList->at(y);
                if (a->filename == f)
                {
                    tempSList.append(f);
                    break;
                }
            }
        }

        for (int x = 0; x < tempSList.size(); x++)
            m_selectedList.removeAll(tempSList.at(x));

        // add all that are left
        for (int x = 0; x < m_selectedList.size(); x++)
        {
            f = m_selectedList.at(x);

            QFile file(f);
            if (file.exists())
            {
                QString title = f;
                int pos = f.lastIndexOf('/');
                if (pos > 0)
                    title = f.mid(pos + 1);

                a = new ArchiveItem;
                a->type = "File";
                a->title = title;
                a->subtitle = "";
                a->description = "";
                a->startDate = "";
                a->startTime = "";
                a->size = (int64_t)file.size();
                a->filename = f;
                a->hasCutlist = false;
                a->useCutlist = false;
                a->duration = 0;
                a->cutDuration = 0;
                a->videoWidth = 0;
                a->videoHeight = 0;
                a->fileCodec = "";
                a->videoCodec = "";
                a->encoderProfile = NULL;
                a->editedDetails = false;
                m_archiveList->append(a);
            }
        }
    }
    else
    {
        MythUIButtonListItem *item = m_fileButtonList->GetItemCurrent();
        FileData *fileData = qVariantValue<FileData*>(item->GetData());

        if (m_selectorType == FSTYPE_DIRECTORY)
        {
            if (!fileData->directory)
            {
                ShowOkPopup(tr("The selected item is not a directory!"));
                return;
            }

            if (fileData->filename != "..")
            {
                if (!m_curDirectory.endsWith("/"))
                    m_curDirectory += "/";
                m_curDirectory += fileData->filename;
            }
        }
        else
        {
            if (fileData->directory)
            {
                if (!m_curDirectory.endsWith("/"))
                    m_curDirectory += "/";
            }
            else
            {
                if (!m_curDirectory.endsWith("/"))
                    m_curDirectory += "/";
                m_curDirectory += fileData->filename;
            }
        }
    }

    if (m_selectorType == FSTYPE_FILELIST)
        emit haveResult(true);
    else
        emit haveResult(getSelected());
    Close();
}