示例#1
0
void CQReportDefinition::btnAdvancedClicked()
{
    if (mAdvanced)
    {
        if (CQMessageBox::question(NULL, "Report Conversion",
                                   "Converting an advanced report to a table may result in loss of customization.\n"
                                   "Do you want to proceed?",
                                   QMessageBox::Ok | QMessageBox::Cancel,
                                   QMessageBox::Cancel) == QMessageBox::Ok)
        {
            // We convert the body without the separators to a table.
            mpTableList->clear();

            unsigned C_INT32 i, imax;

            for (i = 0, imax = mpBodyList->count(); i < imax; i++)
                if (static_cast<CQReportListItem *>(mpBodyList->item(i))->getCN().getObjectType()
                        != "Separator")
                    new CQReportListItem(static_cast<CQReportListItem *>(mpBodyList->item(i))->getCN());

            mpHeaderList->clear();
            mpBodyList->clear();
            mpFooterList->clear();

            setAdvancedMode(false);

            mChanged = true;
        }
    }
    else
    {
        // To achieve the same result as with the table we use the preCompileTable
        // method of CReportDefinition. Since we must not change the existing report,
        // which may only be done by btnCommitClicked or leave, we create a temporary
        // copy.
        CReportDefinition * pStore = mpReportDefinition;

        // We avoid the renaming signal.
        mpReportDefinition = new CReportDefinition(TO_UTF8(mpName->text()), mpDataModel);

        mChanged = true;
        save();

        mpReportDefinition->preCompileTable();
        mpReportDefinition->setIsTable(false);

        load();

        delete mpReportDefinition;

        mpReportDefinition = pStore;

        mChanged = true;
    }
}
示例#2
0
/*
 *  Constructs a CQReportDefinition which is a child of 'parent', with the
 *  name 'name'.'
 */
CQReportDefinition::CQReportDefinition(QWidget* parent, const char* name)
    : CopasiWidget(parent, name)
{
    setupUi(this);

    mKey = "";
    mpReportDefinition = NULL;

    // We start with the table since this is simpler.
    setAdvancedMode(false);

    unsigned C_INT32 i;

    for (i = 0; CCopasiTask::TypeName[i] != ""; i++)
        mpTaskBox->insertItem(FROM_UTF8(CCopasiTask::TypeName[i]));
}
示例#3
0
ChannelListDlg::ChannelListDlg(QWidget *parent)
    : QDialog(parent),
    _listFinished(true),
    _ircListModel(this),
    _sortFilter(this),
    _simpleModeSpacer(0),
    _advancedMode(false)
{
    _sortFilter.setSourceModel(&_ircListModel);
    _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive);
    _sortFilter.setFilterKeyColumn(-1);

    ui.setupUi(this);
    ui.advancedModeLabel->setPixmap(QIcon::fromTheme("edit-rename").pixmap(22));

    ui.channelListView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui.channelListView->setSelectionMode(QAbstractItemView::SingleSelection);
    ui.channelListView->setAlternatingRowColors(true);
    ui.channelListView->setTabKeyNavigation(false);
    ui.channelListView->setModel(&_sortFilter);
    ui.channelListView->setSortingEnabled(true);
    ui.channelListView->verticalHeader()->hide();
    ui.channelListView->horizontalHeader()->setStretchLastSection(true);

    ui.searchChannelsButton->setAutoDefault(false);

    setWindowIcon(QIcon::fromTheme("format-list-unordered"));

    connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode()));
    connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch()));
    connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch()));
    connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), &_sortFilter, SLOT(setFilterFixedString(QString)));
    connect(Client::ircListHelper(), SIGNAL(channelListReceived(const NetworkId &, const QStringList &, QList<IrcListHelper::ChannelDescription> )),
        this, SLOT(receiveChannelList(NetworkId, QStringList, QList<IrcListHelper::ChannelDescription> )));
    connect(Client::ircListHelper(), SIGNAL(finishedListReported(const NetworkId &)), this, SLOT(reportFinishedList()));
    connect(Client::ircListHelper(), SIGNAL(errorReported(const QString &)), this, SLOT(showError(const QString &)));
    connect(ui.channelListView, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));

    setAdvancedMode(false);
    enableQuery(true);
    showFilterLine(false);
    showErrors(false);
}
示例#4
0
bool CQReportDefinition::load()
{
    if (!mpReportDefinition) return false;

    // Reset everything.
    mpHeaderList->clear();
    mpBodyList->clear();
    mpFooterList->clear();
    mpTableList->clear();

    mpName->setText(FROM_UTF8(mpReportDefinition->getObjectName()));
    mpTaskBox->setCurrentItem(mpReportDefinition->getTaskType());

    //separator
    if (mpReportDefinition->getSeparator().getStaticString() == "\t")
    {
        mpSeparator->setEnabled(false);
        mpTabCheck->setChecked(true);
    }
    else
    {
        mpSeparator->setEnabled(true);
        mpTabCheck->setChecked(false);
        mpSeparator->setText(FROM_UTF8(mpReportDefinition->getSeparator().getStaticString()));
    }

    mpPrecision->setText(QString::number(mpReportDefinition->getPrecision()));

    std::vector< CRegisteredObjectName > * pList = NULL;
    std::vector< CRegisteredObjectName >::const_iterator it;
    std::vector< CRegisteredObjectName >::const_iterator end;

    // Toggle the display mode.
    if (mpReportDefinition->isTable())
    {
        setAdvancedMode(false);

        mpTitleCheck->setChecked(mpReportDefinition->getTitle());

        pList = mpReportDefinition->getTableAddr();

        for (it = pList->begin(), end = pList->end(); it != end; ++it)
            mpTableList->addItem(new CQReportListItem(*it));
    }
    else
    {
        setAdvancedMode(true);

        pList = mpReportDefinition->getHeaderAddr();

        for (it = pList->begin(), end = pList->end(); it != end; ++it)
            mpHeaderList->addItem(new CQReportListItem(*it));

        pList = mpReportDefinition->getBodyAddr();

        for (it = pList->begin(), end = pList->end(); it != end; ++it)
            mpBodyList->addItem(new CQReportListItem(*it));

        pList = mpReportDefinition->getFooterAddr();

        for (it = pList->begin(), end = pList->end(); it != end; ++it)
            mpFooterList->addItem(new CQReportListItem(*it));
    }

    mChanged = false;
    return true;
}