void Folder::slotFolderDiscovered(bool, QString folderName) { ProgressInfo pi; pi._currentDiscoveredFolder = folderName; emit progressInfo(pi); ProgressDispatcher::instance()->setProgressInfo(alias(), pi); }
void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::Info& progress) { if( folder.isEmpty() ) { return; } emit progressInfo( folder, progress ); }
// the progress comes without a folder and the valid path set. Add that here // and hand the result over to the progress dispatcher. void Folder::slotTransmissionProgress(const ProgressInfo &pi) { if( !pi.hasStarted() ) { // this is the beginning of a sync, set the warning level to 0 _syncResult.setWarnCount(0); } emit progressInfo(pi); ProgressDispatcher::instance()->setProgressInfo(alias(), pi); }
SettingsDialog::SettingsDialog(Application *app, QWidget *parent) : QDialog(parent), _ui(new Ui::SettingsDialog) { _ui->setupUi(this); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(tr("%1 Settings").arg(Theme::instance()->appNameGUI())); QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png")); QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget); general->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(general); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/mirall/resources/network.png")); QListWidgetItem *network = new QListWidgetItem(networkIcon, tr("Network"), _ui->labelWidget); network->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(network); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); connect(networkSettings, SIGNAL(proxySettingsChanged()), app, SLOT(slotSetupProxy())); connect(networkSettings, SIGNAL(proxySettingsChanged()), FolderMan::instance(), SLOT(slotScheduleAllFolders())); //connect(generalSettings, SIGNAL(resizeToSizeHint()), SLOT(resizeToSizeHint())); _accountSettings = new AccountSettings(this); addAccount(tr("Account"), _accountSettings); slotUpdateAccountState(); connect( app, SIGNAL(folderStateChanged(Folder*)), _accountSettings, SLOT(slotUpdateFolderState(Folder*))); connect( app, SIGNAL(folderStateChanged(Folder*)), SLOT(slotUpdateAccountState())); connect( _accountSettings, SIGNAL(addASync()), app, SLOT(slotFolderAdded()) ); connect( _accountSettings, SIGNAL(folderChanged()), app, SLOT(slotFoldersChanged())); connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)), app, SLOT(slotFolderOpenAction(QString))); connect( _accountSettings, SIGNAL(openProgressDialog()), app, SLOT(slotItemProgressDialog())); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); connect( ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(QString,Progress::SyncProblem)), _accountSettings, SLOT(slotProgressProblem(QString,Progress::SyncProblem)) ); _ui->labelWidget->setCurrentRow(_ui->labelWidget->row(general)); connect(_ui->labelWidget, SIGNAL(currentRowChanged(int)), _ui->stack, SLOT(setCurrentIndex(int))); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); connect(closeButton, SIGNAL(pressed()), SLOT(accept())); MirallConfigFile cfg; cfg.restoreGeometry(this); }
SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent) : MacPreferencesWindow(parent) { // do not show minimize button. There is no use, and retoring the // dialog from minimize is broken in MacPreferencesWindow setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint); // Emulate dialog behavior: Escape means close QAction *closeDialogAction = new QAction(this); closeDialogAction->setShortcut(QKeySequence(Qt::Key_Escape)); connect(closeDialogAction, SIGNAL(triggered()), SLOT(close())); addAction(closeDialogAction); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(close())); addAction(closeWindowAction); setObjectName("SettingsMac"); // required as group for saveGeometry call setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI())); _accountSettings = new AccountSettings; QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Undefined, true); _accountIdx = addPreferencesPanel(icon, tr("Account"), _accountSettings); QIcon protocolIcon(QLatin1String(":/mirall/resources/activity.png")); _protocolWidget = new ProtocolWidget; _protocolIdx = addPreferencesPanel(protocolIcon, tr("Activity"), _protocolWidget); QIcon generalIcon = MacStandardIcon::icon(MacStandardIcon::PreferencesGeneral); GeneralSettings *generalSettings = new GeneralSettings; addPreferencesPanel(generalIcon, tr("General"), generalSettings); QIcon networkIcon = MacStandardIcon::icon(MacStandardIcon::Network); NetworkSettings *networkSettings = new NetworkSettings; addPreferencesPanel(networkIcon, tr("Network"), networkSettings); FolderMan *folderMan = FolderMan::instance(); connect( folderMan, SIGNAL(folderSyncStateChange(QString)), this, SLOT(slotSyncStateChange(QString))); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); QAction *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); connect(showLogWindow, SIGNAL(triggered()), gui, SLOT(slotToggleLogBrowser())); addAction(showLogWindow); MirallConfigFile cfg; cfg.restoreGeometry(this); }
ProtocolWidget::ProtocolWidget(QWidget *parent) : QWidget(parent), IgnoredIndicatorRole( Qt::UserRole +1 ), _ui(new Ui::ProtocolWidget) { _ui->setupUi(this); connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString,ProgressInfo)), this, SLOT(slotProgressInfo(QString,ProgressInfo))); connect(ProgressDispatcher::instance(), SIGNAL(itemCompleted(QString,SyncFileItem,PropagatorJob)), this, SLOT(slotItemCompleted(QString,SyncFileItem,PropagatorJob))); connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(slotOpenFile(QTreeWidgetItem*,int))); // Adjust copyToClipboard() when making changes here! QStringList header; header << tr("Time"); header << tr("File"); header << tr("Folder"); header << tr("Action"); header << tr("Size"); _ui->_treeWidget->setHeaderLabels( header ); _ui->_treeWidget->setColumnWidth(1, 180); _ui->_treeWidget->setColumnCount(5); _ui->_treeWidget->setRootIsDecorated(false); _ui->_treeWidget->setTextElideMode(Qt::ElideMiddle); _ui->_treeWidget->header()->setObjectName("ActivityListHeader"); #if defined(Q_OS_MAC) _ui->_treeWidget->setMinimumWidth(400); #endif _ui->_headerLabel->setText(tr("Local sync protocol")); QPushButton *copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); copyBtn->setToolTip( tr("Copy the activity list to the clipboard.")); copyBtn->setEnabled(true); connect(copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard())); // this view is used to display all errors such as real errors, soft errors and ignored files // it is instantiated here, but made accessible via the method issueWidget() so that it can // be embedded into another gui element. _issueItemView = new QTreeWidget(this); header.removeLast(); _issueItemView->setHeaderLabels( header ); _issueItemView->setColumnWidth(1, 180); _issueItemView->setColumnCount(4); _issueItemView->setRootIsDecorated(false); _issueItemView->setTextElideMode(Qt::ElideMiddle); _issueItemView->header()->setObjectName("ActivityErrorListHeader"); }
ProtocolWidget::ProtocolWidget(QWidget *parent) : QWidget(parent), IgnoredIndicatorRole( Qt::UserRole +1 ), _ui(new Ui::ProtocolWidget) { _ui->setupUi(this); connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString,Progress::Info)), this, SLOT(slotProgressInfo(QString,Progress::Info))); connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(slotOpenFile(QTreeWidgetItem*,int))); // Adjust copyToClipboard() when making changes here! QStringList header; header << tr("Time"); header << tr("File"); header << tr("Folder"); header << tr("Action"); header << tr("Size"); _ui->_treeWidget->setHeaderLabels( header ); _ui->_treeWidget->setColumnWidth(1, 180); _ui->_treeWidget->setColumnCount(5); _ui->_treeWidget->setRootIsDecorated(false); _ui->_treeWidget->setTextElideMode(Qt::ElideMiddle); _ui->_treeWidget->header()->setObjectName("ActivityListHeader"); #if defined(Q_OS_MAC) _ui->_treeWidget->setMinimumWidth(400); #endif connect(this, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString))); _retrySyncBtn = _ui->_dialogButtonBox->addButton(tr("Retry Sync"), QDialogButtonBox::ActionRole); _retrySyncBtn->setEnabled(false); connect(_retrySyncBtn, SIGNAL(clicked()), SLOT(slotRetrySync())); _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); _copyBtn->setToolTip( tr("Copy the activity list to the clipboard.")); _copyBtn->setEnabled(false); connect(_copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard())); ConfigFile cfg; cfg.restoreGeometryHeader(_ui->_treeWidget->header()); }
SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) : QDialog(parent), _ui(new Ui::SettingsDialog) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); _ui->setupUi(this); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI())); _accountSettings = new AccountSettings(this); addAccount(tr("Account"), _accountSettings); QIcon protocolIcon(QLatin1String(":/mirall/resources/activity.png")); QListWidgetItem *protocol= new QListWidgetItem(protocolIcon, tr("Activity"), _ui->labelWidget); protocol->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(protocol); _protocolWidget = new ProtocolWidget; _protocolIdx = _ui->stack->addWidget(_protocolWidget); QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png")); QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget); general->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(general); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/mirall/resources/network.png")); QListWidgetItem *network = new QListWidgetItem(networkIcon, tr("Network"), _ui->labelWidget); network->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(network); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); connect( _accountSettings, SIGNAL(folderChanged()), gui, SLOT(slotFoldersChanged())); connect( _accountSettings, SIGNAL(accountIconChanged(QIcon)), SLOT(slotUpdateAccountIcon(QIcon))); connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)), gui, SLOT(slotFolderOpenAction(QString))); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); _ui->labelWidget->setCurrentRow(_ui->labelWidget->row(_accountItem)); connect(_ui->labelWidget, SIGNAL(currentRowChanged(int)), _ui->stack, SLOT(setCurrentIndex(int))); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); connect(closeButton, SIGNAL(clicked()), SLOT(accept())); QAction *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); connect(showLogWindow, SIGNAL(triggered()), gui, SLOT(slotToggleLogBrowser())); addAction(showLogWindow); int iconSize = 32; QListWidget *listWidget = _ui->labelWidget; int spacing = 20; // reverse at least ~8 characters int effectiveWidth = fontMetrics().averageCharWidth() * 8 + iconSize + spacing; // less than ~16 characters, elide otherwise int maxWidth = fontMetrics().averageCharWidth() * 16 + iconSize + spacing; for (int i = 0; i < listWidget->count(); i++) { QListWidgetItem *item = listWidget->item(i); QFontMetrics fm(item->font()); int curWidth = fm.width(item->text()) + iconSize + spacing; effectiveWidth = qMax(curWidth, effectiveWidth); if (curWidth > maxWidth) item->setToolTip(item->text()); } effectiveWidth = qMin(effectiveWidth, maxWidth); listWidget->setFixedWidth(effectiveWidth); MirallConfigFile cfg; cfg.restoreGeometry(this); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>& resultSpecification) { CVF_ASSERT(m_destinationCase); // First build the destination result data structures to receive the statistics for (int i = 0; i < resultSpecification.size(); i++) { RifReaderInterface::PorosityModelResultType poroModel = resultSpecification[i].m_poroModel; RimDefines::ResultCatType resultType = resultSpecification[i].m_resType; QString resultName = resultSpecification[i].m_resVarName; size_t activeCellCount = m_destinationCase->activeCellInfo(poroModel)->reservoirActiveCellCount(); RigCaseCellResultsData* destCellResultsData = m_destinationCase->results(poroModel); // Placeholder data used to be created here, // this is now moved to RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() // Create new result data structures to contain the statistical values std::vector<QString> statisticalResultNames; statisticalResultNames.push_back(createResultNameMin(resultName)); statisticalResultNames.push_back(createResultNameMax(resultName)); statisticalResultNames.push_back(createResultNameMean(resultName)); statisticalResultNames.push_back(createResultNameDev(resultName)); statisticalResultNames.push_back(createResultNameRange(resultName)); if (m_statisticsConfig.m_calculatePercentiles) { statisticalResultNames.push_back(createResultNamePVal(resultName, m_statisticsConfig.m_pMinPos)); statisticalResultNames.push_back(createResultNamePVal(resultName, m_statisticsConfig.m_pMidPos)); statisticalResultNames.push_back(createResultNamePVal(resultName, m_statisticsConfig.m_pMaxPos)); } if (activeCellCount > 0) { for (size_t i = 0; i < statisticalResultNames.size(); ++i) { addNamedResult(destCellResultsData, resultType, statisticalResultNames[i], activeCellCount); } } } // Start the loop that calculates the statistics caf::ProgressInfo progressInfo(m_timeStepIndices.size(), "Computing Statistics"); for (size_t timeIndicesIdx = 0; timeIndicesIdx < m_timeStepIndices.size(); timeIndicesIdx++) { size_t timeStepIdx = m_timeStepIndices[timeIndicesIdx]; for (size_t gridIdx = 0; gridIdx < m_destinationCase->gridCount(); gridIdx++) { RigGridBase* grid = m_destinationCase->grid(gridIdx); for (int resSpecIdx = 0; resSpecIdx < resultSpecification.size(); resSpecIdx++) { RifReaderInterface::PorosityModelResultType poroModel = resultSpecification[resSpecIdx].m_poroModel; RimDefines::ResultCatType resultType = resultSpecification[resSpecIdx].m_resType; QString resultName = resultSpecification[resSpecIdx].m_resVarName; size_t activeCellCount = m_destinationCase->activeCellInfo(poroModel)->reservoirActiveCellCount(); if (activeCellCount == 0) continue; RigCaseCellResultsData* destCellResultsData = m_destinationCase->results(poroModel); size_t dataAccessTimeStepIndex = timeStepIdx; // Always evaluate statistics once, and always use time step index zero if (resultType == RimDefines::STATIC_NATIVE) { if (timeIndicesIdx > 0) continue; dataAccessTimeStepIndex = 0; } // Build data access objects for source scalar results cvf::Collection<RigResultAccessor> sourceDataAccessList; for (size_t caseIdx = 0; caseIdx < m_sourceCases.size(); caseIdx++) { RimEclipseCase* sourceCase = m_sourceCases.at(caseIdx); // Trigger loading of dataset sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex); cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType); if (resultAccessor.notNull()) { sourceDataAccessList.push_back(resultAccessor.p()); } } // Build data access objects for destination scalar results // Find the created result container, if any, and put its resultAccessor into the enum indexed destination collection cvf::Collection<RigResultModifier> destinationDataAccessList; std::vector<QString> statisticalResultNames(STAT_PARAM_COUNT); statisticalResultNames[MIN] = createResultNameMin(resultName); statisticalResultNames[MAX] = createResultNameMax(resultName); statisticalResultNames[RANGE] = createResultNameRange(resultName); statisticalResultNames[MEAN] = createResultNameMean(resultName); statisticalResultNames[STDEV] = createResultNameDev(resultName); statisticalResultNames[PMIN] = createResultNamePVal(resultName, m_statisticsConfig.m_pMinPos); statisticalResultNames[PMID] = createResultNamePVal(resultName, m_statisticsConfig.m_pMidPos); statisticalResultNames[PMAX] = createResultNamePVal(resultName, m_statisticsConfig.m_pMaxPos); for (size_t stIdx = 0; stIdx < statisticalResultNames.size(); ++stIdx) { size_t scalarResultIndex = destCellResultsData->findScalarResultIndex(resultType, statisticalResultNames[stIdx]); cvf::ref<RigResultModifier> resultModifier = RigResultModifierFactory::createResultModifier(m_destinationCase, grid->gridIndex(), poroModel, dataAccessTimeStepIndex, scalarResultIndex); destinationDataAccessList.push_back(resultModifier.p()); } std::vector<double> statParams(STAT_PARAM_COUNT, HUGE_VAL); std::vector<double> values(sourceDataAccessList.size(), HUGE_VAL); // Loop over the cells in the grid, get the case values, and calculate the cell statistics #pragma omp parallel for schedule(dynamic) firstprivate(statParams, values) for (int cellIdx = 0; static_cast<size_t>(cellIdx) < grid->cellCount(); cellIdx++) { size_t reservoirCellIndex = grid->reservoirCellIndex(cellIdx); if (m_destinationCase->activeCellInfo(poroModel)->isActive(reservoirCellIndex)) { // Extract the cell values from each of the cases and assemble them into one vector bool foundAnyValidValues = false; for (size_t caseIdx = 0; caseIdx < sourceDataAccessList.size(); caseIdx++) { double val = sourceDataAccessList.at(caseIdx)->cellScalar(cellIdx); values[caseIdx] = val; if (val != HUGE_VAL) { foundAnyValidValues = true; } } // Do the real statistics calculations if (foundAnyValidValues) { RigStatisticsMath::calculateBasicStatistics(values, &statParams[MIN], &statParams[MAX], &statParams[RANGE], &statParams[MEAN], &statParams[STDEV]); // Calculate percentiles if (m_statisticsConfig.m_calculatePercentiles ) { if (m_statisticsConfig.m_pValMethod == RimEclipseStatisticsCase::NEAREST_OBSERVATION) { std::vector<double> pValPoss; pValPoss.push_back(m_statisticsConfig.m_pMinPos); pValPoss.push_back(m_statisticsConfig.m_pMidPos); pValPoss.push_back(m_statisticsConfig.m_pMaxPos); std::vector<double> pVals = RigStatisticsMath::calculateNearestRankPercentiles(values, pValPoss); statParams[PMIN] = pVals[0]; statParams[PMID] = pVals[1]; statParams[PMAX] = pVals[2]; } else if (m_statisticsConfig.m_pValMethod == RimEclipseStatisticsCase::HISTOGRAM_ESTIMATED) { std::vector<size_t> histogram; RigHistogramCalculator histCalc(statParams[MIN], statParams[MAX], 100, &histogram); histCalc.addData(values); statParams[PMIN] = histCalc.calculatePercentil(m_statisticsConfig.m_pMinPos); statParams[PMID] = histCalc.calculatePercentil(m_statisticsConfig.m_pMidPos); statParams[PMAX] = histCalc.calculatePercentil(m_statisticsConfig.m_pMaxPos); } else if (m_statisticsConfig.m_pValMethod == RimEclipseStatisticsCase::INTERPOLATED_OBSERVATION) { std::vector<double> pValPoss; pValPoss.push_back(m_statisticsConfig.m_pMinPos); pValPoss.push_back(m_statisticsConfig.m_pMidPos); pValPoss.push_back(m_statisticsConfig.m_pMaxPos); std::vector<double> pVals = RigStatisticsMath::calculateInterpolatedPercentiles(values, pValPoss); statParams[PMIN] = pVals[0]; statParams[PMID] = pVals[1]; statParams[PMAX] = pVals[2]; } else { CVF_ASSERT(false); } } } // Set the results into the results data structures for (size_t stIdx = 0; stIdx < statParams.size(); ++stIdx) { if (destinationDataAccessList[stIdx].notNull()) { destinationDataAccessList[stIdx]->setCellScalar(cellIdx, statParams[stIdx]); } } } } } } // When one time step is completed, free memory and clean up // Microsoft note: On Windows, the maximum number of files open at the same time is 512 // http://msdn.microsoft.com/en-us/library/kdfaxaay%28vs.71%29.aspx for (size_t caseIdx = 0; caseIdx < m_sourceCases.size(); caseIdx++) { RimEclipseCase* eclipseCase = m_sourceCases.at(caseIdx); if (!eclipseCase->reservoirViews.size()) { eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->freeAllocatedResultsData(); eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->freeAllocatedResultsData(); } // Todo : These calls really do nothing right now the access actually closes automatically in ert i belive ... eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->readerInterface()->close(); eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->readerInterface()->close(); } progressInfo.setProgress(timeIndicesIdx); } }