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 &)));

}
void EditableLevelObjectEntryGroups::exportToROM(WritableROM& rom) {
  
  Taddress exportAddress = initialTableAddress_;
  
  // Get total size of table content
  int exportSize = totalExportedSize();
  
  // If there's not enough space at the table's original location
  // to export it in-place, we have to find a new home for it
  if (exportSize > initialTableContentSize_) {
    // If we already moved banks, throw (we can't get any more room)
/*    if (movedToNewBank_) {
      throw TGenericException(TALES_SRCANDLINE,
                             "EditableLevelObjectEntryGroups::"
                             "exportToROM(WritableROM&)",
                             std::string("Need ")
                             + StringConversion::toString(
                                  exportSize)
                             + " bytes, but already"
                             "moved to new bank");
    } */
    
    // Move to new bank
    exportAddress = moveToNewBank(rom);
    
//    std::cout << exportAddress << std::endl;
  }
  
  exportTable(exportAddress,
              rom);
}
Exemplo n.º 3
0
AccountWindow::AccountWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags)
	:TableWindow(parent, name, wflags)
{
	QStringList nameList;
	QTableWidget *pTable;
	QAction* pAction;

  pTable = TableWindow::getTable();
	m_pDb = ISql::pInstance();

	pAction = new QAction(tr("&New..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_new()));
	MDIWindow::addAction(pAction);

	pAction = new QAction(tr("&Edit..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit()));
	MDIWindow::addAction(pAction, true);

	pAction = new QAction(tr("&Delete"), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
	MDIWindow::addAction(pAction);

	pAction = new QAction(this);
	pAction->setSeparator(true);
	MDIWindow::addAction(pAction);

	pAction = new QAction(tr("&Export all..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable()));
	MDIWindow::addAction(pAction);

	// configure the table
	TableWindow::setWindowIcon(QIcon(":/document.xpm"));
	pTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
	pTable->setSelectionMode(QAbstractItemView::SingleSelection);

	// header
  nameList += tr("Username");
  nameList += tr("Contest");
  nameList += tr("Description");

	setupHeader(nameList);

  pTable->setColumnWidth(Username, 100);
  pTable->setColumnWidth(Contest, 100);
  pTable->setColumnWidth(Description, 200);

  connect(m_pDb, SIGNAL(accountsChanged()), this, SLOT(file_update()));

	file_update();
}
Exemplo n.º 4
0
void __deallocateFile(File * file){
	// Clear sector on sectorTable
	clearSector(file->sector);

	// And clear all necessary sectors for file
	int sectors = (file->size / 512) + 1;
	int i;
	for(i=0;i<sectors;i++)
		clearSector(file->sector+i);

	// Update table on disk, not that expensive
	exportTable();

	// DESTROY FILE HEADER
	disk_cmd fileHeader = {ATA0, file->sector, 0, strlen(_FILE_DELETE)+1,_FILE_DELETE};
	System.writeDisk(&fileHeader);
}
Exemplo n.º 5
0
void createFilesystem(){
	int i;

	__initSectorTable();

	// First chunk is protected
	for(i=0;i<_TABLE_STARTUP_SECTOR;i++)
		setSector(i);

	// Sector table is protected
	for(i=0;i<_TABLE_SECTOR_SIZE;i++)
		setSector(_TABLE_STARTUP_SECTOR+i);

	exportTable();


	__initFileTable();
}
Exemplo n.º 6
0
// Allocate a file on disk!
void __allocateFile(File * file){
	// Set sector on sectorTable
	setSector(file->sector);

	// And set all necessary sectors for file
	int sectors = (file->size / 512) + 1;
	int i;
	for(i=0;i<sectors;i++)
		setSector(file->sector+i);

	// Update table on disk, not that expensive
	exportTable();

	// FILE HEADER
	// 255 bytes: name
	// 4 bytes: size
	// 4 bytes: parent sector
	// FILE FOOTER

	int base = 0;

	disk_cmd fileHeader = {ATA0, file->sector, base, strlen(_FILE_HEADER)+1,_FILE_HEADER};
	base += strlen(_FILE_HEADER)+1;

	// Now prepare file header on sector
	disk_cmd fileName = {ATA0, file->sector, base, _FILE_NAMELENGTH, file->name};
	base += _FILE_NAMELENGTH;

	disk_cmd fileSize = {ATA0, file->sector,base, sizeof(int), (char*)(&(file->size))};
	base += sizeof(int);

	int parentSector = file->parent != NULL ? file->parent->sector : -1;
	disk_cmd fileParent = {ATA0, file->sector, base, sizeof(int), (char *)(&parentSector)};
	base += sizeof(int);

	disk_cmd fileFooter = {ATA0, file->sector, base, strlen(_FILE_FOOTER)+1, _FILE_FOOTER };

	// And allocate it
	System.writeDisk(&fileHeader);
	System.writeDisk(&fileName);
	System.writeDisk(&fileSize);
	System.writeDisk(&fileParent);
	System.writeDisk(&fileFooter);
}
Exemplo n.º 7
0
void ExportDialog::accept() {
  QString sep = boxSeparator->currentText();
  sep.replace(tr("TAB"), "\t", Qt::CaseInsensitive);
  sep.replace(tr("SPACE"), " ");
  sep.replace("\\s", " ");
  sep.replace("\\t", "\t");

  if (sep.contains(QRegExp("[0-9.eE+-]"))) {
    QMessageBox::warning(0, tr("Import options error"),
                         tr("The separator must not contain the following "
                            "characters: 0-9eE.+-"));
    return;
  }

  hide();
  if (boxAllTables->isChecked())
    emit exportAllTables(sep, boxNames->isChecked(), boxSelection->isChecked());
  else
    emit exportTable(boxTable->currentText(), sep, boxNames->isChecked(),
                     boxSelection->isChecked());
  close();
}
Exemplo n.º 8
0
StatsQGroupBox *CreateWidgets::getStatsTableCompleteView() {
    if(CreateWidgets::statTableCompleteView != 0) {
       delete  CreateWidgets::statTableCompleteView;
       CreateWidgets::statTableCompleteView = 0;
    }

    if(CreateWidgets::statTableCompleteView == 0) {
        CreateWidgets::statTableCompleteView =  new StatsQGroupBox;
    }

    // create export button
    QPushButton *exportButton = new QPushButton("Export");
    exportButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    // spacer next to the button
    QSpacerItem *spaceitem = new QSpacerItem(200, 20,QSizePolicy::Expanding, QSizePolicy::Maximum);

    //create the layout
    QHBoxLayout *hboxlayout = new QHBoxLayout;
    hboxlayout->addItem(spaceitem);
    hboxlayout->addWidget(exportButton);

    // create the export and spacer item holder groupbox
    QGroupBox *exportButtonBox = new QGroupBox();
    exportButtonBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    exportButtonBox->setStyleSheet("QGroupBox{border:0px solid gray;border:0px;margin: 0ex;}");
    exportButtonBox->setLayout(hboxlayout);


    //create the table
    QTableView *statTableView = CreateWidgets::getStatsTableView();
    statTableView->setStyleSheet("QTableView{border:0px solid gray;border:0px;margin: 0ex;}");

    // create the entire layout to hold
    QVBoxLayout *vboxlayout = new QVBoxLayout;
    statTableView->setStyleSheet("QGroupBox{border:0px solid gray;border-radius:0px;margin-top: 0ex;}");

    vboxlayout->addWidget(statTableView);
    vboxlayout->addWidget(exportButtonBox);

    CreateWidgets::statTableCompleteView =  new StatsQGroupBox;
    CreateWidgets::statTableCompleteView->statsTableView =statTableView;
    CreateWidgets::statTableCompleteView->setLayout(vboxlayout);
    CreateWidgets::statTableCompleteView->setStyleSheet("QGroupBox{border:0px solid gray;border-radius:0px;margin-top: 0ex;}");

    connect(exportButton, SIGNAL(clicked()), CreateWidgets::statTableCompleteView, SLOT(exportTable()));
    return CreateWidgets::statTableCompleteView;
}
Exemplo n.º 9
0
AirSpaceWindow::AirSpaceWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags, IDataBase::SourceType src)
  :TableWindow(parent, name, wflags)
{
  QStringList nameList;
  QAction* pAction;
  QTableWidget *pTable;

  pTable = TableWindow::getTable();
  m_pWebMapView = NULL;
  m_pAirSpaceView = NULL;
  m_externSelect = false;

  switch(src)
  {
    case IDataBase::SqlDB:
      m_pDb = ISql::pInstance();

      connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

      pAction = new QAction(tr("&Edit"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit()));
      MDIWindow::addAction(pAction, true);

      pAction = new QAction(tr("&Delete"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
      MDIWindow::addAction(pAction);

      pAction = new QAction(tr("&Add to GPS..."), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS()));
      MDIWindow::addAction(pAction, true);
    break;
    case IDataBase::GPSdevice:
    {
      m_pDb = IGPSDevice::pInstance();

      connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

      pAction = new QAction(tr("&Delete"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
      MDIWindow::addAction(pAction);

      pAction = new QAction(tr("&Update"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_update()));
      MDIWindow::addAction(pAction);
    }
    break;
    case IDataBase::File:
    {
      m_pDb = NULL;

      pAction = new QAction(tr("&Add to GPS..."), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS()));
      MDIWindow::addAction(pAction, true);
    }
    break;
  }

  if(src != IDataBase::SqlDB)
  {
    pAction = new QAction(tr("Add to DB..."), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToSqlDB()));
    MDIWindow::addAction(pAction, true);

    pAction = new QAction(tr("&Update"), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_update()));
    MDIWindow::addAction(pAction);
  }

  // import/export
  pAction = new QAction(this);
  pAction->setSeparator(true);
  MDIWindow::addAction(pAction);

  if(src == IDataBase::File)
  {
    pAction = new QAction(tr("&Import..."), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_open()));
    MDIWindow::addAction(pAction);
  }

  pAction = new QAction(tr("&Export all..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable()));
  MDIWindow::addAction(pAction);

  // view
  pAction = new QAction(this);
  pAction->setSeparator(true);
  MDIWindow::addAction(pAction);

  pAction = new QAction(tr("&View..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewAirSpace()));
  MDIWindow::addAction(pAction);

  pAction = new QAction(tr("View &Web Map..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewWebMap()));
  MDIWindow::addAction(pAction, true);

  TableWindow::setWindowIcon(QIcon(":/document.xpm"));

  // configure the table
  pTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
  pTable->setSelectionMode(QAbstractItemView::ExtendedSelection);

  // header
  nameList += tr("Name");
  nameList += tr("Low [m]");
  nameList += tr("High [m]");
  nameList += tr("Class");
  nameList += tr("Comment");
  setupHeader(nameList);

  pTable->setColumnWidth(Name, 200);
  pTable->setColumnWidth(High, 100);
  pTable->setColumnWidth(Low, 100);
  pTable->setColumnWidth(Class, 80);
  pTable->setColumnWidth(Comment, 750);

  connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

  if(src == IDataBase::File)
  {
    file_open();
  }
  else
  {
    file_update();
  }
}