Ejemplo n.º 1
0
void DownloadManager::addItem(DownloadItem *item)
{
    connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow()));
    int row = m_downloads.count();
    m_model->beginInsertRows(QModelIndex(), row, row);
    m_downloads.append(item);
    m_model->endInsertRows();
    updateItemCount();
    downloadsView->setIndexWidget(m_model->index(row, 0), item);
    QIcon icon = style()->standardIcon(QStyle::SP_FileIcon);
    item->fileIcon->setPixmap(icon.pixmap(48, 48));
    downloadsView->setRowHeight(row, item->sizeHint().height());
    updateRow(item); //incase download finishes before the constructor returns
}
Ejemplo n.º 2
0
void ColorListWidget::addRow(int row)
{
	react_to_changes = false;
	
	QTableWidgetItem* item;
	for (int col = 0; col < color_table->columnCount(); ++col)
	{
		item = new QTableWidgetItem();
		item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		// TODO: replace "define" with "edit"
		item->setToolTip(tr("Double click to define the color"));
		color_table->setItem(row, col, item);
	}
	
#if 0 // Interfers with translation
	// Name
	item = color_table->item(row, 1);
	item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
	item->setToolTip(tr("Click to select the name and click again to edit."));
#endif
	
	// Opacity
	item = color_table->item(row, 6);
	item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
	
	react_to_changes = true;
	
	updateRow(row);
}
Ejemplo n.º 3
0
bool DbNote::saveCategory(Category & cat , save_t sav)
{
    if(sav == append_entr)
    {
        if( existCategory(cat))
        {
            std::cout << "Category exists! Can't save this categeory !" << std::endl;
            return false;
        }
        if( ! insertTable( cat ) )
            return false;
        else
            return true;
    }
    else if( sav == write_entr )
    {
        if( ! existCategory(cat) )
        {
            std::cout << "Category doesn't exists! Can't override this categeory !" << std::endl;
            return false;
        }
        if( ! updateRow( cat ) )
        {
            return false;
        }
        else
            return true;
    }
    return false;
}
Ejemplo n.º 4
0
void HModifyProd::on_pushButton_clicked()
{
    if (action==0)
    {

    if(updateRow())
        {
          getComponetsLot();
          QMessageBox::information(this,QApplication::applicationName(),"Riga modificata",QMessageBox::Ok);

        }
        else
        {
            QMessageBox::warning(this,QApplication::applicationName(),"MODERRORACCIO!!!\n" + db.lastError().text()  ,QMessageBox::Ok);
        }
    }
    else if (action==1)
    {
        if(addRow())
            {
              getComponetsLot();

            QMessageBox::information(this,QApplication::applicationName(),"Riga aggiunta",QMessageBox::Ok);

            }
            else
            {
                QMessageBox::warning(this,QApplication::applicationName(),"MODERRORINO!!!\n" + db.lastError().text()  ,QMessageBox::Ok);
            }
         action=0;
    }
    ui->pushButton_4->setEnabled(true);
    ui->pushButton_5->setEnabled(false);

}
Ejemplo n.º 5
0
void ColorListWidget::cellChange(int row, int column)
{
	if (!react_to_changes)
		return;
	
	react_to_changes = false;
	
	auto color = map->getMapColor(row);
	auto text = color_table->item(row, column)->text().trimmed();
	
	if (column == 1)
	{
		color->setName(text);
		react_to_changes = true;
	}
	else if (column == 6) // Opacity
	{
		auto opacity = color_table->item(row, column)->data(Qt::DisplayRole).toFloat();
		if (!qFuzzyCompare(1.0f+opacity, 1.0f+color->getOpacity()))
		{
			color->setOpacity(qBound(0.0f, opacity, 1.0f));
			updateRow(row);
		}
		react_to_changes = true;
	}
	else 
	{
		react_to_changes = true;
		return;
	}
	
	map->setColor(color, row); // trigger colorChanged signal
	map->setColorsDirty();
	map->updateAllObjects();
}
Ejemplo n.º 6
0
void Piccolino_OLED::updateRow(int startID, int endID)
{
  unsigned char y =0;
  for(y=startID; y<endID; y++)
  {
    updateRow(y);
  }
}
Ejemplo n.º 7
0
void ColorListWidget::moveColorDown()
{
	int row = color_table->currentRow();
	Q_ASSERT(row < color_table->rowCount() - 1);
	if (row >= color_table->rowCount() - 1) return; // In release mode
	
	auto below_color = map->getMapColor(row + 1);
	auto cur_color = map->getMapColor(row);
	map->setColor(cur_color, row + 1);
	map->setColor(below_color, row);
	updateRow(row + 1);
	updateRow(row);
	
	color_table->setCurrentCell(row + 1, color_table->currentColumn());
	
	map->setColorsDirty();
	map->updateAllObjects();
}
Ejemplo n.º 8
0
void ColorListWidget::moveColorUp()
{
	int row = color_table->currentRow();
	Q_ASSERT(row >= 1);
	if (row < 1) return; // In release mode
	
	auto above_color = map->getMapColor(row - 1);
	auto cur_color = map->getMapColor(row);
	map->setColor(cur_color, row - 1);
	map->setColor(above_color, row);
	updateRow(row - 1);
	updateRow(row);
	
	color_table->setCurrentCell(row - 1, color_table->currentColumn());
	
	map->setColorsDirty();
	map->updateAllObjects();
}
Ejemplo n.º 9
0
void PeerListContent::changeCheckState(
		not_null<PeerListRow*> row,
		bool checked,
		PeerListRow::SetStyle style) {
	row->setChecked(
		checked,
		style,
		[this, row] { updateRow(row); });
}
Ejemplo n.º 10
0
void StatisticsWidget::sl_update() {
    const WorkflowMonitor *m = dashboard->monitor();
    CHECK(NULL != m, );

    QMap<QString, WorkerInfo> infos = m->getWorkersInfo();
    foreach (const QString &actor, infos.keys()) {
        updateRow(actor, createRowByWorker(actor, infos[actor]));
    }
}
Ejemplo n.º 11
0
void MainWindow::actualizarSeleccionado()
{
    Persona *p = selectedPersona;
    QTableWidget * t = ui->tableWidget;
    for (int i = 0; i < t->rowCount(); i++) {
        if (t->item(i, 0)->text().toLong() == p->id()) {
            updateRow( i, p);
        }
    }
}
Ejemplo n.º 12
0
//timer interrupt handler
void TC3_Handler()
{
	long dummy = REG_TC1_SR0;
	pinOutput(OE_PIN, 0); // set OE low
	for (int i = 0; i < 16; i++)
	{
      updateRow(i);
	}
	pinOutput(OE_PIN, 1); // set OE high
}
Ejemplo n.º 13
0
void ColorListWidget::colorAdded(int index, const MapColor* color)
{
	Q_UNUSED(color);
	color_table->insertRow(index);
	addRow(index);
	if (index < color_table->rowCount() - 1)
	{
		updateRow(index + 1);
	}
	color_table->setCurrentCell(index, 1);
}
Ejemplo n.º 14
0
void UserList::userChanged(User const & user)
{
    try
    {
        updateRow(makeRow(user)); // throws if row not found
    }
    catch (std::runtime_error & e)
    {
        // ignore
    }
}
Ejemplo n.º 15
0
bool DbNote::saveEntry(Note & note, save_t sav)
{
    Category cat;
    cat.setKatKey(note.getKatKey());

    if (! existCategory(cat))
    {
        cout << "Category doesn't exists" << endl;
        return false;
    }
    if (note.getNoteRef() != 0)
    {
        Note ref_note;
        ref_note.setNoteKey(note.getNoteRef());
        if( ! existNote(ref_note) )
        {
            std::cout << "Can't find given note reference" << std::endl;
            return false;
        }
    }
    if (sav == append_entr)
    {
        if (note.getNoteKey() != 0)
        {
            cout << "Note entry exists" << endl;
            return false;
        }
        if (!insertTable(note))
        {
            cerr << "Insert notice failed" << endl;
            return false;
        }
    }
    else if (sav == write_entr)
    {
        if ( ! existNote(note) )
        {
            cout << "Can't override notice cause of the notice doesn't exists"
                 << endl;
            return false;
        }
        if (!updateRow( note))
        {
            cerr << "Update the notice failed" << endl;
            return false;
        }
    }
    return true;
}
Ejemplo n.º 16
0
void GameSettings::setScriptTag(std::string const & key, std::string const & value)
{
    std::string key2 = key;
    boost::to_lower(key2);

    StringTableRow row(key2, { key, value });
    if (rowExist(key2))
    {
        updateRow(row);
    }
    else
    {
        addRow(row);
    }
}
Ejemplo n.º 17
0
void DownloadManager::addItem(DownloadWidget *widget)
{
    connect(widget, SIGNAL(statusChanged()), this, SLOT(updateRow()));
    int row = m_downloads.count();
    m_model->beginInsertRows(QModelIndex(), row, row);
    m_downloads.append(widget);
    m_model->endInsertRows();
    updateItemCount();
    if (row == 0)
        show();
    downloadsView->setIndexWidget(m_model->index(row, 0), widget);
    QIcon icon = style()->standardIcon(QStyle::SP_FileIcon);
    widget->fileIcon->setPixmap(icon.pixmap(48, 48));
    downloadsView->setRowHeight(row, widget->sizeHint().height());
}
Ejemplo n.º 18
0
void ProcessMonitor::addToTable(Process* process) 
{
   QTableWidget* table(m_ui.processTable);
   int row(table->rowCount());
   table->setRowCount(row+1);

   int ncol(table->columnCount());
   for (int i = 0; i < ncol; ++i) {
       table->setItem(row, i, new QTableWidgetItem());
   }
   table->item(row, 2)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
   table->item(row, 3)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);

   s_processMap.insert(process, table->item(row,0));
   connect(process, SIGNAL(updated()),  this, SLOT(processUpdated()));
   connect(process, SIGNAL(finished()), this, SLOT(processFinished()));
   updateRow(row, process->monitorItems());
}
Ejemplo n.º 19
0
void ProcessMonitor::updateTable()
{
   ProcessList list(s_processMap.keys());
   ProcessList::iterator iter;
   QTableWidget* table(m_ui.processTable);
   QTableWidgetItem* item;

   bool sortingEnabled(table->isSortingEnabled());
   table->setSortingEnabled(false);
   for (iter = list.begin(); iter != list.end(); ++iter) {
       item = s_processMap[*iter];
   }
   for (iter = list.begin(); iter != list.end(); ++iter) {
       item = s_processMap[*iter];
       updateRow(item->row(), (*iter)->monitorItems());
   }
   table->setSortingEnabled(sortingEnabled);
}
Ejemplo n.º 20
0
void TC3_Handler()
{
	long dummy = REG_TC1_SR0;
	ticks++;
   if (ticks == 1000)
   {
		elapsed_seconds++;
      ticks = 0;
   }
   if (!activated)
      return;
	pinOutput(OE_PIN, 0);
	for (int y = 0; y < 8; y++)
	{
		updateRow(y, display[frame]);
	}
	pinOutput(OE_PIN, 1);
	frame = (frame + 1) % 15;
}
Ejemplo n.º 21
0
PluginTable::PluginTable(QWidget * parent) : QTableView(parent),
    model_(new PluginTableModel),
    delegate_(new PluginTableDelegate)
{
    verticalHeader()->setDefaultSectionSize(50);
    verticalHeader()->setMinimumSectionSize(50);
    
    horizontalHeader()->setStretchLastSection(true);

    setSelectionMode(QAbstractItemView::NoSelection);

    setModel(model_.get());
    setItemDelegate(delegate_.get());

    QObject::connect(model_.get(), &QAbstractItemModel::rowsInserted,
        [this](const QModelIndex &, int start, int end) { updateRow(start); });

#ifdef GLASS_EFFECT
    setStyleSheet(fromResource(":/Transparent/TableView"));
    setShowGrid(false);
#endif
}
void Adafruit_ssd1306syp::update()
{
#if 1
	unsigned int  i=0;
	unsigned char m,n;
	for(m=0;m<8;m++)
	{
		writeCommand(0xb0+m);	//page0-page1
		writeCommand(0x00);		//low column start address
		writeCommand(0x10);		//high column start address
		
		startDataSequence();
		for(n=0;n<128;n++)
		{
			writeByte(m_pFramebuffer[i++]);
		}
		stopIIC();
	}
#else
	updateRow(0,SSD1306_MAXROW);
#endif
}
Ejemplo n.º 23
0
void WBDownloadManager::addItem(WBDownloadItem *item)
{
    connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow()));
    int row = mDownloads.count();
    mModel->beginInsertRows(QModelIndex(), row, row);
    mDownloads.append(item);
    mModel->endInsertRows();
    updateItemCount();

    if (!mIsLoading)
        show();

    downloadsView->setIndexWidget(mModel->index(row, 0), item);

    if (!mIconProvider)
        mIconProvider = new QFileIconProvider();
    QIcon icon = mIconProvider->icon(item->m_output.fileName());
    if (icon.isNull())
        icon = style()->standardIcon(QStyle::SP_FileIcon);
    item->fileIcon->setPixmap(icon.pixmap(48, 48));
    downloadsView->setRowHeight(row, item->sizeHint().height());
}
Ejemplo n.º 24
0
QDlgResult::QDlgResult( QString strTabName, QWidget* parent, Qt::WindowFlags flags )
    : QDialog(parent, flags)
{
    this->strTabName = strTabName ;

    modelQuery = new QSqlQueryModel ;

    tabView = new QTableView;
    tabView->setModel( modelQuery );

    tabView->setSelectionMode(QAbstractItemView::SingleSelection);
    tabView->setSelectionBehavior(QAbstractItemView::SelectRows);
    tabView->verticalHeader()->setVisible(false);

    tabView->setEditTriggers( QAbstractItemView::NoEditTriggers );

    tabView->horizontalHeader()->setStretchLastSection( true ); //最后一列占满可视空间

    buttonInsert = new QPushButton(tr("增加&A"));            //设置功能按钮
    buttonDelete = new QPushButton(tr("删除&D"));
    buttonUpdate = new QPushButton(tr("保存&S"));
    buttonClose = new QPushButton(tr("关闭&C"));
    buttonSaveXls = new QPushButton(tr("另存XLS"));

    connect(buttonInsert, SIGNAL(clicked()), this, SLOT(insertRow()));
    connect(buttonDelete, SIGNAL(clicked()), this, SLOT(deleteRow()));
    connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(updateRow()));
    connect(buttonClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(buttonSaveXls, SIGNAL(clicked()), this, SLOT( slotSaveXls( )));

    lblStart = new QLabel(tr("开始时间:")) ;
    lblEnd = new QLabel(tr("结束时间:")) ;

    edtStart = new QLineEdit  ;
    edtEnd = new QLineEdit ;
    buttonQuery = new QPushButton(tr("查询"));
    connect(buttonQuery, SIGNAL(clicked()), this, SLOT(slotQuery()));

    QDateTime dtToday = QDateTime::currentDateTime( );
    QDate d = dtToday.date() ;
    QString strTime1, strTime2 ;

    strTime1.sprintf( "%04d-%02d-%02d 00:00:00", d.year(),d.month(),d.day() );
    strTime2.sprintf( "%04d-%02d-%02d 23:59:59", d.year(),d.month(),d.day() );
    edtStart->setText( strTime1 );
    edtEnd->setText( strTime2 );

    QHBoxLayout *queryLayout = new QHBoxLayout;
    queryLayout->addWidget( lblStart );
    queryLayout->addWidget( edtStart );
    queryLayout->addWidget( lblEnd );
    queryLayout->addWidget( edtEnd );
    queryLayout->addWidget( buttonQuery );

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addStretch( );
//    bottomLayout -> addWidget(buttonInsert);
//    bottomLayout -> addWidget(buttonDelete);
//    bottomLayout -> addWidget(buttonUpdate);

    bottomLayout -> addWidget(buttonSaveXls);
    bottomLayout -> addWidget(buttonClose);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout -> addLayout( queryLayout );
    mainLayout -> addWidget( tabView );
    mainLayout -> addLayout( bottomLayout );

    setLayout( mainLayout );

    resize(1200,600);
    slotQuery( );
    setWindowTitle(tr("流速测量结果"));

}
Ejemplo n.º 25
0
void ColorListWidget::colorChanged(int index, const MapColor* color)
{
	Q_UNUSED(color);
	updateRow(index);
}
Ejemplo n.º 26
0
void StatisticsWidget::sl_workerInfoChanged(const QString &actor,
    const U2::Workflow::Monitor::WorkerInfo &info)
{
    updateRow(actor, createRowByWorker(actor, info));
}
Ejemplo n.º 27
0
void DownloadManager::updateRow()
{
    if (DownloadItem *item = qobject_cast<DownloadItem*>(sender()))
        updateRow(item);
}
Ejemplo n.º 28
0
void Monitor::updateAll(){
    int id;
    int err;
    int row;
    int cpuRow;
    uint64_t totalTime;
    uint64_t taskTime;
    sys_taskattr_t task;
    CNotify notify;
    id = 0;

    if( link()->isConnected() == false ){
        return;
    }

    if( fd < 0 ){
        return;
    }

    do {
        if ( link()->isConnected() == false ){
            stopTimer();
            for(row = 0; row < ui->table->rowCount(); row++){
                ui->table->removeRow(row);
            }
            return;
        }

        task.is_enabled = 0;
        task.tid = id;
        err = link()->ioctl(fd, I_SYS_GETTASK, &task);
        if ( err < -2 ){
            stopTimer();
            for(row = 0; row < ui->table->rowCount(); row++){
                ui->table->removeRow(row);
            }
            notify.execError( errorMessage() );
            return;
        }

        //update the entries in the table
        updateRow(id, &task);
        id++;
    } while( err != -1 );


    cpuRow = ui->table->rowCount();
    totalTime = 0;
    for(row = 0; row < cpuRow; row++){
        totalTime += ui->table->item(row, DELTA_TASK_TIME_COL)->text().toLongLong();
    }


    for(row = 0; row < cpuRow; row++){
        taskTime = ui->table->item(row, DELTA_TASK_TIME_COL)->text().toLongLong();
        updateItem(row, CPU_COL, QString::number( taskTime * 100.0 / totalTime, 'f', 2 ));
    }

    ui->table->sortItems(sortColumn, sortOrder);


}
Ejemplo n.º 29
0
void Piccolino_OLED::update()
{
  updateRow(0, 8);
}