// Add a scan to this model. The AMScan must exist elsewhere, for the lifetime that it is added to the model. Model does not take ownership of the scan. void AMScanSetModel::addScan(AMScan* newScan) { newScan->retain(this); // declare our interest in this scan. emit layoutAboutToBeChanged(); beginInsertRows(QModelIndex(), scans_.count(), scans_.count()); scans_.append(newScan); connect(newScan, SIGNAL(modifiedChanged(bool)), this, SLOT(onScanModifiedChanged(bool))); connect(newScan, SIGNAL(nameChanged(QString)), this, SLOT(onMetaDataChanged())); connect(newScan, SIGNAL(numberChanged(int)), this, SLOT(onMetaDataChanged())); connect(newScan, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(onMetaDataChanged())); connect(newScan, SIGNAL(sampleIdChanged(int)), this, SLOT(onMetaDataChanged())); QList<AMDataSourcePlotSettings> plotSettings; for(int i=0; i<newScan->dataSourceCount(); i++) { AMDataSourcePlotSettings ps; /// \todo set up nicer default colors (related within scans) ps.visible = newScan->dataSourceAt(i)->visibleInPlots(); // Initial visibility is now controlled in AMDataSource::visibleInPlots(). Scan controllers can initialize this, and it will be saved in the database. // Hack for Darren's 2D XRF maps and Mark's XES scans. if (newScan->scanRank() == 0){ ps.colorMap.setContrast(2.1); ps.colorMap.setBrightness(0.08); ps.colorMap.setGamma(1); } else if (newScan->scanRank() == 2 || newScan->scanRank() == 3){ ps.colorMap.setContrast(1); ps.colorMap.setBrightness(0); ps.colorMap.setGamma(1); } plotSettings.append(ps); } sourcePlotSettings_.append(plotSettings); // hook up signals from newScan to catch data source addition and removal connect(newScan, SIGNAL(dataSourceAdded(int)), this, SLOT(onDataSourceAdded(int))); connect(newScan, SIGNAL(dataSourceAboutToBeAdded(int)), this, SLOT(onDataSourceAboutToBeAdded(int))); connect(newScan, SIGNAL(dataSourceAboutToBeRemoved(int)), this, SLOT(onDataSourceAboutToBeRemoved(int))); connect(newScan, SIGNAL(dataSourceRemoved(int)), this, SLOT(onDataSourceRemoved(int))); endInsertRows(); emit scanAdded(newScan); /// \todo this is a hack; should not be needed... But we do need it to keep QTreeViews from getting messed up. Why? emit layoutChanged(); }
CustomDownload::CustomDownload(QNetworkReply *reply, QNetworkRequest request, qint64 dnsLookupTime, qint64 requestStartTime) { this->isWaiting = true; this->requestStartTime = requestStartTime; this->waitingTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); this->dnsLookupTime = dnsLookupTime; this->request = request; this->reply = reply; connect(reply, SIGNAL(finished()), this, SLOT(onFinished())); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onDownloadProgress(qint64, qint64))); connect(reply, SIGNAL(metaDataChanged()), this, SLOT(onMetaDataChanged())); /* connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(onUploadProgress(qint64, qint64))); */ }
void CFileDownload::download(const QString& strUrl, const QString& strFolder, bool bOverWrite, bool bAutoRemoveFile) { m_strFolder = strFolder; m_strUrl = strUrl; m_bOverWrite = bOverWrite; m_bAutoRemoveFile = bAutoRemoveFile; QUrl url; url.setEncodedUrl(m_strUrl.toAscii()); if (!url.isValid()) { emit finishedDownloadAttachmentItem(m_pAttachmentItem, tr("Error: Bad file URL")); return; } if(m_pAttachmentItem) m_pAttachmentItem->setProcessState(STATE_PS_UPLOADING); QNetworkRequest request(url); request.setRawHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"); // request.setRawHeader("User-Agent", "Wget"); // request.setRawHeader("Accept", "*/*"); // request.setRawHeader("Connection", "Keep-Alive"); // request.setRawHeader("Keep-Alive", "300"); m_pNetworkReply = m_pNetworkMgr->get(request); connect(m_pNetworkReply, SIGNAL(metaDataChanged()), this, SLOT(onMetaDataChanged())); connect(m_pNetworkReply, SIGNAL(readyRead()), this, SLOT(onReadyRead())); connect(m_pNetworkReply, SIGNAL(uploadProgress(qint64, qint64)), this, SIGNAL(uploadProgress(qint64, qint64))); connect(m_pNetworkReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(onDownloadProgress(qint64,qint64))); connect(m_pNetworkReply, SIGNAL(finished()), this, SLOT(onFinished())); }
TrackChange::TrackChange(QObject *parent) : QObject(parent) { m_core = SoundCore::instance(); m_plManager = PlayListManager::instance(); connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(onStateChanged(Qmmp::State))); connect(m_core, SIGNAL(metaDataChanged()), SLOT(onMetaDataChanged())); connect(m_core, SIGNAL(finished()), SLOT(onFinised())); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); m_newTrackCommand = settings.value("TrackChange/new_track_command").toString(); m_endOfTrackCommand = settings.value("TrackChange/end_of_track_command").toString(); m_endOfPlCommand = settings.value("TrackChange/end_of_pl_command").toString(); m_titleChangeCommand = settings.value("TrackChange/title_change_command").toString(); }