QInputOutputPacsWidget::QInputOutputPacsWidget(QWidget *parent)
 : QWidget(parent)
{
    setupUi(this);

    createContextMenuQStudyTreeWidget();

    Settings settings;
    settings.restoreColumnsWidths(InputOutputSettings::PACSStudyListColumnsWidth, m_studyTreeWidget->getQTreeWidget());

    QStudyTreeWidget::ColumnIndex sortByColumn = (QStudyTreeWidget::ColumnIndex) settings.getValue(InputOutputSettings::PACSStudyListSortByColumn).toInt();
    Qt::SortOrder sortOrderColumn = (Qt::SortOrder) settings.getValue(InputOutputSettings::PACSStudyListSortOrder).toInt();
    m_studyTreeWidget->setSortByColumn (sortByColumn, sortOrderColumn);

    m_statsWatcher = new StatsWatcher("QueryInputOutputPacsWidget", this);
    m_statsWatcher->addClicksCounter(m_retrievAndViewButton);
    m_statsWatcher->addClicksCounter(m_retrieveButton);

    // Preparem el QMovie per indicar quan s'estan fent consultes al PACS
    QMovie *operationAnimation = new QMovie(this);
    operationAnimation->setFileName(":/images/loader.gif");
    m_queryAnimationLabel->setMovie(operationAnimation);
    operationAnimation->start();

    setQueryInProgress(false);

    createConnections();
}
예제 #2
0
void AbstractItemDetail::initDialog()
{
	newNoteDialog = new CreateNoteDialog(this);
	newNoteDialog->hide();

	notesModel = new NotesModel(this);

	loading = new QLabel(this);
	QMovie *mov = new QMovie();
	mov->setCacheMode(QMovie::CacheAll);
	loading->setMovie(mov);
	mov->setFileName(":loading.gif");
	mov->setScaledSize(QSize(20, 20));
	mov->start();

	crm = SugarCrm::getInstance();

	notesTable = new QTableView(this);
	notesTable->verticalHeader()->hide();
	notesTable->horizontalHeader()->setStretchLastSection(true);
	notesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
	notesTable->setSelectionMode(QAbstractItemView::SingleSelection);

	// buttons
	save = new QPushButton(QIcon(":save.png"), tr("Speichern"));
	newNote = new QPushButton(QIcon(":notes.png"), tr("Neue Notiz"));
	newDocument = new QPushButton(QIcon(":documents.png"), tr("Neues Dokument"));

	connect(save, SIGNAL(pressed()),
			this, SLOT(saveChanges()));
	connect(newNote, SIGNAL(pressed()),
			this, SLOT(showNewNoteDialog()));
	connect(newNoteDialog, SIGNAL(accepted()),
			this, SLOT(createNewNote()));
	connect(newDocument, SIGNAL(pressed()),
			this, SLOT(showNewDocumentDialog()));
	connect(notesTable, SIGNAL(doubleClicked(QModelIndex)),
			this, SLOT(downloadNoteAttachment(QModelIndex)));
}
void MainWindow::keyFound(bool found, bool* featuresMatrix) {
    QString disabledMenuBtnSS = QString::fromUtf8(SS_MENU_DISABLED);
    QString checkedMenuBtnSS = QString::fromUtf8(SS_MENU_CHECKED);
    QString uncheckedMenuBtnSS = QString::fromUtf8(SS_MENU_UNCHECKED);
    QString copyBtnSS = QString::fromUtf8(SS_COPY_BTN);
    QString blankBtnSS = QString::fromUtf8(SS_BLANK_BTN);

    resetDeviceInfo();

    if(found) {
        YubiKeyFinder *finder = YubiKeyFinder::getInstance();
        int touchLevel = finder->touchLevel();
        qDebug() << "touchLevel is " << touchLevel;
        if(touchLevel & CONFIG1_VALID && touchLevel & CONFIG2_VALID) {
            ui->programLbl->setText(tr("Slot 1 and 2 configured"));
        } else if(touchLevel & CONFIG1_VALID) {
            ui->programLbl->setText(tr("Slot 1 configured"));
        } else if(touchLevel & CONFIG2_VALID) {
            ui->programLbl->setText(tr("Slot 2 configured"));
        } else {
            ui->programLbl->setText(tr("Not configured"));
        }

        unsigned int version = finder->version();
        ui->statusLbl->setText(KEY_FOUND);
        ui->statusLbl->setStyleSheet(QString::fromUtf8(SS_YKSTATUS_SUCCESS));

        ui->versionLbl->setText(finder->versionStr());
        qDebug() << "version is" << finder->versionStr();

        QPixmap pixmap;
        QMovie *movie = new QMovie();
        if(version < YK_VERSION(2,0,0)) {
            pixmap.load(":/res/images/v1-3-not-animated.png");
        } else if(version < YK_VERSION(2,1,4)) {
            movie->setFileName(":/res/images/V2-0-2-1-animated.gif");
        } else if(version < YK_VERSION(2,2,0)) {
            // YubiKey NEO
            pixmap.load(":/res/images/neo_transparent.png");
        } else if(version % 10 == 9){
            pixmap.load(":/res/images/yubikey_devel.png");
        } else if(version < YK_VERSION(2,3,0)){
            movie->setFileName(":/res/images/v2-2-animated.gif");
        } else {
            movie->setFileName(":/res/images/v2-3-animated.gif");
        }
        if(pixmap.isNull()) {
            ui->deviceImage->setMovie(movie);
            movie->start();
        } else {
            delete movie;
            ui->deviceImage->setPixmap(pixmap);
        }
        ui->deviceImage->setHidden(false);

        unsigned int serial = 0;
        if(featuresMatrix[YubiKeyFinder::Feature_SerialNumber]) {
            serial = YubiKeyFinder::getInstance()->serial();
        }
        if(serial != 0) {
            ui->serialNoDecLbl->setText(QString::number(serial));

            //Convert serial number in hex and modhex
            unsigned char buf[16];
            memset(buf, 0, sizeof(buf));
            size_t bufLen = 0;

            QString tmp = QString::number(serial, 16);
            size_t len = tmp.length();
            if(len % 2 != 0) {
                len++;
            }
            YubiKeyUtil::qstrClean(&tmp, (size_t)len, true);
            YubiKeyUtil::qstrHexDecode(buf, &bufLen, tmp);

            QString hex = YubiKeyUtil::qstrHexEncode(buf, bufLen);
            QString modhex = YubiKeyUtil::qstrModhexEncode(buf, bufLen);

            ui->serialNoHexLbl->setText(hex);
            ui->serialNoModhexLbl->setText(modhex);

            ui->serialNoDecCopyBtn->setStyleSheet(copyBtnSS);
            ui->serialNoHexCopyBtn->setStyleSheet(copyBtnSS);
            ui->serialNoModhexCopyBtn->setStyleSheet(copyBtnSS);
        } else {
            ui->serialNoDecLbl->setText(NA);
            ui->serialNoHexLbl->setText(NA);
            ui->serialNoModhexLbl->setText(NA);
            ui->serialNoDecCopyBtn->setStyleSheet(blankBtnSS);
            ui->serialNoHexCopyBtn->setStyleSheet(blankBtnSS);
            ui->serialNoModhexCopyBtn->setStyleSheet(blankBtnSS);
        }

        ui->otpSupportLbl->setPixmap(TICKMAP);

        if(featuresMatrix[YubiKeyFinder::Feature_MultipleConfigurations]) {
            ui->multiConfigSupportLbl->setPixmap(TICKMAP);
        } else {
            ui->multiConfigSupportLbl->setPixmap(CROSSMAP);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_OathHotp]) {
            ui->oathHotpSupportLbl->setPixmap(TICKMAP);
            if(m_currentPage == Page_Oath) {
                ui->oathHotpMenuBtn->setStyleSheet(checkedMenuBtnSS);
            } else {
                ui->oathHotpMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
            }
            ui->oathHotpMenuBtn->setEnabled(true);
        } else {
            ui->oathHotpSupportLbl->setPixmap(CROSSMAP);
            ui->oathHotpMenuBtn->setStyleSheet(disabledMenuBtnSS);
            ui->oathHotpMenuBtn->setEnabled(false);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_StaticPassword]) {
            ui->staticPwdSupportLbl->setPixmap(TICKMAP);
            if(m_currentPage == Page_Static) {
                ui->staticMenuBtn->setStyleSheet(checkedMenuBtnSS);
            } else {
                ui->staticMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
            }
            ui->staticMenuBtn->setEnabled(true);
        } else {
            ui->staticPwdSupportLbl->setPixmap(CROSSMAP);
            ui->staticMenuBtn->setStyleSheet(disabledMenuBtnSS);
            ui->staticMenuBtn->setEnabled(false);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_ScanCodeMode]) {
            ui->scanCodeSupportLbl->setPixmap(TICKMAP);
        } else {
            ui->scanCodeSupportLbl->setPixmap(CROSSMAP);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_ChallengeResponse]) {
            ui->chalRespSupportLbl->setPixmap(TICKMAP);
            if(m_currentPage == Page_ChalResp) {
                ui->chalRespMenuBtn->setStyleSheet(checkedMenuBtnSS);
            } else {
                ui->chalRespMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
            }
            ui->chalRespMenuBtn->setEnabled(true);
        } else {
            ui->chalRespSupportLbl->setPixmap(CROSSMAP);
            ui->chalRespMenuBtn->setStyleSheet(disabledMenuBtnSS);
            ui->chalRespMenuBtn->setEnabled(false);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_Updatable]) {
            ui->updatableSupportLbl->setPixmap(TICKMAP);
        } else {
            ui->updatableSupportLbl->setPixmap(CROSSMAP);
        }

        if(featuresMatrix[YubiKeyFinder::Feature_Ndef]) {
            ui->ndefSupportLbl->setPixmap(TICKMAP);
        } else {
            ui->ndefSupportLbl->setPixmap(CROSSMAP);
        }
    } else {
        ui->programLbl->clear();
        ui->deviceImage->setHidden(true);
        if(ui->deviceImage->movie()) {
            delete(ui->deviceImage->movie());
            ui->deviceImage->setMovie(NULL);
        }
        if(ui->deviceImage->pixmap()) {
            ui->deviceImage->setPixmap(NULL);
        }
        ui->statusLbl->setText(NO_KEY_FOUND);
        ui->statusLbl->setStyleSheet(QString::fromUtf8(SS_YKSTATUS_ERROR));

        if(m_currentPage == Page_Oath) {
            ui->oathHotpMenuBtn->setStyleSheet(checkedMenuBtnSS);
        } else {
            ui->oathHotpMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
        }
        ui->oathHotpMenuBtn->setEnabled(true);

        if(m_currentPage == Page_Static) {
            ui->staticMenuBtn->setStyleSheet(checkedMenuBtnSS);
        } else {
            ui->staticMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
        }
        ui->staticMenuBtn->setEnabled(true);

        if(m_currentPage == Page_ChalResp) {
            ui->chalRespMenuBtn->setStyleSheet(checkedMenuBtnSS);
        } else {
            ui->chalRespMenuBtn->setStyleSheet(uncheckedMenuBtnSS);
        }
        ui->chalRespMenuBtn->setEnabled(true);
    }
}