bool SelectDestination::Create(void)
{
    bool foundtheme = false;

    // Load the theme for this screen
    foundtheme = LoadWindowFromXML("mytharchive-ui.xml", "selectdestination", this);

    if (!foundtheme)
        return false;

    bool err = false;
    UIUtilE::Assign(this, m_createISOCheck, "makeisoimage_check", &err);
    UIUtilE::Assign(this, m_doBurnCheck, "burntodvdr_check", &err);
    UIUtilE::Assign(this, m_doBurnText, "burntodvdr_text", &err);
    UIUtilE::Assign(this, m_eraseDvdRwCheck, "erasedvdrw_check", &err);
    UIUtilE::Assign(this, m_eraseDvdRwText, "erasedvdrw_text", &err);
    UIUtilE::Assign(this, m_nextButton, "next_button", &err);
    UIUtilE::Assign(this, m_prevButton, "prev_button", &err);
    UIUtilE::Assign(this, m_cancelButton, "cancel_button", &err);
    UIUtilE::Assign(this, m_destinationSelector, "destination_selector", &err);
    UIUtilE::Assign(this, m_destinationText, "destination_text", &err);
    UIUtilE::Assign(this, m_findButton, "find_button", &err);
    UIUtilE::Assign(this, m_filenameEdit, "filename_edit", &err);
    UIUtilE::Assign(this, m_freespaceText, "freespace_text", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'selectdestination'");
        return false;
    }

    connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(handleNextPage()));
    connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(handlePrevPage()));
    connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(handleCancel()));

    connect(m_destinationSelector, SIGNAL(itemSelected(MythUIButtonListItem*)),
            this, SLOT(setDestination(MythUIButtonListItem*)));

    for (int x = 0; x < ArchiveDestinationsCount; x++)
    {
        MythUIButtonListItem *item = new 
            MythUIButtonListItem(m_destinationSelector, tr(ArchiveDestinations[x].name));
        item->SetData(qVariantFromValue(ArchiveDestinations[x].type));
    }
    connect(m_findButton, SIGNAL(Clicked()), this, SLOT(handleFind()));

    connect(m_filenameEdit, SIGNAL(LosingFocus()), this,
            SLOT(filenameEditLostFocus()));

    BuildFocusList();

    SetFocusWidget(m_nextButton);

    loadConfiguration();

    return true;
}
Esempio n. 2
0
 bool ArchiveModule::handleRequest(Request &req, Response &resp) {
     std::string reqtype = req.m_json["reqtype"].asString();
     if (reqtype == "findUnique") {
         return handleFindUnique(req, resp);
     } else if (reqtype == "getDatastoresList") {
         return handleGetDatastoresList(req, resp);
     } else if (reqtype == "registerDatastore") {
         return handleRegisterDatastore(req, resp);
     } else if (reqtype == "insert") {
         return handleInsert(req, resp);
     } else if (reqtype == "update") {
         return handleUpdate(req, resp);
     } else if (reqtype == "find") {
         return handleFind (req, resp);
     } else if (reqtype == "remove") {
         return handleRemove(req, resp);
     }
     return false;
 }
Esempio n. 3
0
/* Find/Replace dialog */
TextFindDialog::TextFindDialog(QPlasmaTextDoc* parent, bool replace)
              : QDialog(parent)
{
    s_findSettings.current = this;
    fDocument = parent;
    setAttribute(Qt::WA_DeleteOnClose);
    if (replace) {
        setWindowTitle(tr("Replace..."));
        setWindowIcon(qStdIcon("edit-find-replace"));
    } else {
        setWindowTitle(tr("Find..."));
        setWindowIcon(qStdIcon("edit-find"));
    }

    fFindText = new QLineEdit(s_findSettings.text, this);
    if (replace)
        fNewText = new QLineEdit(s_findSettings.newText, this);
    else
        fNewText = NULL;
    fCaseSensitive = new QCheckBox(tr("&Case sensitive"), this);
    fRegEx = new QCheckBox(tr("&Regular expression search"), this);
    fWholeWord = new QCheckBox(tr("Match &whole word"), this);
    fReverse = new QCheckBox(tr("Search &up"), this);
    fFindText->selectAll();
    fCaseSensitive->setChecked(s_findSettings.cs);
    fRegEx->setChecked(s_findSettings.regex);
    fWholeWord->setChecked(s_findSettings.wo);
    fReverse->setChecked(s_findSettings.reverse);

    QWidget* buttonPanel = new QWidget(this);
    QPushButton* btnFind = new QPushButton(replace ? tr("&Replace") : tr("&Find"), buttonPanel);
    QPushButton* btnReplaceAll = NULL;
    if (replace) {
        btnReplaceAll = new QPushButton(tr("Replace &All"), buttonPanel);
        fBtnSkip = new QPushButton(tr("&Skip"), buttonPanel);
        fBtnSkip->setEnabled(false);
    }
    QPushButton* btnCancel = new QPushButton(tr("&Cancel"), buttonPanel);

    QGridLayout* buttonLayout = new QGridLayout(buttonPanel);
    buttonLayout->setContentsMargins(0, 0, 0, 0);
    buttonLayout->setVerticalSpacing(4);
    int idx = 0;
    buttonLayout->addWidget(btnFind, idx++, 0);
    if (replace) {
        buttonLayout->addWidget(btnReplaceAll, idx++, 0);
        buttonLayout->addWidget(fBtnSkip, idx++, 0);
    }
    buttonLayout->addWidget(btnCancel, idx++, 0);
    buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), idx, 0);

    QGridLayout* layout = new QGridLayout(this);
    layout->setContentsMargins(8, 8, 8, 8);
    layout->setVerticalSpacing(4);
    layout->setHorizontalSpacing(8);
    idx = 0;
    layout->addWidget(new QLabel(tr("Search string:"), this), idx, 0);
    layout->addWidget(fFindText, idx++, 1);
    if (replace) {
        layout->addWidget(new QLabel(tr("Replace with:"), this), idx, 0);
        layout->addWidget(fNewText, idx++, 1);
    }
    layout->addItem(new QSpacerItem(0, 16, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum), idx++, 0, 1, 2);
    layout->addWidget(fCaseSensitive, idx++, 1);
    layout->addWidget(fRegEx, idx++, 1);
    layout->addWidget(fWholeWord, idx++, 1);
    layout->addWidget(fReverse, idx++, 1);
    layout->addWidget(buttonPanel, 0, 2, idx, 1);

    connect(btnFind, SIGNAL(clicked()), this, SLOT(handleFind()));
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
    if (replace) {
        connect(btnReplaceAll, SIGNAL(clicked()), this, SLOT(handleReplaceAll()));
        connect(fBtnSkip, SIGNAL(clicked()), this, SLOT(handleSkip()));
    }

    resize(sizeHint().width() * 1.5, sizeHint().height());
}