Ejemplo n.º 1
0
void qwDecoratedCanvas::restoreSWButtonsState()
{
    if(currentImgPtr.isNull())
    {
        disableButtons();
        return;
    }

    if(currentImgPtr->getMyState() != STATE_READY)
    {
        disableButtons();
        if(currentImgPtr->getMyState())
        {
            if(currentImgPtr->myNotes.size()>0)
                myBottomPanelPtr->notesDataButtonPtr->setDisabled(false);
        }
        return;
    }

    myBottomPanelPtr->rgbaSwitchButtonPtr[0]->setChecked(currentImgPtr->getFlag(IMGCX_RED_check));
    myBottomPanelPtr->rgbaSwitchButtonPtr[1]->setChecked(currentImgPtr->getFlag(IMGCX_GREEN_check));
    myBottomPanelPtr->rgbaSwitchButtonPtr[2]->setChecked(currentImgPtr->getFlag(IMGCX_BLUE_check));
    myBottomPanelPtr->rgbaSwitchButtonPtr[3]->setChecked(currentImgPtr->getFlag(IMGCX_ALPHA_check));
    myBottomPanelPtr->redBlueButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_SWAPPED_REDBLUE_check));
    myBottomPanelPtr->redGreenButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_SWAPPED_REDGREEN_check));
    myBottomPanelPtr->linearTransformButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_LINEAR_TRANSFORM_check));
    myBottomPanelPtr->verticalFlipButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_VERTICAL_FLIP_check));
    myBottomPanelPtr->horizontalFlipButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_HORIZONTAL_FLIP_check));
    myBottomPanelPtr->snapToGridButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_SNAP_TO_GRID_check));
    myBottomPanelPtr->backgroundButtonPtr->setChecked(currentImgPtr->getFlag(IMGCX_TRANSPARENT_BKG_check));

    enableButtons();
}
Ejemplo n.º 2
0
void MainWindow::on_pushButton_Clone_clicked()
{
    if(ui->lineEdit_PartLength->text() == "")
    {
    QString text2 = ui->lineEdit_PartWidth->text();
    ui->lineEdit_PartLength->setText(text2);
    disableButtons();
    calculate();
    }

    else if (ui->lineEdit_PartWidth->text() == "")
    {
    QString text = ui->lineEdit_PartLength->text();
    ui->lineEdit_PartWidth->setText(text);
    disableButtons();
    calculate();
    }
    else
    {
     QString text2 = ui->lineEdit_PartWidth->text();
     ui->lineEdit_PartLength->setText(text2);
     disableButtons();
     calculate();
    }
}
Ejemplo n.º 3
0
void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
{
    switch (status) {
    case uploader::WAITING_DISCONNECT:
        disableButtons();
        ui->statusLabel->setText(tr("Waiting for all OP boards to be disconnected."));
        // TODO get rid of magic number 20s (should use UploaderGadgetWidget::BOARD_EVENT_TIMEOUT)
        ui->levellinProgressBar->setMaximum(20);
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::WAITING_CONNECT:
        disableButtons();
        ui->statusLabel->setText(tr("Please connect the board to the USB port (don't use external supply)."));
        // TODO get rid of magic number 20s (should use UploaderGadgetWidget::BOARD_EVENT_TIMEOUT)
        ui->levellinProgressBar->setMaximum(20);
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::JUMP_TO_BL:
        disableButtons();
        ui->levellinProgressBar->setValue(value.toInt());
        ui->levellinProgressBar->setMaximum(5);
        ui->statusLabel->setText(tr("Board going into bootloader mode. Please wait."));
        break;
    case uploader::LOADING_FW:
        ui->statusLabel->setText(tr("Loading firmware."));
        break;
    case uploader::UPLOADING_FW:
        ui->statusLabel->setText(tr("Uploading firmware."));
        ui->levellinProgressBar->setMaximum(100);
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::UPLOADING_DESC:
        ui->statusLabel->setText(tr("Uploading description."));
        break;
    case uploader::BOOTING:
        ui->statusLabel->setText(tr("Booting the board. Please wait"));
        break;
    case uploader::BOOTING_AND_ERASING:
        ui->statusLabel->setText(tr("Booting and erasing the board. Please wait"));
        break;
    case uploader::SUCCESS:
        m_isUpdating = false;
        enableButtons(true);
        ui->statusLabel->setText(tr("Board updated, please press 'Next' to continue."));
        break;
    case uploader::FAILURE:
        m_isUpdating = false;
        enableButtons(true);
        QString msg = value.toString();
        if (msg.isEmpty()) {
            msg = tr("Something went wrong.");
        }
        msg += tr(" You will have to manually upgrade the board using the uploader plugin.");
        ui->statusLabel->setText(QString("<font color='red'>%1</font>").arg(msg));
        break;
    }
}
Ejemplo n.º 4
0
void MainWindow::loadNewPage()
{
	currentQuote->setText("Downloading webpage...");
	disableButtons(true);
	delete webpage;
	webpage = new QWebView;
	webpage->load(QUrl("http://bash.im/quote/" + QString::number(currentID)));
	connect(webpage, SIGNAL(loadFinished(bool)), this, SLOT(showQuote()));
	disableButtons(false);
}
Ejemplo n.º 5
0
void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant value)
{
    switch (status) {
    case uploader::WAITING_DISCONNECT:
        getWizard()->setWindowFlags(getWizard()->windowFlags() & ~Qt::WindowStaysOnTopHint);
        disableButtons();
        ui->statusLabel->setText(tr("Waiting for all boards to be disconnected"));
        break;
    case uploader::WAITING_CONNECT:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        disableButtons();
        getWizard()->show();
        ui->statusLabel->setText(tr("Please connect the board to the USB port (don't use external supply)"));
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::JUMP_TO_BL:
        ui->levellinProgressBar->setValue(0);
        ui->statusLabel->setText(tr("Board going into bootloader mode"));
        break;
    case uploader::LOADING_FW:
        ui->statusLabel->setText(tr("Loading firmware"));
        break;
    case uploader::UPLOADING_FW:
        ui->statusLabel->setText(tr("Uploading firmware"));
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::UPLOADING_DESC:
        ui->statusLabel->setText(tr("Uploading description"));
        break;
    case uploader::BOOTING:
        ui->statusLabel->setText(tr("Booting the board"));
        break;
    case uploader::SUCCESS:
        enableButtons(true);
        ui->statusLabel->setText(tr("Board Updated, please press the 'next' button below"));
        break;
    case uploader::FAILURE_FILENOTFOUND:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        enableButtons(true);
        getWizard()->show();
        ui->statusLabel->setText(tr("File for this controller board not packaged in GCS"));
    case uploader::FAILURE:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        enableButtons(true);
        getWizard()->show();
        ui->statusLabel->setText(tr("Something went wrong, you will have to manually upgrade the board using the uploader plugin"));
        break;
    default:
        Q_ASSERT(0);
    }
}
Ejemplo n.º 6
0
int emct_main::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: exitChild(); break;
        case 1: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 2: getPath(); break;
        case 3: executeOption(); break;
        case 4: saveLog(); break;
        case 5: helpPdf(); break;
        case 6: { int _r = readConfigFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 7: openCon((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 8: disableButtons(); break;
        case 9: enableButtons(); break;
        case 10: changeEStatus((*reinterpret_cast< std::string(*)>(_a[1]))); break;
        case 11: { int _r = readVersionFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 12: logAppend((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 13: logAppendError((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: logAppendOp((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Ejemplo n.º 7
0
void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name)
{
	if(mNotification->getID() == notification_id)
	{
		disableButtons(mNotification->getName(), btn_name);
	}
}
Ejemplo n.º 8
0
void MainWindow::reset(){
    qDebug()<<"resetting fields";

    ui->radioButton_Turret->click();// clicking turret radio button
    ui->statusBar->showMessage("  Resetting fields...", 400);
    //resetting fields
    ui->label_TotalParts->setText("0");
    ui->label_Yields->setText("0");
    ui->lineEdit_PartLength->setText("");
    ui->lineEdit_PartWidth->setText("");
    ui->doubleSpinBox_SheetLength->setValue(120);
    ui->doubleSpinBox_SheetWidth->setValue(60);
    ui->label_Yields->setStyleSheet("QLabel {color:#666;  font-size:22px; font-weight:none;}");
    disableButtons();
    disableOptions();

    //partColor = QColor(85, 170, 0, 110);

     // deleting scene from memory and from screen
    if(scene->isActive()){
        scene->setParent(NULL);
        scene->deleteLater();
    }

}
Ejemplo n.º 9
0
void EmailAccountWizardAccountPage::startFutureWatcher()
{
    Q_D(EmailAccountWizardAccountPage);

    QString emailAddress = field(kFieldEmailAddress).toString();
    Q_ASSERT(!emailAddress.isEmpty());
    if (emailAddress.isEmpty())
        return;

    int index = emailAddress.indexOf('@');
    Q_ASSERT(index > 0);
    if (index < 1)
        return;

    QString domain = emailAddress.mid(index + 1);
    Q_ASSERT(!domain.isEmpty());
    if (domain.isEmpty())
        return;

    startBusyIndicator();
    disableButtons();

    QFuture<SmartList<ServiceProviderInfo*>*> future = QtConcurrent::run(
        this, &EmailAccountWizardAccountPage::enumerateServiceProviders,
            QString(domain));

    ForgettableWatcherType* futureWatcher = new ForgettableWatcherType();
    connect(futureWatcher, SIGNAL(finished()), this, SLOT(enumerationFinished()));
    futureWatcher->setFuture(future);

    d->m_futureWatcher = futureWatcher;
    d->m_futureStarted = true;
}
Ejemplo n.º 10
0
void Title::setMode(int mode)
{
	if(mode < 0) mode = 0;
	if(mode > 1) mode = 1;
	disableButtons();
	_mode = mode;
	enableButtons();
}
Ejemplo n.º 11
0
/** Creates the GradientEditWidget object.
  *
  * Sets up the user interface, ie. buttons and tree widget and creates connections.
  */
GradientEditWidget::GradientEditWidget(QWidget *parent) : QWidget(parent) {
    setupUi(this);

    setButtonIcons();
    disableButtons();
    setupTreeWidget(treeWidget);
    createConnections();
}
Ejemplo n.º 12
0
void MainWindow::showCurrentQuote()
{
	QWebElement rating = webpage->page()->mainFrame()->findFirstElement("span[class=rating]");
	QWebElement text = webpage->page()->mainFrame()->findFirstElement("div[class=text]");
	currentRating->setText(QString(rating.toPlainText()));
	currentQuote->setText(QString(text.toPlainText()));
	NumberOfCurrentQuote->setText(QString::number(currentID));
	disableButtons(false);
}
Ejemplo n.º 13
0
AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
    AbstractWizardPage(wizard, parent),
    ui(new Ui::AutoUpdatePage)
{
    ui->setupUi(this);
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    Q_ASSERT(pm);
    UploaderGadgetFactory *uploader    = pm->getObject<UploaderGadgetFactory>();
    Q_ASSERT(uploader);
    connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(disableButtons()));
    connect(ui->startUpdate, SIGNAL(clicked()), uploader, SIGNAL(autoUpdate()));
    connect(uploader, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(updateStatus(uploader::AutoUpdateStep, QVariant)));
}
Ejemplo n.º 14
0
void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification)
{
	LLSD response = notification->getResponse();
	for (LLSD::map_const_iterator response_it = response.beginMap(); 
		response_it != response.endMap(); ++response_it)
	{
		if (response_it->second.isBoolean() && response_it->second.asBoolean())
		{
			// that after multiple responses there can be many pressed buttons
			// need to process them all
			disableButtons(notification->getName(), response_it->first);
		}
	}
}
Ejemplo n.º 15
0
void AccountingForm::accountEverything()
{
	disableButtons();

	m_progLabel->show();
	QDate firstUnaccMonth = getFirstUnaccMonth();
	if (!firstUnaccMonth.isValid())
	{
		m_progLabel->setText("Keine offenen Abrechnungsposten!");
		return;
	}

	m_progBar->show();

	m_progBar->setMaximum(m_patients->rowCount());

	//get all Patients...
	for (int i = 0; i < m_patients->rowCount(); i++)
	{
		QSqlRecord curPat = m_patients->record(i);
		QString patName = curPat.value(FirstName).toString();
		patName.append(" ");
		patName.append(curPat.value(LastName).toString());
		m_progLabel->setText(patName);
		//std::cerr << "Accounting Patient: " << patName.toStdString() << std::endl;
		m_progBar->setValue(i + 1);

		//Iterate over all open accounting dates for this patient
		QDate curDate = QDate::currentDate();
		//int yearDiff = curDate.year() - firstUnaccMonth.year();
		//int monthDiff = curDate.month() - firstUnaccMonth.month();
		//std::cerr << "First unacc: " << firstUnaccMonth.toString().toStdString() << std::endl;
		//std::cerr << "Cur: " << curDate.toString().toStdString() << std::endl;
		QDate tempDate = firstUnaccMonth;
		while (tempDate < curDate)
		{
			//std::cerr << "Accounting: " << tempDate.toString().toStdString() << std::endl;
			accountPatient(i, tempDate);
			tempDate = tempDate.addMonths(1);
		}

		//Update the view of the form
		update();
	}
	//std::cerr << "Accounting everything finished" << std::endl;
}
Ejemplo n.º 16
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    setWindowTitle(tr("Mupen64Plus-Qt"));
    setWindowIcon(QIcon(":/images/mupen64plus.png"));

    autoloadSettings();

    emulation = new EmulatorHandler(this);

    connect(emulation, SIGNAL(started()), this, SLOT(disableButtons()));
    connect(emulation, SIGNAL(finished()), this, SLOT(enableButtons()));
    connect(emulation, SIGNAL(showLog()), this, SLOT(openLog()));


    romCollection = new RomCollection(QStringList() << "*.z64" << "*.v64" << "*.n64" << "*.zip",
                                      QStringList() << SETTINGS.value("Paths/roms","").toString().split("|"),
                                      this);

    connect(romCollection, SIGNAL(updateStarted(bool)), this, SLOT(disableViews(bool)));
    connect(romCollection, SIGNAL(romAdded(Rom*, int)), this, SLOT(addToView(Rom*, int)));
    connect(romCollection, SIGNAL(updateEnded(int, bool)), this, SLOT(enableViews(int, bool)));


    mainWidget = new QWidget(this);
    setCentralWidget(mainWidget);
    setGeometry(QRect(SETTINGS.value("Geometry/windowx", 0).toInt(),
                      SETTINGS.value("Geometry/windowy", 0).toInt(),
                      SETTINGS.value("Geometry/width", 900).toInt(),
                      SETTINGS.value("Geometry/height", 600).toInt()));

    createMenu();
    createRomView();

    mainLayout = new QVBoxLayout(mainWidget);
    mainLayout->setMenuBar(menuBar);

    mainLayout->addWidget(emptyView);
    mainLayout->addWidget(tableView);
    mainLayout->addWidget(gridView);
    mainLayout->addWidget(listView);

    mainLayout->setMargin(0);

    mainWidget->setLayout(mainLayout);
    mainWidget->setMinimumSize(300, 200);
}
ClientApplication::ClientApplication(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ClientApplicationUi)
{
    QTcpSocket *socket = new QTcpSocket();
    connection = new ClientConnection(socket, this);

    ui->setupUi(this);

    connect(socket, SIGNAL(connected()), this, SLOT(enableButtons()));
    connect(socket, SIGNAL(disconnected()), this, SLOT(disableButtons()));

    connect(connection, SIGNAL(messageReceived(QByteArray)), this, SLOT(displayMessage(QByteArray)));

    connect(ui->connectButton, SIGNAL(clicked(bool)), this, SLOT(connectToServer()));
    connect(ui->disconnectButton, SIGNAL(clicked(bool)), this, SLOT(disconnectFromServer()));
    connect(ui->sendButton, SIGNAL(clicked(bool)), this, SLOT(dataToSend()));
    connect(ui->textToSend, SIGNAL(returnPressed()), this, SLOT(dataToSend()));
}
Ejemplo n.º 18
0
void AccountingForm::performAccounting()
{
	disableButtons();

	//Call the allmighty accounter here
	m_progLabel->show();
	m_progBar->show();

	if (m_thisPatient->isChecked())
	{
		QString filter("id = ");
		QString patId;
		patId.setNum(m_patient);
		filter.append(patId);
		m_patients->setFilter(filter);
		m_patients->select();

		accountPatient(0);
		m_progBar->setMaximum(1);
		m_progBar->setValue(1);
	}
	else
	{
		m_progBar->setMaximum(m_patients->rowCount());
		for (int i = 0; i < m_patients->rowCount(); i++)
		{
			QSqlRecord curPat = m_patients->record(i);
			QString patName = curPat.value(FirstName).toString();
			patName.append(" ");
			patName.append(curPat.value(LastName).toString());
			m_progLabel->setText(patName);
			accountPatient(i);
			m_progBar->setValue(i + 1);
		}
	}

	m_progLabel->setText("Abrechnung beendet");
	m_cancelButton->setEnabled(true);
	m_cancelButton->setText("Beenden");
}
Ejemplo n.º 19
0
// ********* CALCULATE *********************
void MainWindow::calculate()
{    
    // *********** VERY IMPORTANT ****************
    // if label_Yields other than cero remove scene
    // this is for memory management purposes
    if(ui->label_Yields->text()!= "0"){
        scene->setParent(NULL);
        scene->deleteLater();
    }// end if, no else, I tried adding the else and I got an ERROR

    //getting inputs as text
    QString partW = ui->lineEdit_PartWidth->text();
    QString partL = ui->lineEdit_PartLength->text();
    QString sheetW = ui->doubleSpinBox_SheetWidth->text();
    QString sheetL = ui->doubleSpinBox_SheetLength->text();
    QString clamp = ui->doubleSpinBox_Clamp->text();
    QString kerf = ui->doubleSpinBox_Kerf->text();
    QString web = ui->doubleSpinBox_Web->text();

     //converting input text as numbers
    partWidthPlain = partW.toFloat();// this is used to draw rectangles wihtout the kerf and to do conparisons
    partLengthPlain = partL.toFloat();// this is used to draw rectangles wihtout the kerf and to do conparisons
    kerfSize = kerf.toFloat();// convert kerf to a number
    webSize = web.toFloat();
    sheetLengthPlain = sheetL.toFloat();
    sheetWidth = (sheetW.toFloat() - clamp.toFloat()) - .5;


    // VALIDATING FIELDS BEFORE ANY CALCULATION

    // if fields are empty show the fillowing message
    if ((partW == "" || partL == "")||(sheetW == "" || sheetL == ""))
        {
             QMessageBox::information(this, "Warning", "One of the input fields is empty");
             ui->label_TotalParts->setText("0");
             ui->label_Yields->setText("0");
             disableButtons();
        }

    // if PART dimension fields are less than .100" get the following message
    // I had to convert to numbers before validation
    else if(partWidthPlain <= .1 || partLengthPlain <= .1)
    {
        QMessageBox::information(this, "Warning", "Please enter a value greater than .100 inches in the part dimension fields");
         ui->label_TotalParts->setText("0");
         ui->label_Yields->setText("0");
         disableButtons();
    }

    // part dimensions are bigger than sheet dimensions show the following message
    // note that part dimensions include kerf and sheet includes clamp, web etc
    else if(((partWidthPlain + kerfSize) > (sheetWidth) ) || ((partLengthPlain + kerfSize) > (sheetLengthPlain - (webSize* 2))))
    {
        QMessageBox::information(this, "Warning", "Part it's bigger than sheet size");
         ui->label_TotalParts->setText("0");
         ui->label_Yields->setText("0");
         disableButtons();
    }

    // if width is bigger than length swap numbers
    else if(partWidthPlain > partLengthPlain)
    {
              QString text = ui->lineEdit_PartLength->text();
              QString text2 = ui->lineEdit_PartWidth->text();
               ui->lineEdit_PartWidth->setText(text);
               ui->lineEdit_PartLength->setText(text2);
               disableButtons();
               calculate();
    }

    // if all fields contain numbers calculate it
    else
    {

        //activating buttons
        ui->pushButton_copyYields->setDisabled(false);
        ui->pushButton_Reset->setDisabled(false);

        // set button color
        ui->pushButton_Reset->setStyleSheet("color: red");
        ui->pushButton_copyYields->setStyleSheet("color:green");

        // set yield label to original state
        ui->label_Yields->setStyleSheet("QLabel {color:#000;  font-size:22px; font-weight:none;}");


    partWidth = partWidthPlain + kerfSize;
    partLength = partLengthPlain + kerfSize;
    sheetLength = sheetLengthPlain - (webSize* 2);
    // -------------  CALCULATIONS ---------------------

    //-----------------------------------------------------
    //--------- CALCULATION FOR GRID X ---------
    //-----------------------------------------------------
    partsXgridX = sheetLength /partLength;
    partsYgridX = sheetWidth / partWidth;    
    totalPartsGridX = partsXgridX * partsYgridX;
    usedAreaGridX = partsXgridX * partLength;
    extraSpaceGridX = sheetLength - usedAreaGridX;

    if (extraSpaceGridX >= partWidth)    {
        //local variables to hold extra parts
        extraPartsXH = extraSpaceGridX / partWidth;
        extraPartsYH = sheetWidth / partLength;

        extraPartsGridX = extraPartsXH * extraPartsYH ;
        totalPartsGridX = totalPartsGridX + extraPartsGridX; // total parts

        ui->label_TotalParts->setText(QString::number(totalPartsGridX));
    }
    else
    {
        ui->label_TotalParts->setText(QString::number(totalPartsGridX));

    }

    //-----------------------------------------------------
    //--------- CALCULATIONS FOR GRID Y -------
    //-----------------------------------------------------

    partsYgridY = sheetWidth / partLength;
    partsXgridY = sheetLength / partWidth ;
    totalPartsGridY = partsYgridY * partsXgridY;
    usedAreaGridY = partsYgridY * partLength;
    extraSpaceGridY = sheetWidth - usedAreaGridY;

    if (extraSpaceGridY >= partWidth)
    {
        //local variables to hold extra parts
        extraPartsYV = extraSpaceGridY / partWidth;
        extraPartsXV = sheetLength / partLength;

        extraPartsGridY = extraPartsXV * extraPartsYV ;
        totalPartsGridY = totalPartsGridY + extraPartsGridY; // total parts
     }


    //DISPLAY THE GREATES QTY
    if(totalPartsGridX >= totalPartsGridY)
    {
        float yieldsX = 1 / totalPartsGridX;
        ui->label_TotalParts->setText(QString::number(totalPartsGridX));
        // here I'm using the 'f' to specify the format type, otherwise I would get a number like 0.0000e-00
        ui->label_Yields->setText(QString::number(yieldsX,'f',8));
         drawPartsX();// draw parts only after checking if fields contain numbers
         // status message
         ui->statusBar->showMessage(" Calculating yields...", 500);
    }
    else
    {
        float yieldsY = 1 / totalPartsGridY;
        ui->label_TotalParts->setText(QString::number(totalPartsGridY));
        // here I'm using the 'f' to specify the format type, otherwise I would get a number like 0.0000e-00
        ui->label_Yields->setText(QString::number(yieldsY,'f',8));
        drawPartsY();
        // status message
        ui->statusBar->showMessage("  Calculating yields...", 500);
    }


    }// end main else

}// end calculate
Ejemplo n.º 20
0
void Title::disable()
{
	_canDraw = false;
	disableButtons();
}
Ejemplo n.º 21
0
VOID resizePDF(VOID *hwnd)
{
HAB habT;
HMQ hmqT;
CHAR errMsg1[80];
CHAR sizeStr[15];
ULONG totalSpace, allocated, available;
ULONG drvNum, drvNumOrg, ulDriveMap;
struct find_t ffblk;
struct Smp
   {
   SHORT indx;
   CHAR noteName[NAMESIZE];
   }tplate;

habT = WinInitialize(0);
hmqT = WinCreateMsgQueue(habT, 0);
WinCancelShutdown(hmqT, TRUE);
subClassWin();
disableButtons();
/*
WinEnableMenuItem(hwndMenu, ID_MISC , FALSE);
WinEnableMenuItem(hwndMenu, ID_OPTIONS , FALSE);
WinEnableMenuItem(hwndMenu, ID_HELPME , FALSE);
WinEnableMenuItem(hwndMenu, ID_SETMODULES , FALSE);
WinEnableMenuItem(WinWindowFromID(hwndFrame, FID_SYSMENU), SC_CLOSE , FALSE);
*/

_dos_findfirst(datFile, _A_NORMAL, &ffblk);
DosQueryCurrentDisk(&drvNumOrg, &ulDriveMap);
drvNum = pdf[0].noteText[0] - '@';
DosSetDefaultDisk(drvNum);
QueryDiskSpace (drvNum,
		&totalSpace,
		&allocated,
		&available);
if( ((ffblk.size*2)+44000) >= available )
   {
   strcpy(errMsg1, "You need at least ");
   ultoa((ffblk.size*2)+44000, sizeStr, 10);
   strcat(errMsg1, sizeStr);
   strcat(errMsg1, " bytes free and possibly more to resize this file.");
   WinMessageBox(HWND_DESKTOP,
		 (HWND)hwnd,
		 errMsg1,
		 "Not enough disk space to accomplish task!",
		 0,
		 MB_ICONEXCLAMATION | MB_OK);
   }
else
   {
   INT LRECSIZE;
   INT xx, i;
   FILE *rHan, *hanTMP;
   div_t dvt;
   INT origFL;

   origFL = FIXEDLEN;
   rHan = fopen(datFile, MRW);
   fseek(rHan, 0L, SEEK_SET);
   fread(&recIndex, sizeof(recIndex), 1, rHan);
   xx = WinQueryLboxCount(WinWindowFromID((HWND)hwnd, ID_LISTBOX1));
   LRECSIZE = 0;
   for(i=0;i<xx;i++)
      {
      fread(&tplate, sizeof(tplate), 1, rHan);
      fread(&dataRecs.noteText, FIXEDLEN, 1, rHan);
      if( strlen(dataRecs.noteText) > LRECSIZE )
	 LRECSIZE = strlen(dataRecs.noteText);
      }
   fclose(rHan);
   if( LRECSIZE < 1000 )
      sModSize = 1;
   if( LRECSIZE > 28999 )
      sModSize = 30;
   if( (LRECSIZE > 999) && (LRECSIZE < 29000) )
      {
      dvt = div(LRECSIZE, 1000);
      if( dvt.rem == 0 )
	 sModSize = dvt.quot;
      else
	 sModSize = dvt.quot + 1;
      }
   if( newSizePrompt((HWND)hwnd) )
      {
      rHan = fopen(datFile, MRW);
      fseek(rHan, 0L, SEEK_SET);
      fread(&recIndex, sizeof(recIndex), 1, rHan);
      recIndex[0].alIndex = sModSize;
      hanTMP = fopen("TMP$$$$$.PDF", "w+b" );
      fwrite(&recIndex, sizeof(recIndex), 1, hanTMP);
      for(i=0;i<xx;i++)
	 {
	 fread(&tplate, sizeof(tplate), 1, rHan);
	 fread(&dataRecs.noteText, FIXEDLEN, 1, rHan);
	 fwrite(&tplate, sizeof(tplate), 1, hanTMP);
	 fwrite(&dataRecs.noteText, sModSize, 1, hanTMP);
	 }
      fclose(rHan);
      fclose(hanTMP);
      if( rename(datFile, "X$X$$$$$.PDF") != 0 )
	 {
	 FIXEDLEN = origFL;
	 recIndex[0].alIndex = FIXEDLEN;
	 sModSize = FIXEDLEN;
	 }
      if( rename("TMP$$$$$.PDF", datFile) != 0 )
	 {
	 FIXEDLEN = origFL;
	 recIndex[0].alIndex = FIXEDLEN;
	 rename("X$X$$$$$.PDF", datFile);
	 sModSize = FIXEDLEN;
	 }
      remove("X$X$$$$$.PDF");
      FIXEDLEN = sModSize;
      initLoad(WinWindowFromID((HWND)hwnd, ID_LISTBOX1), datFile);
      setStatus((HWND)hwnd, datFile);
      WinPostMsg(WinWindowFromID((HWND)hwnd, ID_LISTBOX1),
		 LM_SELECTITEM,
		 MPFROMSHORT(0),
		 MPFROMSHORT(TRUE));
      }
   }
DosSetDefaultDisk(drvNumOrg);
enableButtons();
unSubClassWin();
/*
WinEnableMenuItem(hwndMenu, ID_OPTIONS , TRUE);
WinEnableMenuItem(hwndMenu, ID_HELPME , TRUE);
WinEnableMenuItem(hwndMenu, ID_MISC , TRUE);
WinEnableMenuItem(hwndMenu, ID_SETMODULES , TRUE);
WinEnableMenuItem(WinWindowFromID(hwndFrame, FID_SYSMENU), SC_CLOSE , TRUE);
*/
WinDestroyMsgQueue(hmqT);
WinTerminate(habT);
_endthread();
}
Ejemplo n.º 22
0
ClientSearch::ClientSearch(QWidget *parent, const Client* model_) :
    QWidget(parent), model(model_), selected_user(""), selected_search("Tutto")
{
    title=new QLabel("Ricerca",this);
    title->setFont(QFont("Helvetica [Cronyx]", 16, QFont::Bold));
    title->setStyleSheet("font-variant: small-caps; border-bottom:1px solid black;");

    table=new QTableWidget(0,3,this);
    table->setEditTriggers(QAbstractItemView::NoEditTriggers);
    table->setSelectionMode(QAbstractItemView::SingleSelection);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    for(int i=0; i<table->columnCount(); i++)
        table->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch);
    table->setMinimumWidth(319);
    table->setMaximumHeight(250);
    QStringList tabHeader;
    tabHeader<<"Username"<<"Nome"<<"Cognome";
    table->setHorizontalHeaderLabels(tabHeader);

    title_Search=new QLabel("Cerca per: ");
    type_Search=new QComboBox(this);
    type_Search->setMinimumWidth(180);
    QStringList typeSearch;
    typeSearch<<"Tutto"<<"Username"<<"Nome"<<"Cognome";
    type_Search->addItems(typeSearch);
    text_Search=new QLineEdit(this);
    text_Search->setPlaceholderText("Cerca utenti ");
    text_Search->setStyleSheet("color: #808080;");

    button_Search=new QPushButton("Cerca!",this);
    button_Search->setMinimumWidth(150);
    add=new QPushButton("Aggiungi",this);
    detail=new QPushButton("Mostra dettagli",this);
    disableButtons();

    info=new QLabel(this);
    QString info_txt("Scrivi cosa stai cercando e premi INVIO.<br/>");
    info_txt.append("Nella tabella verranno mostrati i risultati che corrispondono alle parole cercate.<br/><br/>");
    info_txt.append(model->getClientUtente()->info());
    info->setText(info_txt);
    info->setMaximumWidth(600);

    connect(detail,SIGNAL(clicked()),this,SLOT(showInfoSelection()));
    connect(button_Search,SIGNAL(clicked()),this,SLOT(search()));
    connect(add,SIGNAL(clicked()),this,SLOT(addContact()));
    connect(text_Search,SIGNAL(cursorPositionChanged(int,int)),this,SLOT(selectText()));
    connect(text_Search,SIGNAL(returnPressed()),this,SLOT(search()));
    connect(type_Search,SIGNAL(activated(QString)),this,SLOT(setSelectedSearch(QString)));
    //connect table
    connect(table,SIGNAL(cellClicked(int,int)),this,SLOT(setSelectedUser(int)));
    connect(table,SIGNAL(cellClicked(int,int)),this,SLOT(enableButtons()));
    connect(table,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(showInfoSelection()));

    layout_search=new QHBoxLayout();
    layout_search->addWidget(button_Search);
    layout_search->addWidget(text_Search);
    layout_search->addWidget(type_Search);

    layout_buttons=new QHBoxLayout();
    layout_buttons->addWidget(add);
    layout_buttons->addWidget(detail);

    layout=new QVBoxLayout(this);
    layout->addWidget(title);
    layout->addSpacing(10);
    layout->addLayout(layout_search);
    layout->addWidget(table);
    layout->addLayout(layout_buttons);
    layout->addSpacing(10);
    layout->addWidget(info);
    layout->addStretch(1);

    setLayout(layout);
}
ServerWindow::ServerWindow(QWidget* parent)
    :QWidget(parent)
{
    setWindowTitle("Qt TasServer Ui");

    monitor = new ServerMonitor();

    statusButton = new QPushButton("Check status");
    stopButton = new QPushButton("Stop");
    startButton = new QPushButton("Start");
    resetButton =  new QPushButton ("Reset server");
    loadPluginsButton = new QPushButton("Load Plugins");
#ifdef Q_OS_SYMBIAN
    pluginButton = new QPushButton ("Enable tas");    
    autoStart = new QCheckBox("Autostart"); 
    autoStart->setTristate(false);
    if(monitor->autostartState()){
        autoStart->setCheckState(Qt::Checked);
    }
    connect(autoStart, SIGNAL(toggled(bool)), monitor, SLOT(setAutoStart(bool)));
#endif

    QLabel* stateLabel = new QLabel("Server state:");
    QLabel* versionLabel = new QLabel("Server version:");   
    QLabel* stateValue = new QLabel("Unknown");
    QLabel* versionValue = new QLabel(TAS_VERSION);


    QLabel* hostBindingLabel =  new QLabel("Server Address Binding:");
    anyBindRadioButton = new QRadioButton("Any");
    localBindRadioButton = new QRadioButton("Localhost");
    anyBindRadioButton->setDisabled(true);
    localBindRadioButton->setDisabled(true);

    connect(monitor, SIGNAL(serverState(const QString&)), stateValue, SLOT(setText(const QString&)));
    connect(monitor, SIGNAL(beginMonitor()), this, SLOT(disableButtons()));
    connect(monitor, SIGNAL(stopMonitor()), this, SLOT(enableButtons()));
    connect(monitor, SIGNAL(disableReBinding()), this, SLOT(disableRadioButtons()));
    connect(monitor, SIGNAL(enableReBinding(const QString&)), this, SLOT(enableRadioButtons(const QString&)));

    QTextEdit* editField = new QTextEdit();
    editField->setReadOnly(true);
    connect(monitor, SIGNAL(serverDebug(const QString&)), editField, SLOT(append(const QString&)));

    connect(startButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(stopButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(resetButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(statusButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(loadPluginsButton, SIGNAL(clicked()), editField, SLOT(clear()));


    connect(anyBindRadioButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(localBindRadioButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(anyBindRadioButton, SIGNAL(clicked()), monitor, SLOT(setAnyBinding()));
    connect(localBindRadioButton, SIGNAL(clicked()), monitor, SLOT(setLocalBinding()));


#ifdef Q_OS_SYMBIAN
    connect(pluginButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(pluginButton, SIGNAL(clicked()), monitor, SLOT(enablePluginLoad()));
#endif

    connect(statusButton, SIGNAL(clicked()), monitor, SLOT(serverState()));    
    connect(stopButton, SIGNAL(clicked()), monitor, SLOT(stopServer()));
    connect(startButton, SIGNAL(clicked()), monitor, SLOT(startServer()));
    connect(resetButton, SIGNAL(clicked()), monitor, SLOT(restartServer()));    
    connect(loadPluginsButton, SIGNAL(clicked()),monitor, SLOT(loadPlugins()));

    QPushButton* quitButton = new QPushButton("Quit");
    connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));

    QGridLayout* mainLayout = new QGridLayout();
    mainLayout->addWidget(stateLabel, 0, 0, 1, 1);
    mainLayout->addWidget(stateValue, 0, 1, 1, 1);
    mainLayout->addWidget(versionLabel, 1, 0);
    mainLayout->addWidget(versionValue, 1, 1);

    // Server binding Radio
    mainLayout->addWidget(hostBindingLabel, 2, 0);
    mainLayout->addWidget(anyBindRadioButton, 2, 1);
    mainLayout->addWidget(localBindRadioButton, 3, 1);

    mainLayout->addWidget(editField, 4,0, 1, 2);
#ifdef Q_OS_SYMBIAN
    mainLayout->addWidget(statusButton, 5, 0);
    mainLayout->addWidget(pluginButton, 5, 1);
#else
    mainLayout->addWidget(statusButton, 5, 0);
    mainLayout->addWidget(loadPluginsButton, 5, 1);
#endif
    mainLayout->addWidget(stopButton, 6, 0);
    mainLayout->addWidget(startButton, 6, 1);
    mainLayout->addWidget(resetButton, 7, 0);
    mainLayout->addWidget(quitButton, 7, 1);
#ifdef Q_OS_SYMBIAN
    mainLayout->addWidget(autoStart, 8, 0);
    mainLayout->addWidget(loadPluginsButton, 8, 1);
#endif
    setLayout(mainLayout);     

//    QRect rect = qApp->desktop()->screenGeometry();    
//    if(rect.width() > 864)
//        setFixedSize(350,600);
//    else{
//        showFullScreen();    
//    }

}
//------------------------------------------------------------------------------------------------
void CalibrationWidget::startCalibration()
{
    // Read settings
    bool ok = false;

    const int cornersHorizontal = calibrationWidget->lineEdit_eckenHorizontal->text().toInt(&ok);
    if (!ok)
    {
        showError(
            trUtf8("Bitte das Eingabefeld für die Anzahl der horizontalen Ecken überprüfen. Es "
                   "muss eine positive ganze Zahl eingegeben werden."));
        errorDialog->show();
        return;
    }

    const int cornersVertical = calibrationWidget->lineEdit_eckenVertikal->text().toInt(&ok);
    if (!ok)
    {
        errorDialog->setText(
            trUtf8("Bitte das Eingabefeld für die Anzahl der vertikalen Ecken überprüfen. Es muss "
                   "eine positive ganze Zahl eingegeben werden."));
        errorDialog->show();
        return;
    }

    const int32_t cornerRefinmentWindowSizeHorizontal
        = calibrationWidget->lineEdit_cornerRefinmentWindowSizeHorizontal->text().toInt(&ok);
    if (!ok)
    {
        showError(
            trUtf8("Bitte das Eingabefeld für die horizontale Fenstergröße der Eckenverfeinerung "
                   "überprüfen. Es muss eine positive ganze Zahl eingegeben werden."));
        return;
    }

    const int32_t cornerRefinmentWindowSizeVertical
        = calibrationWidget->lineEdit_cornerRefinmentWindowSizeVertical->text().toInt(&ok);
    if (!ok)
    {
        showError(
            trUtf8("Bitte das Eingabefeld für die vertikale Fenstergröße der Eckenverfeinerung "
                   "überprüfen. Es muss eine positive ganze Zahl eingegeben werden."));
        return;
    }

    const double squareWidth = calibrationWidget->lineEdit_quadratGroesse->text().toDouble(&ok);
    if (!ok)
    {
        showError(trUtf8("Bitte das Eingabefeld für die Quadratgröße überprüfen."));
        return;
    }

    std::vector<ImageModel::ImgData> imageData = imgModel->getImageData();
    if (imageData.size() <= 0)
    {
        showError(trUtf8("Es muss mindestens eine Datei für die Kalibrierung ausgewählt sein."));
        return;
    }

    calibTool.clearFiles();
    std::vector<int> filePathModelIndices;
    for (size_t i = 0; i < imageData.size(); ++i)
    {
        imageData[i].found = false;
        imageData[i].error = 0;
        imageData[i].boardCornersImg.clear();

        imgModel->setImageData(i, imageData[i]);

        if (imageData[i].checked)
        {
            calibTool.addFile(imageData[i].filePath);
            filePathModelIndices.push_back(i);
        }
    }

    // Get filepath
    const QString filePath = QFileDialog::getSaveFileName(this, trUtf8("Datei speichern"),
        QDir::homePath() + "/", trUtf8("XML-Dateien (*.xml);;JSON-Dateien (*.json)"));

    if (!filePath.endsWith(".xml") && !filePath.endsWith(".json"))
    {
        showError(trUtf8("Die Datei muss die Endung \".xml\" oder \".json\" haben."));
        return;
    }

    if (filePath.isEmpty())
    {
        showError(trUtf8("Dateipfad ist leer."));
        return;
    }

    // set parameters
    calibTool.setChessboardSize(cv::Size2i(cornersHorizontal, cornersVertical));
    calibTool.setChessboardSquareWidth(squareWidth);
    calibTool.setCornerRefinmentWindowSize(
        cv::Size2i(cornerRefinmentWindowSizeHorizontal, cornerRefinmentWindowSizeVertical));

    int calibrationFlags = 0;
    switch (calibrationWidget->comboBox_distortionModel->currentIndex())
    {
    case 0:
    {
        calibrationFlags = 0;
        break;
    }
    case 1:
    {
        calibrationFlags |= cv::CALIB_RATIONAL_MODEL;
        break;
    }
    case 2:
    {
        calibrationFlags |= cv::CALIB_THIN_PRISM_MODEL;
        break;
    }
    case 3:
    {
        calibrationFlags |= cv::CALIB_RATIONAL_MODEL | cv::CALIB_THIN_PRISM_MODEL;
        break;
    }
    default:
    {
        throw std::runtime_error("Unknown calibration model.");
    }
    }

    calibTool.setCalibrationFlags(calibrationFlags);

    calibrationWidget->pushButton_kalibrieren->setText(trUtf8("Kalibrierung stoppen"));
    calibrationWidget->tableView_images->setEditTriggers(QAbstractItemView::NoEditTriggers);
    imgModel->setCheckboxesEnabled(false);
    disableButtons();

    // http://qt-project.org/wiki/QtConcurrent-run-member-function
    calibrationFuture = QtConcurrent::run(
        this, &CalibrationWidget::doCalibration, filePath, filePathModelIndices);
    calibrationRunning = true;
}