本文整理汇总了C++中slotError函数的典型用法代码示例。如果您正苦于以下问题:C++ slotError函数的具体用法?C++ slotError怎么用?C++ slotError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slotError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
Client::Client(const QString &strHost, int port, QWidget *parent) :
QWidget(parent),
nextBlockSize(0)
{
mySocket = new QTcpSocket();
mySocket->connectToHost(strHost, port);
connect(mySocket, SIGNAL(connected()), this, SLOT(slotConnected()));
connect(mySocket, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(mySocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError)));
txtInfo = new QTextEdit();
txtInput = new QLineEdit();
txtInfo->setReadOnly(true);
QPushButton *send = new QPushButton("&Send");
connect(send, SIGNAL(clicked()), this, SLOT(slotSendToServer()));
connect(txtInput, SIGNAL(returnPressed()), this, SLOT(slotSendToServer()));
QVBoxLayout *form = new QVBoxLayout(this);
form->addWidget(new QLabel("<H1>Client</H1>"));
form->addWidget(txtInfo);
form->addWidget(txtInput);
form->addWidget(send);
}
示例2: slotError
void PresentationAudioWidget::slotTimeUpdaterTimeout()
{
if (d->mediaObject->error() != QMediaPlayer::NoError)
{
slotError();
return;
}
qint64 current = d->mediaObject->position();
int hours = (int)(current / (qint64)(60 * 60 * 1000));
int mins = (int)((current / (qint64)(60 * 1000)) - (qint64)(hours * 60));
int secs = (int)((current / (qint64)1000) - (qint64)(hours * 60 + mins * 60));
QTime elapsedTime(hours, mins, secs);
if (d->isZeroTime && d->mediaObject->duration() > 0)
{
d->isZeroTime = false;
qint64 total = d->mediaObject->duration();
hours = (int)(total / (qint64)(60 * 60 * 1000));
mins = (int)((total / (qint64)(60 * 1000)) - (qint64)(hours * 60));
secs = (int)((total / (qint64)1000) - (qint64)(hours * 60 + mins * 60));
QTime totalTime(hours, mins, secs);
m_totalTimeLabel->setText(totalTime.toString(QString::fromLatin1("H:mm:ss")));
}
m_elapsedTimeLabel->setText(elapsedTime.toString(QString::fromLatin1("H:mm:ss")));
}
示例3: Q_UNUSED
void QFileTrans::slotPresenceReceived(const QXmppPresence &presence)
{
bool check;
Q_UNUSED(check);
// if we don't have a recipient, or if the presence is not from the recipient,
// do nothing
if (m_recipient.isEmpty() ||
QXmppUtils::jidToBareJid(presence.from()) != m_recipient ||
presence.type() != QXmppPresence::Available)
return;
// send the file and connect to the job's signals
QXmppTransferJob *job = transferManager->sendFile(presence.from(), ":/example_3_transferHandling.cpp", "example source code");
check = connect(job, SIGNAL(error(QXmppTransferJob::Error)),
this, SLOT(slotError(QXmppTransferJob::Error)));
Q_ASSERT(check);
check = connect(job, SIGNAL(finished()),
this, SLOT(slotFinished()));
Q_ASSERT(check);
check = connect(job, SIGNAL(progress(qint64,qint64)),
this, SLOT(slotProgress(qint64,qint64)));
Q_ASSERT(check);
}
示例4: slotError
void PlaybackWidget::slotTimeUpdaterTimeout()
{
if ( m_mediaObject->state() == Phonon::ErrorState )
{
slotError();
return;
}
long int current = m_mediaObject->currentTime();
int hours = (int)(current / (long int)( 60 * 60 * 1000 ));
int mins = (int)((current / (long int)( 60 * 1000 )) - (long int)(hours * 60));
int secs = (int)((current / (long int)1000) - (long int)(hours * 60 + mins * 60));
QTime elapsedTime(hours, mins, secs);
if ( m_isZeroTime )
{
m_isZeroTime = false;
long int total = m_mediaObject->totalTime();
hours = (int)(total / (long int)( 60 * 60 * 1000 ));
mins = (int)((total / (long int)( 60 * 1000 )) - (long int)(hours * 60));
secs = (int)((total / (long int)1000) - (long int)(hours * 60 + mins * 60));
QTime totalTime(hours, mins, secs);
m_totalTimeLabel->setText(totalTime.toString("H:mm:ss"));
}
m_elapsedTimeLabel->setText(elapsedTime.toString("H:mm:ss"));
}
示例5: connect
void JamendoBrowser::GetList(QString comefrom, QString text)
{
if(proxy->hasVariable("proxyEnabled") && proxy->getVariable("proxyEnabled") == "true") {
manager.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy,
proxy->getVariable("proxyHost"),
proxy->getVariable("proxyPort").toInt(),
proxy->getVariable("proxyUser"),
proxy->getVariable("proxyPassword")));
}
if(!comefrom.size()) comefrom = "http://api.jamendo.com/get2/id+name+rating+url+weight/tag/plain/?order=rating_desc";
comefrom += "&n=50";
reply = manager.get(QNetworkRequest(QUrl(comefrom)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError)));
if (text.size()) switch(listType) {
case LIST_GENRE:
_tag.tag0.genre = text; break;
case LIST_ARTIST:
_tag.tag0.artist = text; break;
case LIST_ALBUM:
_tag.tag0.album = text; break;
case LIST_NONE:
default:
;
}
}
示例6: url
void CloudControl::UploadRecipe(Recipe *recipe, QWidget *parent) {
// Pushes this Recipe to the remote output
QUrl url(getBaseURL()+"/recipes/");
QString xml = recipe->toXML("");
networkManager = new QNetworkAccessManager(parent);
QNetworkRequest request;
request.setUrl(url);
request.setRawHeader("User-agent", "StrangewbrewQT");
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream");
QByteArray data (xml.toUtf8());
qDebug() << xml.toUtf8();
qDebug() << "Data length: " << data.size();
uploadProgress = new QProgressDialog("Uploading recipe...", "Abort Upload", 0, data.size(), parent);
uploadProgress->show();
QNetworkReply *reply = networkManager->post(request, data);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(uploadComplete(QNetworkReply*)));
connect(reply, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(uploadingData(qint64, qint64)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
connect(uploadProgress, SIGNAL(canceled()), this, SLOT(uploadCancelled()));
}
示例7: QUrl
QNetworkReply* ownCloudInfo::getDirectoryListing( const QString& dir )
{
QNetworkRequest req;
req.setUrl( QUrl( webdavUrl(_connection) + dir ) );
req.setRawHeader("Depth", "1");
QByteArray xml("<?xml version=\"1.0\" ?>\n"
"<d:propfind xmlns:d=\"DAV:\">\n"
" <d:prop>\n"
" <d:resourcetype/>\n"
" </d:prop>\n"
"</d:propfind>\n");
QBuffer *buf = new QBuffer;
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
QNetworkReply *reply = davRequest("PROPFIND", req, buf);
buf->setParent(reply);
if( reply->error() != QNetworkReply::NoError ) {
qDebug() << "getting quota: request network error: " << reply->errorString();
}
connect( reply, SIGNAL( finished()), SLOT(slotGetDirectoryListingFinished()) );
connect( reply, SIGNAL( error(QNetworkReply::NetworkError)),
this, SLOT( slotError(QNetworkReply::NetworkError)));
return reply;
}
示例8: QWidget
Client::Client(const QString &host, int port, QWidget *parent) : QWidget(parent), blockSize(0)
{
socket = new QTcpSocket(this);
socket->connectToHost(host, port);
connect(socket, SIGNAL(connected()), SLOT(slotConnected()));
connect(socket, SIGNAL(readyRead()), SLOT(slotReadyRead()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotError(QAbstractSocket::SocketError)));
info = new QTextEdit;
input = new QLineEdit;
info->setReadOnly(true);
QPushButton* button = new QPushButton("&Send");
connect(button, SIGNAL(clicked()), SLOT(slotSendToServer()));
connect(input, SIGNAL(returnPressed()), SLOT(slotSendToServer()));
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(new QLabel("<h1>Client</h1>"));
layout->addWidget(info);
layout->addWidget(input);
layout->addWidget(button);
setLayout(layout);
}
示例9: setupUi
Process::Process (QStringList args, QString exec, QString dir, QString info, QString caption, bool showErr, QStringList env, QWidget * parent, Qt::WFlags f)
{
setupUi(this);
this->showErr=showErr;
myProcess.reset(new QProcess(parent));
myProcess->setEnvironment(env);
connect(myProcess.get(), SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinished(int, QProcess::ExitStatus)));
connect(myProcess.get(), SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotError(QProcess::ProcessError)));
connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_clicked()));
lblInfo->setText(info);
setWindowTitle(caption);
myProcess->setWorkingDirectory (dir);
myProcess->start(exec, args);
#ifdef DEBUG
qDebug()<<"[ii] Process args: "<<exec<<args;
#endif
return;
}
示例10: QWidget
MyClient::MyClient(const QString & hoststr, int port, QWidget * pwgt)
: QWidget(pwgt), nextBlockSize(0) {
tcpSocket = new QTcpSocket(this);
// установить связь с сервером
tcpSocket->connectToHost(hoststr, port);
// сокет отправляет сигнал connected() как только будет создано соединение
connect(tcpSocket, SIGNAL(connected()), SLOT(slotConnected()));
// сокет отправляет сигнал readyRead() при готовности предоставить данные для чтения
connect(tcpSocket, SIGNAL(readyRead()), SLOT(slotReadyRead()));
// в случае возникновения ошибки сокет отправляет сигнал error
connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError)));
textInfo = new QTextEdit;
textInput = new QLineEdit;
textInfo->setReadOnly(true);
QPushButton * cmd = new QPushButton("&Send");
connect(cmd, SIGNAL(clicked()), SLOT(slotSendToServer()));
connect(textInput, SIGNAL(returnPressed()), this, SLOT(slotSendToServer()));
QVBoxLayout * mainLayout = new QVBoxLayout;
mainLayout->addWidget(new QLabel("<H1>Client</H1>"));
mainLayout->addWidget(textInfo);
mainLayout->addWidget(textInput);
mainLayout->addWidget(cmd);
setLayout(mainLayout);
}
示例11: SIGNAL
int Downloader::download(bool wait)
{
if (!isStarted)
{
isStarted = true;
downloadError = 0;
if (!dlFile->open(QIODevice::WriteOnly))
{
errorStr += "can not open file " + dest + "\n";
return 1;
}
if (reply == NULL)
reply = network->get(request);
QObject::connect(reply, SIGNAL(readyRead()), this, SLOT(downloadedFileWrite()));
QObject::connect(reply, SIGNAL(finished ()), this, SLOT(handleDownload()));
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError)));
//QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));
if (wait)
{
QEventLoop loop;
QObject::connect(this, SIGNAL(finished(int)), &loop, SLOT(quit()));
loop.exec();
}
return downloadError;
}
示例12: fileInfo
void BlFile::sync() {
BL_FUNC_DEBUG
// if (!exists() {
QFileInfo fileInfo(m_file);
QString filename(fileInfo.fileName());
QString user = g_confpr->value(CONF_LOGIN_USER);
QString dbname = g_confpr->value(CONF_DBNAME);
#ifdef Q_OS_WIN32
QString platform = "MS_WIN";
#else
QString platform = "LINUX";
#endif
QString url = "http://www.bulmages.com/bulmaincloud/"+platform+"/"+user+"/"+dbname+"/"+filename;
fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData());
manager = new QNetworkAccessManager(this);
QNetworkRequest request;
request.setUrl(QUrl(url));
request.setRawHeader("User-Agent", "BgBrowser 1.0");
QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));
connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
while (reply->isRunning()) {
QApplication::processEvents();
} // end while
// }// end if
url = "http://www.bulmages.com/bulmaincloud/ALL/"+user+"/"+dbname+"/"+filename;
fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData());
request.setUrl(QUrl(url));
reply = manager->get(request);
while (reply->isRunning()) {
QApplication::processEvents();
} // end while
if (reply->error() == QNetworkReply::NoError) {
return;
} // end if
url = "http://www.bulmages.com/bulmaincloud/ALL/ALL/"+filename;
fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData());
request.setUrl(QUrl(url));
reply = manager->get(request);
while (reply->isRunning()) {
QApplication::processEvents();
} // end while
}
示例13: QNetworkAccessManager
XmlRpcResponse *XmlRpcClient::execute(XmlRpcRequest *request, bool async) {
QNetworkAccessManager *network_manager = new QNetworkAccessManager();
QNetworkRequest network_request;
network_request.setUrl(QUrl(this->address));
network_request.setRawHeader("User-Agent", "XMLRPC browser");
network_request.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
//connect(network_manager, SIGNAL(finished(QNetworkReply*)),
// this, SLOT(slotReplyFinished(QNetworkReply*)));
//qDebug() << "XMLRPC Request: " + request->toString().toLatin1();
QNetworkReply *reply = network_manager->post(network_request, request->toString().toLatin1());
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
//connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
// this, SLOT(slotSslErrors(QList<QSslError>)));
if(async)
return NULL; // wait for complete signal
QEventLoop loop;
connect(reply, SIGNAL(readyRead()), &loop, SLOT(quit()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), &loop, SLOT(quit()));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), &loop, SLOT(quit()));
loop.exec();
//qDebug() << "XMLRPC response: " + reply->readAll();
return XmlRpcResponse::fromString(reply->readAll());
}
示例14: collection
void ArchiveJob::execute()
{
if(mInfo) {
MailCommon::BackupJob *backupJob = new MailCommon::BackupJob();
Akonadi::Collection collection(mInfo->saveCollectionId());
backupJob->setRootFolder( MailCommon::Util::updatedCollection(collection) );
const QString realPath = MailCommon::Util::fullCollectionPath(collection);
backupJob->setSaveLocation( mInfo->realUrl(realPath) );
backupJob->setArchiveType( mInfo->archiveType() );
backupJob->setDeleteFoldersAfterCompletion( false );
backupJob->setRecursive( mInfo->saveSubCollection() );
backupJob->setDisplayMessageBox(false);
const QString summary = i18n("Start to archive %1",realPath );
const QPixmap pixmap = KIcon( "kmail" ).pixmap( KIconLoader::SizeSmall, KIconLoader::SizeSmall );
KNotification::event( QLatin1String("archivemailstarted"),
summary,
pixmap,
0,
KNotification::CloseOnTimeout,
KGlobal::mainComponent());
connect(backupJob,SIGNAL(backupDone(QString)),this,SLOT(slotBackupDone(QString)));
connect(backupJob,SIGNAL(error(QString)),this,SLOT(slotError(QString)));
backupJob->start();
}
}
示例15: recipient
void xmppClient::slotPresenceReceived(const QXmppPresence &presence)
{
const QLatin1String recipient("[email protected]");
// if we are the recipient, or if the presence is not from the recipient,
// do nothing
if (jidToBareJid(configuration().jid()) == recipient ||
jidToBareJid(presence.from()) != recipient ||
presence.type() != QXmppPresence::Available)
return;
// send the file and connect to the job's signals
QXmppTransferJob *job = transferManager->sendFile(presence.from(), "xmppClient.cpp");
bool check = connect( job, SIGNAL(error(QXmppTransferJob::Error)),
this, SLOT(slotError(QXmppTransferJob::Error)) );
Q_ASSERT(check);
check = connect( job, SIGNAL(finished()),
this, SLOT(slotFinished()) );
Q_ASSERT(check);
check = connect( job, SIGNAL(progress(qint64,qint64)),
this, SLOT(slotProgress(qint64,qint64)) );
Q_ASSERT(check);
}