Exemplo n.º 1
0
void frmMainStateTable::setupUI(bool hasRowLabels_)
{
    ui = createUI();
    ui->setupUI(tableColumns(), hasRowLabels_, static_cast<QWidget*>(this->parent()));

    ui->toolbarDateBeginEdit->setDate(QDate::fromJulianDay(m_portfolio.startDate()));
    ui->toolbarDateEndEdit->setDate(QDate::fromJulianDay(m_portfolio.endDate()));
    setSortDropDown();

    connect(ui->toolbarDateBeginEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab()));
    connect(ui->toolbarDateEndEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab()));
    connect(ui->toolbarSortCmb, SIGNAL(activated(int)), this, SLOT(sortIndexChanged(int)));
    connect(ui->toolbarReorder, SIGNAL(triggered()), this, SLOT(modifyColumns()));
    connect(ui->toolbarExport, SIGNAL(triggered()), ui->table, SLOT(exportTable()));
    connect(ui->tableCopy, SIGNAL(activated()), ui->table, SLOT(copyTable()));
	connect(ui->toolbar1D, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbar3M, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbar6M, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbarYTD, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbar1Y, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbar5Y, SIGNAL(triggered()), this, SLOT(dateClicked()));
    connect(ui->toolbarMax, SIGNAL(triggered()), this, SLOT(dateClicked()));
    refreshTab();

    connect(ui->table,SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(cellSelected(const QModelIndex &)));

}
Exemplo n.º 2
0
void frmMainStateTable::sortIndexChanged(int index_)
{
    int columnID = ui->toolbarSortCmb->itemData(index_).toInt();
    switch(columnID)
    {
    case -1:
        m_settings.setViewableColumnsSorting(columnEnumValue(), QList<orderBy>());
        break;
    case -2:
        {
            frmSort f(m_settings.viewableColumnsSorting(columnEnumValue()), tableColumns(), static_cast<QWidget*>(this->parent()));
            if (f.exec())
                 m_settings.setViewableColumnsSorting(columnEnumValue(), f.getReturnValues());
            else
            {
                setSortDropDown();
                return;
            }
        }
        break;
    default:
        m_settings.setViewableColumnsSorting(columnEnumValue(), QList<orderBy>() << orderBy(columnID, orderBy::order_ascending));
        break;
    }
    setSortDropDown();
    static_cast<mpiViewModelBase*>(ui->table->model())->setColumnSort(m_settings.viewableColumnsSorting(columnEnumValue()));
}
Exemplo n.º 3
0
bool SyncJournalDb::updateErrorBlacklistTableStructure()
{
    QStringList columns = tableColumns("blacklist");
    bool re = true;

    // check if the file_id column is there and create it if not
    if( !checkConnect() ) {
        return false;
    }

    if( columns.indexOf(QLatin1String("lastTryTime")) == -1 ) {
        SqlQuery query(_db);
        query.prepare("ALTER TABLE blacklist ADD COLUMN lastTryTime INTEGER(8);");
        if( !query.exec() ) {
            sqlFail("updateBlacklistTableStructure: Add lastTryTime fileid", query);
            re = false;
        }
        query.prepare("ALTER TABLE blacklist ADD COLUMN ignoreDuration INTEGER(8);");
        if( !query.exec() ) {
            sqlFail("updateBlacklistTableStructure: Add ignoreDuration fileid", query);
            re = false;
        }
        commitInternal("update database structure: add lastTryTime, ignoreDuration cols");
    }

    return re;
}
Exemplo n.º 4
0
bool SyncJournalDb::updateDatabaseStructure()
{
    QStringList columns = tableColumns("metadata");
    bool re = true;

    // check if the file_id column is there and create it if not
    if( !checkConnect() ) {
        return false;
    }

    if( columns.indexOf(QLatin1String("fileid")) == -1 ) {
        QSqlQuery query(_db);
        query.prepare("ALTER TABLE metadata ADD COLUMN fileid VARCHAR(128);");
        if( !query.exec() ) {
            sqlFail("updateDatabaseStructure: Add column fileid", query);
            re = false;
        }

        query.prepare("CREATE INDEX metadata_file_id ON metadata(fileid);");
        if( ! query.exec() ) {
            sqlFail("updateDatabaseStructure: create index fileid", query);
            re = false;
        }
        commitInternal("update database structure: add fileid col");
    }
    if( columns.indexOf(QLatin1String("remotePerm")) == -1 ) {

        QSqlQuery query(_db);
        query.prepare("ALTER TABLE metadata ADD COLUMN remotePerm VARCHAR(128);");
        if( !query.exec()) {
            sqlFail("updateDatabaseStructure: add column remotePerm", query);
            re = false;
        }
        commitInternal("update database structure (remotePerm");
    }

    if( 1 ) {
        QSqlQuery query(_db);
        query.prepare("CREATE INDEX IF NOT EXISTS metadata_inode ON metadata(inode);");
        if( !query.exec()) {
            sqlFail("updateDatabaseStructure: create index inode", query);
            re = false;
        }
        commitInternal("update database structure: add inode index");

    }

    if( 1 ) {
        QSqlQuery query(_db);
        query.prepare("CREATE INDEX IF NOT EXISTS metadata_pathlen ON metadata(pathlen);");
        if( !query.exec()) {
            sqlFail("updateDatabaseStructure: create index pathlen", query);
            re = false;
        }
        commitInternal("update database structure: add pathlen index");

    }
    return re;
}
Exemplo n.º 5
0
void frmMainStateTable::modifyColumns()
{
    frmColumns f(m_settings.viewableColumns(columnEnumValue()), tableColumns(), static_cast<QWidget*>(this->parent()));
    if (!f.exec())
        return;

    m_settings.setViewableColumns(columnEnumValue(), f.getReturnValues());
    static_cast<mpiViewModelBase*>(ui->table->model())->setViewableColumns(m_settings.viewableColumns(columnEnumValue()));
}
Exemplo n.º 6
0
bool SyncJournalDb::updateDatabaseStructure()
{
    QStringList columns = tableColumns("metadata");
    bool re = true;

    // check if the file_id column is there and create it if not
    if( !checkConnect() ) {
        return false;
    }
    if( columns.indexOf(QLatin1String("fileid")) == -1 ) {

        QSqlQuery query(_db);
        query.prepare("ALTER TABLE metadata ADD COLUMN fileid VARCHAR(128);");
        re = query.exec();

        query.prepare("CREATE INDEX metadata_file_id ON metadata(fileid);");
        re = re && query.exec();

        commitInternal("update database structure");
    }

    return re;
}