Esempio n. 1
0
void PublicTalks::beforePublicTalkComboBoxShown(int rownumber)
{
    // themes combobox
    cPersonComboBox *c = static_cast<cPersonComboBox *>(maintable->cellWidget(rownumber,2));
    cPersonComboBox *speakerCombo = static_cast<cPersonComboBox *>(maintable->cellWidget(rownumber,3));

    QString currentThemeText = c->currentText();
    QTableWidget *table;
    cpersons cp;
    person *speaker = cp.getPerson(speakerCombo->currentText());
    if (speaker) {
        // the speaker selected --> will be shown speaker's themes
        table = this->getSpeakerPublicTalks(0,speaker->id, currentThemeText);
    } else {
        // no speaker selected  --> all themes will be shown
        table = this->getPublicTalksbyLang(currentThemeText);
    }

    //    schoolComboBox *sc = static_cast<schoolComboBox *>(ui->tableSchoolEdit->cellWidget(row,col));
    qDebug() << QString::number(table->rowCount());
    table->setSortingEnabled(true);
    table->sortByColumn(0,Qt::AscendingOrder);
    table->verticalHeader()->hide();
    table->setColumnWidth(0,40);
    table->setColumnWidth(1,200);
    table->setColumnWidth(2,80);
    table->setMinimumWidth(340);
    c->clear();
    c->setModel(table->model());
    c->setView(table);
    c->setModelColumn(1);

    c->setCurrentIndex(c->findText(currentThemeText,Qt::MatchExactly));
}
STOK_GIDEN_PARTI_NO_SECIMI::STOK_GIDEN_PARTI_NO_SECIMI( int p_depo_id, int p_urun_id, int p_secili_parti_no, QWidget * parent ) : SECIM_KERNELI ( parent )
{
    m_depo_id = p_depo_id;
    m_urun_id = p_urun_id;

    SET_SORTING(false);
    SET_WINDOW_SIZE ( 300, 700 );
    QString urun_adi;
    STK_GET_URUN_KODU_ADI( p_urun_id, NULL, &urun_adi );

    SET_HEADERS ( QStringList()<<tr("part_no_id")<<tr("Parti Kodu")<<tr("Ürün Miktarı") << tr("Üretim Tarihi") << tr("Son K. Tarihi"));

    SET_PAGE_TITLE    ( "PARTİ KODU SEÇİMİ" );
    SET_SETTING_NAME  ( "STOK_GIDEN_PARTI_NO_SECIMI" );
    SET_HELP_PAGE     ( tr("stok_giden_parti_no_secimi.html") );

    INIT_KERNEL ( DB );

    QTableWidget * tablewidget = GET_TABLE_WIDGET();

    tablewidget->hideColumn(0);

    tablewidget->setColumnWidth( 1 , 40);
    tablewidget->setColumnWidth( 2 , 20);
    tablewidget->setColumnWidth( 3 , 20);
    tablewidget->setColumnWidth( 4 , 20);

    QList< int > secili_olacak_id;
    secili_olacak_id << p_secili_parti_no;
    SELECT_LINES( secili_olacak_id );
}
Esempio n. 3
0
IRS_IADE_IRSALIYE_SECIMI::IRS_IADE_IRSALIYE_SECIMI ( QString p_irsaliye_tarihi, int p_cari_hesap_id, int p_irsaliye_alis_satis_turu,int p_irsaliye_turu, QWidget * p_parent ) : SECIM_KERNELI ( p_parent )
{
    SET_HELP_PAGE ("irs_iade_irsaliye_secimi.html");

    m_irsaliye_tarihi_bitis     = p_irsaliye_tarihi;
    m_cari_hesap_id             = p_cari_hesap_id;
    m_irsaliye_alis_satis_turu  = p_irsaliye_alis_satis_turu;
    m_irsaliye_turu             = p_irsaliye_turu;


    SET_WINDOW_SIZE     ( 300, 500 );
    SET_SORTING         ( false );
    SET_HEADERS         ( QStringList() << tr("irsaliye_id") << tr("İrsaliye No") <<tr("İrs. Seri No")
                                        << tr("İrs. Tarihi") );

    INIT_KERNEL         ( DB );

    QTableWidget * tableWidget = GET_TABLE_WIDGET();

    tableWidget->setColumnWidth ( FIS_NO_COLUMN,                    100 );
    tableWidget->setColumnWidth ( IRSALIYE_BELGE_SERI_NO_COLUMN,    100 );
    tableWidget->setColumnWidth ( IRSALIYE_TARIHI_COLUMN,           100 );

    SET_SETTING_NAME            ( "IRS_IADE_IRSALIYE_SECIMI" );

    SET_PAGE_TITLE              ( tr ( "İRS - İADE İRSALİYE SEÇİMİ" ) );

    tableWidget->hideColumn     ( 0 );

}
Esempio n. 4
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();
}
Esempio n. 5
0
void model_import_dlg::on_texture_dialog_done(bool add, QString path, QString type)
{
	QTableWidget * table = mesh_tab->findChild<QTableWidget*>("texturesTable");

	int row = 0;

	if (add)
	{
		row = table->rowCount();
		table->insertRow(row);
	}
	else
	{
		row = table->currentRow();
	}

	table->setItem(row, 0, new QTableWidgetItem(path));
	table->setItem(row, 1, new QTableWidgetItem(type));
	table->setColumnWidth(0, 350);
	table->setColumnWidth(1, 150);

	for (int i = 0; i < table->rowCount(); i++)
		for (int j = 0; j < table->columnCount(); j++)
			table->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
}
Esempio n. 6
0
ParamCompareDialog::ParamCompareDialog(QMap<QString, UASParameter* >& paramaterList,
                                       const QString& filename, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ParamCompareDialog),
    m_currentList(&paramaterList),
    m_newList(new QMap<QString, UASParameter*>()),
    m_fileToCompare(filename)
{
    ui->setupUi(this);

    QStringList headerList;
    headerList << tr("Parameter") << tr("Value") << tr("New Value") << tr("Use");

    QTableWidget* table = ui->compareTableWidget;
    table->setColumnCount(headerList.count());
    table->setHorizontalHeaderLabels(headerList);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    table->setAlternatingRowColors(true);
    table->setColumnWidth(PCD_COLUMN_CHECKBOX, 40);

    initConnections();

    if(filename.count()>0){
        QTimer::singleShot(200, this, SLOT(loadParameterWithFile()));
    }

}
Esempio n. 7
0
ServerTab::ServerTab()
{
    //
    QLabel *legendLabel = new QLabel("Liste des clients connectés au serveur.");
    legendLabel->setFixedHeight(40);

    // TabWidget

    QTableWidget *tableWidget = new QTableWidget();
    tableWidget->setColumnCount(6);

    // resize to contents
    tableWidget->setColumnWidth(0, 300);
    tableWidget->setColumnWidth(4, 120);

    QStringList listHeaders;
    listHeaders << "Nom du client" << "ID de connexion" << "Adresse IP" << "Statut" << "Début de connexion" << "Fin de connexion";
    tableWidget->setHorizontalHeaderLabels(listHeaders);
    tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft);


    // Layering

    QVBoxLayout *vl = new QVBoxLayout();
    setLayout(vl);
    vl->addWidget(legendLabel);
    vl->addWidget(tableWidget);
}
Esempio n. 8
0
AppHistoryTab::AppHistoryTab()
{

    //

    QLabel *legendLabel = new QLabel("Historique des applications depuis la connexion au serveur.");
    legendLabel->setFixedHeight(40);


    // TabWidget

    QTableWidget *tableWidget = new QTableWidget();
    tableWidget->setColumnCount(6);

    // resize to contents
    tableWidget->setColumnWidth(0, 300);

    QStringList listHeaders;
    listHeaders << "Nom" << "PID" << "Statut" << "UID" << "Date de début" << "Date de fin";
    tableWidget->setHorizontalHeaderLabels(listHeaders);
    tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft);


    // Layering

    QVBoxLayout *vl = new QVBoxLayout();
    setLayout(vl);
    vl->addWidget(legendLabel);
    vl->addWidget(tableWidget);
}
Esempio n. 9
0
openvolume::openvolume( QWidget * parent ) :
	QDialog( parent )
{
	m_ui = new Ui::openvolume() ;
	m_ui->setupUi( this ) ;
	this->setFixedSize( this->size() ) ;
	this->setFont( parent->font() ) ;

	connect( m_ui->tableWidget,SIGNAL( itemDoubleClicked( QTableWidgetItem * ) ),this,SLOT( tableEntryDoubleClicked( QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),this,
		 SLOT( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbHelp,SIGNAL( clicked() ),this,SLOT( pbHelp() ) ) ;
	connect( m_ui->pbUUID,SIGNAL( clicked() ),this,SLOT( pbUUID() ) ) ;
	connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ;

	m_action = new QAction( this ) ;
	QList<QKeySequence> keys ;
	keys.append( Qt::Key_Enter ) ;
	keys.append( Qt::Key_Return ) ;
	m_action->setShortcuts( keys ) ;

	connect( m_action,SIGNAL( triggered() ),this,SLOT( EnterKeyPressed() ) ) ;

	this->addAction( m_action ) ;

	QTableWidget * tw = m_ui->tableWidget ;
	tw->setColumnWidth( 0,183 ) ;
	tw->setColumnWidth( 1,90 ) ;
	//tw->setColumnWidth( 2,110 ) ;
	tw->hideColumn( 2 ) ;
	tw->setColumnWidth( 3,90 ) ;
	tw->setColumnWidth( 4,309 ) ;

	for( int i = 0 ; i < 5 ; i++ ){
		tw->horizontalHeaderItem( i )->setFont( this->font() ) ;
	}
	tw->horizontalHeader()->setVisible( true ) ;

	m_ui->checkBoxUUID->setVisible( false ) ;

	m_diableNonLUKS = false ;
	//m_ui->pbUUID->setVisible( false ) ;
	m_showEncryptedOnly = false ;
	m_showLuksOnly = false ;

	this->installEventFilter( this ) ;
}
void CsvContractorExporterDialogController::initColumnWidths() {

    QTableWidget *tableWidget = view->getTableWidget();
    tableWidget->setColumnWidth(0, 200);
    tableWidget->setColumnWidth(1, 200);
    tableWidget->setColumnWidth(2, 130);
    tableWidget->setColumnWidth(3, 90);
    tableWidget->setColumnWidth(4, 110);
    tableWidget->setColumnWidth(5, 140);
    tableWidget->setColumnWidth(6, 100);
    tableWidget->setColumnWidth(7, 100);
    tableWidget->setColumnWidth(8, 100);
    tableWidget->setColumnWidth(9, 100);
    tableWidget->setColumnWidth(10, 100);
}
OpenInCompatibleSoftwareWidget::OpenInCompatibleSoftwareWidget(
        dunnart::Canvas *canvas, QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::OpenInCompatibleSoftwareWidget),
    m_garuda_client(NULL),
    m_canvas(NULL)
{
    ui->setupUi(this);

    connect(ui->tableWidget, SIGNAL(cellDoubleClicked(int,int)),
            this, SLOT(cellWasDoubleClicked(int,int)));

    changeCanvas(canvas);

    QTableWidget *tableWidget = ui->tableWidget;
    tableWidget->setColumnWidth(0, 200);
}
Esempio n. 12
0
/** Loads the settings for this page */
void ShareManager::load()
{
    if(isLoading)
        return ;

    isLoading = true;
//    std::cerr << "ShareManager:: In load !!!!!" << std::endl ;

    std::list<SharedDirInfo>::const_iterator it;
    std::list<SharedDirInfo> dirs;
    rsFiles->getSharedDirectories(dirs);

    /* get a link to the table */
    QTableWidget *listWidget = ui.shareddirList;

    /* set new row count */
    listWidget->setRowCount(dirs.size());

    int row=0 ;
    for(it = dirs.begin(); it != dirs.end(); ++it,++row)
    {
        listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str())));
        listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str())));

		  GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);

		  listWidget->setRowHeight(row, 32);
		  listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);

		  listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
		  listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;

		  //connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
    }

	 listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ;

    //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));

    listWidget->update(); /* update display */
    update();

    isLoading = false ;
    updateGroups();
}
Esempio n. 13
0
ParamCompareDialog::ParamCompareDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ParamCompareDialog),
    m_newList(new QMap<QString, UASParameter*>())
{
    ui->setupUi(this);

    QStringList headerList;
    headerList << tr("Parameter") << tr("Value") << tr("New Value") << tr("Use");

    QTableWidget* table = ui->compareTableWidget;
    table->setColumnCount(headerList.count());
    table->setHorizontalHeaderLabels(headerList);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    table->setAlternatingRowColors(true);
    table->setColumnWidth(PCD_COLUMN_CHECKBOX, 40);

    initConnections();
}
Esempio n. 14
0
QTableWidget *PublicTalks::getPersons(int type)
{
    std::vector<sql_item> vt;
//    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
//                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.puheenjohtaja_id "
//                  "WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id";
    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.";
    if(type == person::chairman) {
        str.append("puheenjohtaja_id");
    } else {
        str.append("vt_lukija_id");
    }
    str.append(" WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id");

    vt = sql.selectSql(str);

    QTableWidget *vttable = new QTableWidget();
    vttable->horizontalHeader()->show();
    vttable->verticalHeader()->setVisible(false);
    vttable->setColumnCount(3);
    vttable->setColumnHidden(0,true);
    vttable->setColumnWidth(1,150);
    vttable->setColumnWidth(2,100);
    vttable->setMinimumWidth(270);
    vttable->setSortingEnabled(true);

    vttable->setHorizontalHeaderItem(1,new QTableWidgetItem(QObject::tr("Name")));
    vttable->setHorizontalHeaderItem(2,new QTableWidgetItem(QObject::tr("Last")));

    vttable->setRowCount(vt.size()+1);
    vttable->setItem(0,0,new QTableWidgetItem(""));
    for(unsigned int i = 0; i < vt.size(); i++) {
        vttable->setItem(i+1,0,new QTableWidgetItem(vt[i].getValue("id")));
        vttable->setItem(i+1,1,new QTableWidgetItem(vt[i].getValue("nimi") + " " + vt[i].getValue("etunimi")));
        vttable->setItem(i+1,2,new QTableWidgetItem(vt[i].getValue("pvm")));
    }
    return vttable;
}
Esempio n. 15
0
SUBE_DEPO_SECIMI::SUBE_DEPO_SECIMI( int sube_id , QWidget * parent ) : SECIM_KERNELI ( parent )
{

    m_sube_id = sube_id;

    SET_WINDOW_SIZE ( 300, 800 );
    SET_HEADERS (QStringList() << "depo id Id" << "Depo Kodu" << "Depo Adı" );

    SET_PAGE_TITLE    ( tr ( "ŞUBE - DEPO SEÇİMİ" ) );

    SET_HELP_PAGE     ( tr("sube_depo_secimi.html") );


    INIT_KERNEL ( DB );

    QTableWidget * tablewidget = GET_TABLE_WIDGET();

    tablewidget->hideColumn(0);
    tablewidget->setColumnWidth(1 , 40);
    tablewidget->setColumnWidth(2 , 60);

    SET_SETTING_NAME  ( "SUBE_DEPO_SECIMI" );
}
Esempio n. 16
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();
  }
}
Esempio n. 17
0
void MainWindow::setUpApp( const QString& volume )
{
	this->setLocalizationLanguage() ;
	m_ui = new Ui::MainWindow ;
	m_ui->setupUi( this ) ;

	m_ui->pbunlockencfs->setMinimumHeight( 31 ) ;
	m_ui->pbmenu->setMinimumHeight( 31 ) ;
	m_ui->pbmount->setMinimumHeight( 31 ) ;
	m_ui->pbupdate->setMinimumHeight( 31 ) ;

	QVector<int> f = utility::getWindowDimensions( "zuluMount" ) ;

	int * e = f.data() ;

	this->window()->setGeometry( *( e + 0 ),*( e + 1 ),*( e + 2 ),*( e + 3 ) ) ;

	QTableWidget * table = m_ui->tableWidget ;

	table->setColumnWidth( 0,*( e + 4 ) ) ;
	table->setColumnWidth( 1,*( e + 5 ) ) ;
	table->setColumnWidth( 2,*( e + 6 ) ) ;
	table->setColumnWidth( 4,*( e + 7 ) ) ;
	table->setColumnWidth( 5,*( e + 8 ) ) ;

	m_ui->tableWidget->hideColumn( 3 ) ;

#if QT_VERSION < QT_VERSION_CHECK( 5,0,0 )
	m_ui->tableWidget->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ) ;
#else
	m_ui->tableWidget->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ) ;
#endif
	m_ui->tableWidget->verticalHeader()->setMinimumSectionSize( 30 ) ;

	this->setAcceptDrops( true ) ;
	this->setWindowIcon( QIcon( ":/zuluMount.png" ) ) ;

	m_ui->tableWidget->setMouseTracking( true ) ;

	connect( m_ui->tableWidget,SIGNAL( itemEntered( QTableWidgetItem * ) ),this,SLOT( itemEntered( QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),
		 this,SLOT( slotCurrentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbmount,SIGNAL( clicked() ),this,SLOT( pbMount() ) ) ;
	connect( m_ui->pbupdate,SIGNAL( clicked()),this,SLOT( pbUpdate() ) ) ;
	connect( m_ui->pbmenu,SIGNAL( clicked() ),this,SLOT( pbMenu() ) ) ;
	connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbunlockencfs,SIGNAL( clicked() ),this,SLOT( unlockencfs() ) ) ;

	connect( this,SIGNAL( unlistVolume( QString ) ),this,SLOT( removeVolume( QString ) ) ) ;

	this->setUpShortCuts() ;

	this->setUpFont() ;

	m_trayIcon = new QSystemTrayIcon( this ) ;
	m_trayIcon->setIcon( QIcon( ":/zuluMount.png" ) ) ;

	auto trayMenu = new QMenu( this ) ;

	m_autoMountAction = new QAction( this ) ;
	m_autoMount = this->autoMount() ;
	m_autoMountAction->setCheckable( true ) ;
	m_autoMountAction->setChecked( m_autoMount ) ;

	m_autoMountAction->setText( tr( "Automount Volumes" ) ) ;

	connect( m_autoMountAction,SIGNAL( toggled( bool ) ),this,SLOT( autoMountToggled( bool ) ) ) ;

	trayMenu->addAction( m_autoMountAction ) ;

	auto autoOpenFolderOnMount = new QAction( this ) ;
	autoOpenFolderOnMount->setCheckable( true ) ;
	m_autoOpenFolderOnMount = this->autoOpenFolderOnMount() ;
	autoOpenFolderOnMount->setChecked( m_autoOpenFolderOnMount ) ;
	autoOpenFolderOnMount->setText( tr( "Auto Open Mount Point" ) ) ;
	connect( autoOpenFolderOnMount,SIGNAL( toggled( bool ) ),this,SLOT( autoOpenFolderOnMount( bool ) ) ) ;

	trayMenu->addAction( autoOpenFolderOnMount ) ;

	auto ac = new QAction( this ) ;
	ac->setText( tr( "Unmount All" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( unMountAll() ) ) ;

	trayMenu->addAction( ac ) ;

	m_favorite_menu = trayMenu->addMenu( tr( "Favorites" ) ) ;
	connect( m_favorite_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( favoriteClicked( QAction * ) ) ) ;
	connect( m_favorite_menu,SIGNAL( aboutToShow() ),this,SLOT( showFavorites() ) ) ;

	m_not_hidden_volume_menu = trayMenu->addMenu( tr( "Hide Volume From View" ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromVisibleVolumeList( QAction * ) ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showVisibleVolumeList() ) ) ;

	m_hidden_volume_menu = trayMenu->addMenu( tr( "Unhide Volume From View" ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromHiddenVolumeList( QAction * ) ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showHiddenVolumeList() ) ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "Check For Update" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( updateCheck() ) ) ;
	trayMenu->addAction( ac ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "About" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( licenseInfo() ) ) ;
	trayMenu->addAction( ac ) ;

	trayMenu->addAction( tr( "Quit" ),this,SLOT( closeApplication() ) ) ;
	m_trayIcon->setContextMenu( trayMenu ) ;

	connect( m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
		 this,SLOT( slotTrayClicked( QSystemTrayIcon::ActivationReason ) ) ) ;

	m_ui->pbmenu->setMenu( m_trayIcon->contextMenu() ) ;

	m_trayIcon->show() ;

	QString dirPath = utility::homePath() + "/.zuluCrypt/" ;
	QDir dir( dirPath ) ;

	if( !dir.exists() ){
		dir.mkdir( dirPath ) ;
	}

	this->disableAll() ;

	this->startAutoMonitor() ;

	this->updateVolumeList( zuluMountTask::updateVolumeList().await() ) ;

	if( volume.isEmpty() ) {
		this->enableAll() ;
	}else{
		this->showMoungDialog( volume ) ;
	}

	this->autoUpdateCheck() ;
}
Esempio n. 18
0
void FenPrincipale::calcul_general() {
	QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
	html += "<td>"+tr("Position")+"</td>";
	html += "<td>"+tr("Équipage")+"</td>";
	html += "<td>"+tr("Points")+"</td>";
	for (int j = 0; j < this->nbManches; ++j) {
		html += "<td>"+tr("M")+QString::number(j+1)+"</td>";
	}
	html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
	QTableWidget *table = new QTableWidget();
	table->verticalHeader()->hide();
	table->setSelectionMode(QAbstractItemView::NoSelection);
	table->setColumnCount(3+this->nbManches);
	table->setRowCount(this->nbEquipages);
	table->setColumnWidth(0, 80);
	table->setColumnWidth(1, 200);
	table->setColumnWidth(2, 60);
	int size = 80 + 200 + 60;
	QList<QString> labels;
	labels << tr("Position") << tr("Équipage") << tr("Points");
	for (int j = 0; j < this->nbManches; ++j) {
		labels << tr("M")+QString::number(j+1);
		size += 50;
		table->setColumnWidth(3+j, 50);
	}
	table->setMinimumWidth(size + 20);
	table->setMaximumWidth(size + 20);
	table->setHorizontalHeaderLabels(labels);
	ui->resultatsLayout->insertWidget(0, table);
	for (int i = 0; i < this->nbEquipages; ++i) {
		QList<int> ids;
		Equipage e1;
		for (int k = 0; k < this->nbEquipages; ++k) {
			Equipage e2 = this->equipages[k];
			if (e2.points <= 0) {
				// cet équipage a déjà été affiché
				continue;
			}
			if (ids.isEmpty() || e2.points < e1.points) {
				ids.clear();
				ids.append(k);
				e1 = e2;
			}
			else if (e2.points == e1.points) {
				// égalité de points
				// pour départager les équipages, on confronte leurs meilleures
				// manches (sans celles retirées)
				for (int j = 0; j < e1.pointsTries.size(); ++j) {
					if (e2.pointsTries[j] < e1.pointsTries[j]) {
						ids.clear();
						ids.append(k);
						e1 = e2;
						break;
					}
					else if (e2.pointsTries[j] > e1.pointsTries[j]) {
						break;
					}
					else if (j == e1.pointsTries.size()-1) {
						// égalité des manches
						// pour départager les équipages, on confronte toutes
						// leur manches dans l'ordre en partant de la dernière
						for (int l = 0; l < e1.pointsOrdonnes.size(); ++l) {
							if (e2.pointsOrdonnes[l] < e1.pointsOrdonnes[l]) {
								ids.clear();
								ids.append(k);
								e1 = e2;
								break;
							}
							else if (e2.pointsOrdonnes[l] > e1.pointsOrdonnes[l]) {
								break;
							}
							else if (l == e1.pointsOrdonnes.size()-1) {
								// égalité parfaite
								ids.append(k);
							}
						}
					}
				}
			}
		}
		for (int k = 0; k < ids.size(); ++k) {
			Equipage e = this->equipages[ids[k]];
			// on ajoute le début de la table html
			// on rajoute les manches en parallèle à causes de celles retirées
			QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
			if (this->typeClmt == CLMT_TEMPS) {
				nomString += "<span class=\"bateau\">"
					+this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")</span>";
			}
			html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
				+"<td>"+nomString+"</td>"
				+"<td>"+QString::number(e.points)+"</td>";
			// on ajout l'équipage
			QLabel *pos = new QLabel(QString::number(i+1));
			QWidget *nomWidget = new QWidget();
			QVBoxLayout *nomLayout = new QVBoxLayout();
			QLabel *nom = new QLabel(e.nom);
			nom->setProperty("label", "nom");
			nomLayout->addWidget(nom);
			if (this->typeClmt == CLMT_TEMPS) {
				QLabel *bateau = new QLabel();
				bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")");
				bateau->setProperty("label", "bateau");
				nomLayout->addWidget(bateau);
				table->setRowHeight(i+k, 45);
			}
			nomLayout->setContentsMargins(0, 0, 0, 0);
			nomLayout->setSpacing(0);
			nomWidget->setLayout(nomLayout);
			QLabel *points = new QLabel(QString::number(e.points));
			table->setCellWidget(i+k, 0, pos);
			table->setCellWidget(i+k, 1, nomWidget);
			table->setCellWidget(i+k, 2, points);
			for (int j = 0; j < this->nbManches; ++j) {
				Manche m = e.manches[j];
				QLabel *la = new QLabel();
				if (m.tpsCompense < 0) {
					la->setText(this->get_abr(m.abr));
				}
				else {
					la->setText(QString::number(m.points));
				}
				for (int l = 0; l < e.pointsRetires.size(); ++l) {
					if (e.pointsRetires[l] == m.points) {
						la->setText("("+la->text()+")");
						e.pointsRetires.removeAt(l);
						break;
					}
				}
				html += "<td>"+la->text()+"</td>";
				table->setCellWidget(i+k, j+3, la);
			}
			html += "\n\t\t</tr>";
			this->equipages[ids[k]].points = 0;
		}
		i += ids.size()-1;
	}
	html += "\n\t</tbody>\n</table>";
	this->htmls.prepend(html);
	this->progression(95);
}
Esempio n. 19
0
void PublicTalks::beforeSpeakerShown(QString name, cPersonComboBox *c)
{
    //cPersonComboBox *c = combo;

    // get speakers for comboBox
    //cPersonComboBox *combo = static_cast<cPersonComboBox *>(maintable->cellWidget(combo->property("currentrow").toInt(),3));
    cPersonComboBox *themeCombo = static_cast<cPersonComboBox *>(maintable->cellWidget(c->property("currentrow").toInt(),2));
    qDebug() << "currentRow1:" << c->currentText() << "rownumber:" << c->property("currentrow") << name;
    if (c) {
        qDebug() << "combo ok";
    } else {
        qDebug() << "combo false";
    }

    QTableWidget *table = new QTableWidget(0,4);
    table->setColumnHidden(0,true);
    table->setColumnWidth(3,0);
    std::vector<sql_item> speakers;
    if(themeCombo->currentText() == "") {
        // ei teemaa valittu
        speakers = sql.selectSql("SELECT henkilot.*,yleisokokous.pvm "
                                 "FROM henkilot "
                                 "LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.puhuja_id "
                                 "WHERE henkilot.ohjelmatyypit & 512 GROUP BY henkilot.id ORDER BY nimi");
    } else {
        // teema valittu --> haetaan teeman sopivat puhujat
        speakers = sql.selectSql("SELECT henkilot.*,P_Esitelmat.aihe_id,yleisokokous.pvm "
                                 "FROM henkilot "
                                 "LEFT JOIN P_Esitelmat ON henkilot.id = P_Esitelmat.puhuja_id "
                                 "LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.puhuja_id "
                                 " WHERE P_Esitelmat.aihe_id = '" +
                                 QString::number(getThemeId(themeCombo->currentText())) +
                                 "' AND henkilot.ohjelmatyypit & 512 GROUP BY henkilot.id ORDER BY nimi, etunimi");
    }
    table->setRowCount(speakers.size()+1);
    int currentRow = 0;
    for(unsigned int i = 0; i < speakers.size(); i++) {
        table->setItem(i+1,0,new QTableWidgetItem( speakers[i].getValue("id") ));
        table->setItem(i+1,1,new QTableWidgetItem( speakers[i].getValue("nimi") + ", " + speakers[i].getValue("etunimi")) );
        table->setItem(i+1,2,new QTableWidgetItem( speakers[i].getValue("pvm")) );
        table->setItem(i+1,3,new QTableWidgetItem( speakers[i].getValue("etunimi") + " " + speakers[i].getValue("nimi")) );

        if(c->currentText() == table->item(i+1,3)->text()) {
            QFont boldfont(table->item(i+1,1)->font().family(),
                           table->item(i+1,1)->font().pointSize(),
                           QFont::Bold);
            table->item(i+1,1)->setFont(boldfont);
            currentRow = i+1;
        }
    }
    table->verticalHeader()->hide();
    table->setColumnWidth(1,150);
    table->setColumnWidth(2,100);
    table->setMinimumWidth(280);

    c->clear();
    c->setModel(table->model());
    c->setView(table);
    c->setModelColumn(1);
    c->setCurrentIndex(currentRow);
    table->setSortingEnabled(true);
    table->sortByColumn(1,Qt::AscendingOrder);
}
FAT_IRSALIYE_SATIR_SECIMI::FAT_IRSALIYE_SATIR_SECIMI ( QString p_fatura_tarihi, int p_cari_hesap_id, int p_fatura_turu, QWidget * p_parent ) : SECIM_KERNELI ( p_parent )
{

    SQL_QUERY sql_query ( DB );

    SET_HELP_PAGE  ( "fat_irsaliye_satir_secimi.html" );
    SET_PAGE_TITLE ( "FAT - İRSALİYE SATIRI SEÇİMİ " );

    m_irsaliye_tarihi_bitis = p_fatura_tarihi;
    m_cari_hesap_id         = p_cari_hesap_id;

    switch ( p_fatura_turu ) {

        case ENUM_FAT_ELLE_IRSALIYE_FATURALASTIRMA_ALIS :
            m_irsaliye_turu = ENUM_IRS_NORMAL_GIRIS;
            break;

        case ENUM_FAT_ELLE_IRSALIYE_FATURALASTIRMA_SATIS :
            m_irsaliye_turu = ENUM_IRS_NORMAL_CIKIS;
            break;

        case ENUM_FAT_ELLE_IRSALIYE_FATURALASTIRMA_KONSINYE_ALIS :
            m_irsaliye_turu = ENUM_IRS_KONSINYE_GIRIS;
            break;

        case ENUM_FAT_ELLE_IRSALIYE_FATURALASTIRMA_KONSINYE_SATIS:
            m_irsaliye_turu = ENUM_IRS_KONSINYE_CIKIS;
            break;

        default :
            m_irsaliye_turu = -1;
            break;
    }

    sql_query.PREPARE_SELECT ( "e9_sabit_degerler","irs_faturalandirilacak_gun" ,"sabit_deger_id = :sabit_deger_id");
    sql_query.SET_VALUE(":sabit_deger_id" , 1);


    if ( sql_query.SELECT() EQ 0 ) {
        return;
    }

    sql_query.NEXT();

    int   faturandirilacak_gun            = sql_query.VALUE(0).toInt();

    QDate irsaliye_tarihi_bitis           = QDate::fromString ( m_irsaliye_tarihi_bitis, "yyyy.MM.dd" );
    int   irsaliye_tarihi_bitis_month     = irsaliye_tarihi_bitis.month();

    QDate irsaliye_tarihi_baslangic       = irsaliye_tarihi_bitis.addDays ( -1 * faturandirilacak_gun );
    int   irsaliye_tarihi_baslangic_month = irsaliye_tarihi_baslangic.month();

    if ( irsaliye_tarihi_baslangic_month NE irsaliye_tarihi_bitis_month ) {
        m_irsaliye_tarihi_baslangic = QDate( irsaliye_tarihi_bitis.year(), irsaliye_tarihi_bitis_month, 01 ).toString("yyyy.MM.dd");
    }
    else {
        m_irsaliye_tarihi_baslangic = irsaliye_tarihi_baslangic.toString("yyyy.MM.dd");
    }

    SET_SORTING ( false );

    SET_WINDOW_SIZE ( 600, 1100 );

    SET_HEADERS ( QStringList () <<tr("irsaliye_satiri_id")<<tr("İrs. No")<<tr("İrs. S. No")<<tr("İrsaliye Tarihi")
                                 <<tr("Ürün Kodu")<<tr("Ürün Adı")<<tr("S. No/P. Kodu")<<tr("Kalan Miktar")
                                 <<tr("Birimi")<<tr("Birim Fiyat")<<tr("KDV")<<tr("KDV %")<<tr("ÖTV %")
                                 <<tr("Fiyatı")<<tr("Para Brm")<< DVZ_GET_TEMEL_PARA_BIRIMI_KODU() + tr(" Tutarı"));
    INIT_KERNEL ( DB );

    QTableWidget * tableWidget = GET_TABLE_WIDGET();

    tableWidget->setColumnWidth ( IRSALIYE_NO_COLUMN                   , 45  );
    tableWidget->setColumnWidth ( IRSALIYE_BELGE_SERI_NO_COLUMN        , 58  );
    tableWidget->setColumnWidth ( IRSALIYE_TARIHI_COLUMN               , 103 );
    tableWidget->setColumnWidth ( URUN_KODU_COLUMN                     , 70  );
    tableWidget->setColumnWidth ( URUN_ADI_COLUMN                      , 100 );
    tableWidget->setColumnWidth ( SERI_NO_PARTI_KODU_COLUMN            , 80  );
    tableWidget->setColumnWidth ( KALAN_MIKTAR_COLUMN                  , 80  );
    tableWidget->setColumnWidth ( URUN_BIRIMI_COLUMN                   , 60  );
    tableWidget->setColumnWidth ( BIRIM_FIYAT_COLUMN                   , 75  );
    tableWidget->setColumnWidth ( KDV_DAHIL_MI_COLUMN                  , 50  );
    tableWidget->setColumnWidth ( KDV_ORANI_COLUMN                     , 47  );
    tableWidget->setColumnWidth ( OTV_ORANI_COLUMN                     , 47  );
    tableWidget->setColumnWidth ( FIYAT_COLUMN                         , 80  );
    tableWidget->setColumnWidth ( PARA_BIRIMI_COLUMN                   , 60  );
    tableWidget->setColumnWidth ( TEMEL_PARA_BIRIMI_TUTARI_COLUMN      , 80  );

    SET_SETTING_NAME            ( "FAT_IRSALIYE_SATIR_SECIMI" );

    QFont tableWidget_font = tableWidget->font();
    int   font_point_size  = tableWidget_font.pointSize();
    tableWidget_font.setPointSize ( font_point_size -1 );
    tableWidget->setFont ( tableWidget_font );

    tableWidget->hideColumn( IRSALIYE_SATIRI_ID_COLUMN );
}
DocumentMetaConfigurationPage::DocumentMetaConfigurationPage(RosegardenDocument *doc,
        QWidget *parent) :
    TabbedConfigurationPage(doc, parent)
{
    m_headersPage = new HeadersConfigurationPage(this, doc);
    addTab(m_headersPage, tr("Headers"));

    Composition &comp = doc->getComposition();
    std::set
    <TrackId> usedTracks;

    int audioSegments = 0, internalSegments = 0;
    for (Composition::iterator ci = comp.begin();
            ci != comp.end(); ++ci) {
        usedTracks.insert((*ci)->getTrack());
        if ((*ci)->getType() == Segment::Audio)
            ++audioSegments;
        else
            ++internalSegments;
    }

    QFrame *frame = new QFrame(m_tabWidget);
    frame->setContentsMargins(10, 10, 10, 10);
    QGridLayout *layout = new QGridLayout(frame);
    layout->setSpacing(5);

    layout->addWidget(new QLabel(tr("Filename:"), frame), 0, 0);
    layout->addWidget(new QLabel(doc->getTitle(), frame), 0, 1);

    layout->addWidget(new QLabel(tr("Formal duration (to end marker):"), frame), 1, 0);
    timeT d = comp.getEndMarker();
    RealTime rtd = comp.getElapsedRealTime(d);
    layout->addWidget(new QLabel(durationToString(comp, 0, d, rtd), frame), 1, 1);

    layout->addWidget(new QLabel(tr("Playing duration:"), frame), 2, 0);
    d = comp.getDuration();
    rtd = comp.getElapsedRealTime(d);
    layout->addWidget(new QLabel(durationToString(comp, 0, d, rtd), frame), 2, 1);

    layout->addWidget(new QLabel(tr("Tracks:"), frame), 3, 0);
    layout->addWidget(new QLabel(tr("%1 used, %2 total")
                                 .arg(usedTracks.size())
                                 .arg(comp.getNbTracks()),
                                 frame), 3, 1);

    layout->addWidget(new QLabel(tr("Segments:"), frame), 4, 0);
    layout->addWidget(new QLabel(tr("%1 MIDI, %2 audio, %3 total")
                                 .arg(internalSegments)
                                 .arg(audioSegments)
                                 .arg(internalSegments + audioSegments),
                                 frame), 4, 1);

    layout->setRowStretch(5, 2);

    addTab(frame, tr("Statistics"));

    frame = new QFrame(m_tabWidget);
    frame->setContentsMargins(10, 10, 10, 10);
    layout = new QGridLayout(frame);
    layout->setSpacing(5);

    QTableWidget *table = new QTableWidget(1, 11, frame); // , "Segment Table"
    table->setObjectName("StyledTable");
    table->setAlternatingRowColors(true);
    //table->setSelectionMode(QTableWidget::NoSelection);
    table->setSelectionBehavior( QAbstractItemView::SelectRows );
    table->setSelectionMode( QAbstractItemView::SingleSelection );
    table->setSortingEnabled(true);

    table->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr("Type")));    // p1=column
    table->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr("Track")));
    table->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr("Label")));
    table->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr("Time")));
    table->setHorizontalHeaderItem( 4, new QTableWidgetItem( tr("Duration")));
    table->setHorizontalHeaderItem( 5, new QTableWidgetItem( tr("Events")));
    table->setHorizontalHeaderItem( 6, new QTableWidgetItem( tr("Polyphony")));
    table->setHorizontalHeaderItem( 7, new QTableWidgetItem( tr("Repeat")));
    table->setHorizontalHeaderItem( 8, new QTableWidgetItem( tr("Quantize")));
    table->setHorizontalHeaderItem( 9, new QTableWidgetItem( tr("Transpose")));
    table->setHorizontalHeaderItem( 10, new QTableWidgetItem( tr("Delay")));

    //table->setNumRows(audioSegments + internalSegments);
    table->setRowCount(audioSegments + internalSegments);

    table->setColumnWidth(0, 50);
    table->setColumnWidth(1, 50);
    table->setColumnWidth(2, 150);
    table->setColumnWidth(3, 80);
    table->setColumnWidth(4, 80);
    table->setColumnWidth(5, 80);
    table->setColumnWidth(6, 80);
    table->setColumnWidth(7, 80);
    table->setColumnWidth(8, 80);
    table->setColumnWidth(9, 80);
    table->setColumnWidth(10, 80);

    int i = 0;

    for (Composition::iterator ci = comp.begin();
            ci != comp.end(); ++ci) {

        Segment *s = *ci;

        table->setItem(i, 0, new SegmentDataItem
                       (table,
                        s->getType() == Segment::Audio ?
                        tr("Audio") : tr("MIDI")));

        table->setItem(i, 1, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getTrack() + 1)));

        QPixmap colourPixmap(16, 16);
        Colour colour =
            comp.getSegmentColourMap().getColourByIndex(s->getColourIndex());
        colourPixmap.fill(GUIPalette::convertColour(colour));

        table->setItem(i, 2,
                       new QTableWidgetItem( colourPixmap, strtoqstr(s->getLabel())) );
//        new QTableWidgetItem(table, QTableWidgetItem::Never,
        //                         strtoqstr(s->getLabel()),
        //                               colourPixmap));

        table->setItem(i, 3, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getStartTime())));

        table->setItem(i, 4, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getEndMarkerTime() -
                                          s->getStartTime())));

        std::set<long> notesOn;
        std::multimap<timeT, long> noteOffs;
        int events = 0, notes = 0, poly = 0, maxPoly = 0;

        for (Segment::iterator si = s->begin();
                s->isBeforeEndMarker(si); ++si) {
            ++events;
            if ((*si)->isa(Note::EventType)) {
                ++notes;
                timeT startTime = (*si)->getAbsoluteTime();
                timeT endTime = startTime + (*si)->getDuration();
                if (endTime == startTime) continue;
                while (!noteOffs.empty() &&
                        (startTime >= noteOffs.begin()->first)) {
                    notesOn.erase(noteOffs.begin()->second);
                    noteOffs.erase(noteOffs.begin());
                }
                long pitch = 0;
                (*si)->get<Int>(BaseProperties::PITCH, pitch);
                notesOn.insert(pitch);
                noteOffs.insert(std::multimap<timeT, long>::value_type(endTime, pitch));
                poly = notesOn.size();
                if (poly > maxPoly) maxPoly = poly;
            }
        }

        table->setItem(i, 5, new SegmentDataItem
                       (table,
                        QString("%1").arg(events)));

        table->setItem(i, 6, new SegmentDataItem
                       (table,
                        QString("%1").arg(maxPoly)));

        table->setItem(i, 7, new SegmentDataItem
                       (table,
                        s->isRepeating() ? tr("Yes") : tr("No")));

        timeT discard;

        if (s->getQuantizer() && s->hasQuantization()) {
            timeT unit = s->getQuantizer()->getUnit();
            table->setItem(i, 8, new SegmentDataItem
                           (table,
                            NotationStrings::makeNoteMenuLabel
                            (unit, true, discard, false)));
        } else {
            table->setItem(i, 8, new SegmentDataItem
                           (table,
                            tr("Off")));
        }

        table->setItem(i, 9, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getTranspose())));

        if (s->getDelay() != 0) {
            if (s->getRealTimeDelay() != RealTime::zeroTime) {
                table->setItem(i, 10, new SegmentDataItem
                               (table,
                                QString("%1 + %2 ms")
                                .arg(NotationStrings::makeNoteMenuLabel
                                     (s->getDelay(), true, discard, false))
                                .arg(s->getRealTimeDelay().sec * 1000 +
                                     s->getRealTimeDelay().msec())));
            } else {
                table->setItem(i, 10, new SegmentDataItem
                               (table,
                                NotationStrings::makeNoteMenuLabel
                                (s->getDelay(), true, discard, false)));
            }
        } else if (s->getRealTimeDelay() != RealTime::zeroTime) {
            table->setItem(i, 10, new SegmentDataItem
                           (table,
                            QString("%2 ms")
                            .arg(s->getRealTimeDelay().sec * 1000 +
                                 s->getRealTimeDelay().msec())));
        } else {
            table->setItem(i, 10, new SegmentDataItem
                           (table,
                            tr("None")));
        }

        ++i;
    }

    layout->addWidget(table, 0, 0);

    addTab(frame, tr("Segment Summary"));

}
Esempio n. 22
0
void FenPrincipale::calcul_manches() {
	for (int j = 0;  j < this->nbManches; ++j) {
			// on initialise la table html pour l'export
		QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
		html += "<td>"+tr("Place")+"</td>";
		html += "<td>"+tr("Équipage")+"</td>";
		html += "<td>"+tr("Points")+"</td>";
		if (this->typeClmt == CLMT_TEMPS) {
			html += "<td>"+tr("Temps réel")+"</td><td>"+tr("Temps compensé")+"</td>";
		}
		html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
			// on affiche la table qui va contenir les résultats de la manche
		QTableWidget *table = new QTableWidget();
		table->verticalHeader()->hide();
		table->setSelectionMode(QAbstractItemView::NoSelection);
		table->setProperty("table", "manches");
		QList<QString> labels;
		labels << tr("Place") << tr("Équipage") << tr("Points");
		if (this->typeClmt == CLMT_TEMPS) {
			table->setColumnCount(5);
			labels << tr("Temps réel") << tr("Temps compensé");
			table->setMaximumWidth(560 + 20);
			table->setMinimumWidth(560 + 20);
			table->setColumnWidth(3, 120);
			table->setColumnWidth(4, 120);
		}
		else {
			table->setColumnCount(3);
			table->setMaximumWidth(320 + 20);
			table->setMinimumWidth(320 + 20);
		}
		table->setColumnWidth(0, 60);
		table->setColumnWidth(1, 200);
		table->setColumnWidth(2, 60);
		table->setHorizontalHeaderLabels(labels);
		table->setRowCount(this->nbEquipages);
		ui->choisirResultat->insertItem(j+1,
			tr("Résultats de la manche %1").arg(QString::number(j+1)));
		int nbAffiches = 0; // pour savoir à quelle ligne on en est
			// on traite et affiche les équipages
		// on traite chaque manche pour attribuer les points aux équipages
		for (int i = 0; i < this->nbEquipages; ++i) {
			// on recherche tous les équipages non encore traités pour cette
			// manches qui ont un tpsCompense minimal
			int min = 0;
			QList<int> ids;
			for (int k = 0; k < this->nbEquipages; ++k) {
				Manche m = this->equipages[k].manches[j];
				if (m.tpsCompense < 0 || m.points > 0 ) {
					// cet équipage a déjà été traité ou n'a pas de place/temps
					// (DNF, DNS, OCS, ...)
					continue;
				}
				if (m.tpsCompense < min || min == 0) {
					min = m.tpsCompense;
					ids.clear();
					ids.append(k);
				}
				else if (m.tpsCompense == min) {
					ids.append(k);
				}
			}
			if (min == 0) {
				// on n'a pas trouvé d'équipage à traiter (se produit s'il y a
				// des équipages DNS, DNF, OCS, ...)
				break;
			}
			for (int l = 0; l < ids.size(); ++l) {
				double points = (ids.size()-1.0)/2.0+i+1.0;
				this->equipages[ids.at(l)].points += points;
				this->equipages[ids.at(l)].pointsOrdonnes.prepend(points);
				this->equipages[ids.at(l)].pointsTries.append(points);
				this->equipages[ids.at(l)].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[ids.at(l)];
				Manche m = e.manches[j];
				QLabel *place = new QLabel(QString::number(i+1));
				table->setCellWidget(i+l, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(i+l, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(i+l, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(i+l, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(this->formate_tps(m.tpsReel));
					table->setCellWidget(i+l, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(this->formate_tps(qRound(m.tpsCompense)));
					table->setCellWidget(i+l, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
					+"<td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+this->formate_tps(m.tpsReel)+"</td>"
						+"<td>"+this->formate_tps(qRound(m.tpsCompense))+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
			i = i+ids.size()-1;
		}
		// on traite les équipages qui n'ont pas de place/temps
		for (int i = 0; i < this->nbEquipages; ++i) {
			if (this->equipages[i].manches[j].tpsCompense < 0) {
				double points = this->nbEquipages+1.0;
				this->equipages[i].points += points;
				this->equipages[i].pointsOrdonnes.prepend(points);
				this->equipages[i].pointsTries.append(points);
				this->equipages[i].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[i];
				Manche m = e.manches[j];
				QString abr = this->get_abr(m.abr);
				QLabel *place = new QLabel(abr);
				table->setCellWidget(nbAffiches, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(nbAffiches, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(nbAffiches, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(nbAffiches, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(abr);
					table->setCellWidget(nbAffiches, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(abr);
					table->setCellWidget(nbAffiches, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+abr+"</td><td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+abr+"</td><td>"+abr+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
		}
		ui->resultatsLayout->addWidget(table);
		table->hide();
		html += "\n\t</tbody>\n</table>";
		this->htmls.append(html);
		this->progression(5+j*75/this->nbManches);
	}
	// on trie les liste pointsTries
	for (int i = 0; i < this->nbEquipages; ++i) {
		qSort(this->equipages[i].pointsTries);
	}
}
Esempio n. 23
0
void model_import_dlg::create_mesh_tab(QTabWidget * parent, size_t index, render::lod lod)
{
	QWidget * tab = new QWidget(parent);
	tab->setObjectName("meshTab");

	auto & geometry = conv.get(index).geometry.at(lod);
	auto & material = conv.get(index).materials.at(lod);

	QGroupBox * geometry_box = new QGroupBox(tab);
	geometry_box->setGeometry(10, 10, 561, 115);
	geometry_box->setTitle("Geometry");

	QLabel * vertices = new QLabel(geometry_box);
	vertices->setGeometry(20, 20, 200, 20);
	vertices->setText("Vertices: " + QString::number(geometry.vertex_count));

	QLabel * faces = new QLabel(geometry_box);
	faces->setGeometry(20, 40, 200, 20);
	faces->setText("Faces: " + QString::number(geometry.index_count / 3));

	QLabel * indices = new QLabel(geometry_box);
	indices->setGeometry(20, 60, 200, 20);
	indices->setText("Indices: " + QString::number(geometry.index_count));

	QLabel * layout = new QLabel(geometry_box);
	layout->setGeometry(20, 80, 200, 20);
	layout->setText("Layout: " + QString::fromStdString(render::vertex::str(geometry.vertex_type)));

	QGroupBox * material_box = new QGroupBox(tab);
	material_box->setGeometry(10, 130, 561, 400);
	material_box->setTitle("Material");

	QGroupBox * colors_box = new QGroupBox(material_box);
	colors_box->setGeometry(15, 20, 455, 134);
	colors_box->setTitle("Colors");

	QTableWidget * colorsTable = new QTableWidget(colors_box);
	colorsTable->setGeometry(15, 25, 237, 92);
	colorsTable->setObjectName("colorsTable");
	colorsTable->setRowCount(3);
	colorsTable->setColumnCount(3);
	colorsTable->setFrameShape(QFrame::NoFrame);
	colorsTable->setShowGrid(false);
	colorsTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
	colorsTable->setEditTriggers(QAbstractItemView::DoubleClicked);
	colorsTable->horizontalHeader()->setDefaultSectionSize(60);
	colorsTable->verticalHeader()->setDefaultSectionSize(23);
	colorsTable->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);

	QStringList color_types;
	color_types.append("Ambient");
	color_types.append("Diffuse");
	color_types.append("Specular");

	QStringList color_channels;
	color_channels.append("R");
	color_channels.append("G");
	color_channels.append("B");

	colorsTable->setVerticalHeaderLabels(color_types);
	colorsTable->setHorizontalHeaderLabels(color_channels);

	colorsTable->setItem(0, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.x))));
	colorsTable->setItem(0, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.y))));
	colorsTable->setItem(0, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.z))));
	colorsTable->setItem(1, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.x))));
	colorsTable->setItem(1, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.y))));
	colorsTable->setItem(1, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.z))));
	colorsTable->setItem(2, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.x))));
	colorsTable->setItem(2, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.y))));
	colorsTable->setItem(2, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.z))));

	QPushButton * colorPick = new QPushButton(colors_box);
	colorPick->setGeometry(290, 24, 75, 23);
	colorPick->setObjectName("colorPick");
	colorPick->setText("Pick");

	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			colorsTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

	QObject::connect(colorsTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_color_table_changed()));
	QObject::connect(colorPick, SIGNAL(pressed()), this, SLOT(on_color_pick()));

	QLabel * spec_power = new QLabel(colors_box);
	spec_power->setGeometry(290, 89, 80, 23);
	spec_power->setText("Specular power: ");

	QDoubleSpinBox * spec_power_box = new QDoubleSpinBox(colors_box);
	spec_power_box->setObjectName("specularSpinBox");
	spec_power_box->setDecimals(2);
	spec_power_box->setSingleStep(0.05);
	spec_power_box->setFrame(false);
	spec_power_box->setGeometry(390, 89, 50, 23);
	spec_power_box->setValue(material.specular_power);

	QGroupBox * textures_box = new QGroupBox(material_box);
	textures_box->setGeometry(15, 159, 531, 225);
	textures_box->setTitle("Textures");

	QTableWidget * texturesTable = new QTableWidget(textures_box);
	texturesTable->setObjectName("texturesTable");
	texturesTable->setGeometry(15, 25, 500, 150);
	texturesTable->setRowCount(material.textures.size());
	texturesTable->setColumnCount(2);
	texturesTable->setFrameShape(QFrame::NoFrame);
	texturesTable->setShowGrid(false);
	texturesTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
	texturesTable->setEditTriggers(QAbstractItemView::DoubleClicked);
	texturesTable->horizontalHeader()->setDefaultSectionSize(60);
	texturesTable->verticalHeader()->setDefaultSectionSize(23);
	texturesTable->verticalHeader()->setVisible(false);

	QStringList texture_headers;
	texture_headers.append("File");
	texture_headers.append("Type");
	texturesTable->setHorizontalHeaderLabels(texture_headers);

	int i = 0;
	assimp::texture_type_map texture_map;

	for (auto texture : material.textures)
	{
		texturesTable->setItem(i, 0, new QTableWidgetItem(QString::fromStdString(texture.second.texture_path.generic_string())));
		texturesTable->setItem(i, 1, new QTableWidgetItem(QString::fromStdString(texture_map.get(texture.first))));
		texturesTable->setColumnWidth(0, 350);
		texturesTable->setColumnWidth(1, 150);

		i++;
	}

	for (i = 0; i < texturesTable->rowCount(); i++)
	for (int j = 0; j < texturesTable->columnCount(); j++)
		texturesTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

	QPushButton * add_texture = new QPushButton(textures_box);
	add_texture->setGeometry(15, 185, 75, 23);
	add_texture->setText("Add");

	QPushButton * edit_texture = new QPushButton(textures_box);
	edit_texture->setGeometry(100, 185, 75, 23);
	edit_texture->setObjectName("textureEditButton");
	edit_texture->setText("Edit");
	edit_texture->setEnabled(false);

	QPushButton * delete_texture = new QPushButton(textures_box);
	delete_texture->setGeometry(185, 185, 75, 23);
	delete_texture->setObjectName("textureDeleteButton");
	delete_texture->setText("Delete");
	delete_texture->setEnabled(false);

	QObject::connect(texturesTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_texture_table_changed()));
	QObject::connect(add_texture, SIGNAL(pressed()), this, SLOT(on_texture_add()));
	QObject::connect(edit_texture, SIGNAL(pressed()), this, SLOT(on_texture_edit()));
	QObject::connect(delete_texture, SIGNAL(pressed()), this, SLOT(on_texture_delete()));

	QString title = "Mesh " + QString::number(index);
	parent->addTab(tab, title);
}