MediaApp::MediaApp(QWidget *parent) : QWidget(parent) { //create the player m_player = new Player(this); connect(m_player, SIGNAL(positionChanged()), this, SLOT(onPositionChanged())); connect(m_player, SIGNAL(stateChanged()), this, SLOT(onStateChanged())); //m_baseDir is used to remember the last directory that was used. //defaults to the current working directory m_baseDir = QLatin1String("."); //this timer (re-)hides the controls after a few seconds when we are in fullscreen mode m_fullScreenTimer.setSingleShot(true); connect(&m_fullScreenTimer, SIGNAL(timeout()), this, SLOT(hideControls())); //create the UI QVBoxLayout *appLayout = new QVBoxLayout; appLayout->setContentsMargins(0, 0, 0, 0); createUI(appLayout); setLayout(appLayout); onStateChanged(); //set the controls to their default state setWindowTitle(tr("QtGStreamer example player")); resize(400, 400); }
/** * private constructor */ MediaApp::MediaApp() : QWidget(), m_libraryOpened(false) { m_player = new Player(this); m_playlist = new Playlist(this); m_albumWidget = new AlbumWidget(this); m_albumWidget->LoadImage("Player", "The"); m_albumWidget->setGeometry(46, 16, 300, 300); connect(m_player, SIGNAL(positionChanged()), this, SLOT(onPositionChanged())); connect(m_player, SIGNAL(stateChanged()), this, SLOT(onStateChanged())); m_baseDir = QLatin1String("."); m_fullScreenTimer.setSingleShot(true); connect(&m_fullScreenTimer, SIGNAL(timeout()), this, SLOT(hideControls())); QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setContentsMargins(0, 0, 0, 0); createUI(mainLayout); setLayout(mainLayout); onStateChanged(); setWindowTitle(tr("ThePlayer")); resize(700, 400); }
void PendingDBusTubeConnection::onConnectionFinished(PendingOperation *op) { if (isFinished()) { // The operation has already failed return; } if (op->isError()) { // Fail setFinishedWithError(op->errorName(), op->errorMessage()); return; } debug() << "Accept/Offer tube finished successfully"; // Now get the address and set it PendingString *ps = qobject_cast<PendingString*>(op); debug() << "Got address " << ps->result(); mPriv->tube->setAddress(ps->result()); // It might have been already opened - check if (mPriv->tube->state() == TubeChannelStateOpen) { onStateChanged(mPriv->tube->state()); } else { // Wait until the tube gets opened on the other side connect(mPriv->tube.data(), SIGNAL(stateChanged(Tp::TubeChannelState)), this, SLOT(onStateChanged(Tp::TubeChannelState))); } }
void Button::setDisabled(bool disabled) { int oldState = _state; if (disabled && !(_state & StateDisabled)) { _state |= StateDisabled; emit stateChanged(oldState, ButtonByUser); onStateChanged(oldState, ButtonByUser); } else if (!disabled && (_state & StateDisabled)) { _state &= ~StateDisabled; emit stateChanged(oldState, ButtonByUser); onStateChanged(oldState, ButtonByUser); } }
void Button::setOver(bool over, ButtonStateChangeSource source) { if (over && !(_state & StateOver)) { int oldState = _state; _state |= StateOver; emit stateChanged(oldState, source); onStateChanged(oldState, source); } else if (!over && (_state & StateOver)) { int oldState = _state; _state &= ~StateOver; emit stateChanged(oldState, source); onStateChanged(oldState, source); } }
void Session::establish(int credentialsId) { m_identity = SignOn::Identity::existingIdentity(credentialsId, this); // TODO: if (!m_identity) { SignOn::IdentityInfo info; info.setCaption("Evernote"); info.setMethod("evernote", QStringList() << "AuthLogin"); m_identity = SignOn::Identity::newIdentity(info, this); } m_session = m_identity->createSession("evernote"); qDebug() << Q_FUNC_INFO << m_identity << credentialsId << m_session; connect(m_session, SIGNAL(error(SignOn::Error)), this, SLOT(onError(SignOn::Error))); connect(m_session, SIGNAL(response(SignOn::SessionData)), this, SLOT(onResponse(SignOn::SessionData))); connect(m_session, SIGNAL(stateChanged(AuthSession::AuthSessionState,QString)), this, SLOT(onStateChanged(AuthSession::AuthSessionState,QString))); m_session->process(SignOn::SessionData(), "AuthLogin"); }
QT_BEGIN_NAMESPACE /*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::OpenMAXILPlayerControl +-----------------------------------------------------------------------------*/ OpenMAXILPlayerControl::OpenMAXILPlayerControl(QObject *parent) : QMediaPlayerControl(parent) , m_ownStream(false) , m_seekToStartPending(false) , m_pendingSeekPosition(-1) , m_texProvider(make_shared<OMX_EGLBufferProvider>()) , m_mediaProcessor(new OMX_MediaProcessor(m_texProvider)) , m_renderer(NULL) { logi_debug_func; connect(m_mediaProcessor, SIGNAL(stateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)), this, SLOT(onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState))); connect(m_mediaProcessor, SIGNAL(mediaStatusChanged(OMX_MediaProcessor::OMX_MediaStatus)), this, SLOT(onMediaStatusChanged(OMX_MediaProcessor::OMX_MediaStatus))); connect(m_mediaProcessor, SIGNAL(metadataChanged(QVariantMap)), this, SIGNAL(metaDataChanged(QVariantMap))); connect(m_mediaProcessor, SIGNAL(streamLengthChanged(qint64)), this, SIGNAL(durationChanged(qint64))); }
QMLCallItem::QMLCallItem(CallItem *proxy, QObject *parent) : QObject(parent), d(new QMLCallItemPrivate) { TRACE d->proxy = proxy; QObject::connect(proxy->callProxy(), SIGNAL(stateChanged()), SLOT(onStateChanged())); }
void AbstractSocket::connectPrivateSignals() { // Used to manage socket expiration timeout // Expiration delay is reinit when a bytes is writted connect(this, SIGNAL(bytesWritten(qint64)), this, SLOT(onBytesWritten(qint64))); // Used to manage socket expiration timeout // Expiration delay is reinit when data are available is read connect(this, SIGNAL(readyRead()), this, SLOT(onReadyRead())); // Those next signals are used as debug, for now connect(this, SIGNAL(connected()), this, SLOT(onConnected())); connect(this, SIGNAL(disconnected()), this, SLOT(onDisconnected())); connect(this, SIGNAL(error ( QAbstractSocket::SocketError)), this, SLOT(onError ( QAbstractSocket::SocketError))); connect(this, SIGNAL(hostFound ()), this, SLOT(onHostFound ())); connect(this, SIGNAL(proxyAuthenticationRequired ( const QNetworkProxy &, QAuthenticator *)), this, SLOT(onProxyAuthenticationRequired ( const QNetworkProxy &, QAuthenticator *))); connect(this, SIGNAL(stateChanged (QAbstractSocket::SocketState)), this, SLOT(onStateChanged (QAbstractSocket::SocketState))); connect(this, SIGNAL(aboutToClose()), this, SLOT(onAboutToClose())); connect(this, SIGNAL(readChannelFinished()), this, SLOT(onReadChannelFinished())); }
QT_BEGIN_NAMESPACE /*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::OpenMAXILPlayerControl +-----------------------------------------------------------------------------*/ OpenMAXILPlayerControl::OpenMAXILPlayerControl(QObject *parent) : QMediaPlayerControl(parent) , m_ownStream(false) , m_seekToStartPending(false) , m_pendingSeekPosition(-1) , m_mediaProcessor(new OMX_MediaProcessor(OMX_TextureProviderSh(new OMX_TextureProviderQQuickItem()))) , m_textureData(NULL) , m_sceneGraphInitialized(false) , m_quickItem(NULL) { LOG_DEBUG(LOG_TAG, "%s", Q_FUNC_INFO); connect(m_mediaProcessor, SIGNAL(textureReady(const OMX_TextureData*)), this, SIGNAL(textureReady(const OMX_TextureData*))); connect(m_mediaProcessor, SIGNAL(textureInvalidated()), this, SIGNAL(textureInvalidated())); connect(m_mediaProcessor, SIGNAL(stateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)), this, SLOT(onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState))); connect(m_mediaProcessor, SIGNAL(metadataChanged(QVariantMap)), this, SIGNAL(metaDataChanged(QVariantMap))); }
void FileTransferController::handleFileTransferStateChange(FileTransfer::State state) { currentState = state; onStateChanged(); switch(state.type) { case FileTransfer::State::Initial: assert(false); return; case FileTransfer::State::Negotiating: chatWindow->setFileTransferStatus(uiID, ChatWindow::Negotiating); return; case FileTransfer::State::Transferring: chatWindow->setFileTransferStatus(uiID, ChatWindow::Transferring); return; case FileTransfer::State::Canceled: chatWindow->setFileTransferStatus(uiID, ChatWindow::Canceled); return; case FileTransfer::State::Finished: chatWindow->setFileTransferStatus(uiID, ChatWindow::Finished); if (fileWriteStream) { fileWriteStream->close(); } return; case FileTransfer::State::Failed: chatWindow->setFileTransferStatus(uiID, ChatWindow::FTFailed); return; case FileTransfer::State::WaitingForAccept: chatWindow->setFileTransferStatus(uiID, ChatWindow::WaitingForAccept); return; case FileTransfer::State::WaitingForStart: chatWindow->setFileTransferStatus(uiID, ChatWindow::Initialisation); return; } assert(false); }
void LoginDialog::readyRead() { qDebug()<<"readyRead"; // QDataStream in(socket); // if (socket->bytesAvailable()<(int)sizeof(quint16)){ // qDebug()<<"bytes available < quint16"; // return; // } // quint16 blockSize; // in>>blockSize; // qDebug()<<"Block size"<<blockSize; // quint8 command; // in>>command; // qDebug()<<"Command"<< command; QString result; switch(Connection::readMessage(socket, result)){ case Connection::AUTH_SECCESSFULL: UserWindow *userswindow = new UserWindow(socket); this->hide(); disconnect(socket, SIGNAL(readyRead()),this, SLOT(readyRead())); disconnect(socket, SIGNAL(connected()), this, SLOT(connected())); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onConnectionError(QAbstractSocket::SocketError))); disconnect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this , SLOT(onStateChanged(QAbstractSocket::SocketState))); userswindow->show(); break; } }
void ClientSocket::error(const QString &errorMessage) { log(errorMessage, LogError); if (m_socket) m_socket->abort(); onStateChanged(QLocalSocket::UnconnectedState); }
Player::Player(QObject *parent) : QObject(parent) { if(m_instance) qFatal("Only one instance of Player object is allowed"); m_instance = this; m_plistsgroup = PlistsGroup::instance(); m_VkActions = VkActions::instance(); m_Prev = 0; m_Current = 0; m_bArtRequested = false; m_bBroadcastStatus = Settings::instance()->getValue("player/status").toBool(); m_State = Stoped; // QGstreamer init m_GstPlayer = new GstPlayer(this); connect(m_GstPlayer, SIGNAL(positionChanged()), SLOT(positionChanged())); connect(m_GstPlayer, SIGNAL(linkExpired()), SLOT(onLinkExpired())); connect(m_GstPlayer, SIGNAL(stateChanged()), SLOT(onStateChanged())); connect(m_GstPlayer, SIGNAL(finished()), SIGNAL(needTrack())); connect(m_GstPlayer, SIGNAL(gotBitrate(quint32)), SLOT(setBitrate(quint32))); connect(m_GstPlayer, SIGNAL(metaChanged()), SLOT(onMetaChanged())); QTimer::singleShot(10, this, SLOT(setInitVolume())); m_GstPlayer->setVolume(Settings::instance()->getValue("player/volume").toDouble()); }
void TrackableDownloadItem::clearLastError() noexcept { if (lastError.empty()) { return; } lastError = Util::emptyString; onStateChanged(); }
ClientServerConnectionHandler::ClientServerConnectionHandler(Client *client, QObject *parent) : QObject(parent), _client(client), _socket(new QTcpSocket(this)), _keepAliveTimerId(-1) { connect(_socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onStateChanged(QAbstractSocket::SocketState))); connect(_socket, SIGNAL(readyRead()), SLOT(onReadyRead())); }
TcpClientIo::TcpClientIo(QSharedPointer<QTcpSocket> socket, QObject *parent) : ClientIoDevice(parent) { m_socket = socket; connect(m_socket.data(), &QTcpSocket::readyRead, this, &ClientIoDevice::readyRead); connect(m_socket.data(), static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error), this, &TcpClientIo::onError); connect(m_socket.data(), &QTcpSocket::stateChanged, this, &TcpClientIo::onStateChanged); onStateChanged(m_socket->state()); }
SlothCopier::SlothCopier(QObject *parent) : QObject(parent) { copier = new QFileCopier(this); connect(copier, SIGNAL(stateChanged(QFileCopier::State)), SLOT(onStateChanged(QFileCopier::State))); connect(copier, SIGNAL(started(int)), SLOT(onStarted(int))); connect(copier, SIGNAL(finished(int,bool)), SLOT(onFinished(int))); connect(copier, SIGNAL(progress(qint64,qint64)), SLOT(onProgress(qint64,qint64))); connect(copier, SIGNAL(error(int, QFileCopier::Error,bool)), SLOT(onError(int, QFileCopier::Error,bool))); }
MediaStreamingSocketHandler::Private::Private(MediaStreamingSocketHandler *owner) : QObject(owner), _owner(owner), _socket(new QUdpSocket(this)), _totalBytesRead(0), _totalBytesWritten(0) { connect(_socket, SIGNAL(readyRead()), SLOT(onReadyReadDatagrams())); connect(_socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onStateChanged(QAbstractSocket::SocketState))); }
void MissionControl::onStatusReceived(MafwPlaylist *, uint, MafwPlayState state, const char *, QString) { disconnect(mafwRenderer, SIGNAL(signalGetStatus(MafwPlaylist*,uint,MafwPlayState,const char*,QString)), this, SLOT(onStatusReceived(MafwPlaylist*,uint,MafwPlayState,const char*,QString))); connect(mafwRenderer, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); onStateChanged(state); }
void Track::setState(State state) { std::lock_guard<std::mutex> lk(_stateMutex); if (_state != state) { _prevState = _state; _state = state; onStateChanged(_state); } };
ScriptInfoRequest::ScriptInfoRequest(const QScriptValue &func, const QScriptValue &error, InfoRequest *parent) : QObject(parent), m_func(func), m_error(error) { if (!parent) { debug() << Q_FUNC_INFO; deleteLater(); return; } debug() << Q_FUNC_INFO; connect(parent, SIGNAL(stateChanged(qutim_sdk_0_3::InfoRequest::State)), SLOT(onStateChanged(qutim_sdk_0_3::InfoRequest::State))); connect(this, SIGNAL(destroyed()), parent, SLOT(deleteLater())); InfoRequest::State state = parent->state(); if (state == InfoRequest::Initialized) parent->requestData(); else if (state == InfoRequest::LoadedFromCache) onStateChanged(state); }
bool SwitchComponent::input(InputConfig* config, Input input) { if(config->isMappedTo("a", input) && input.value) { mState = !mState; onStateChanged(); return true; } return false; }
void CAudioOutputTest::start(const QString &filePath, const QAudioDeviceInfo &audioDeviceInfo) { stop(); if(m_PCMIODevice) { m_PCMIODevice->deleteLater(); m_PCMIODevice = NULL; } m_PCMIODevice = new CPCMIODevice(filePath,this); connect(m_PCMIODevice,SIGNAL(readChannelFinished()),this,SLOT(onStateChanged())); QAudioFormat format; format.setSampleRate(44100); format.setChannelCount(2); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::SignedInt); QAudioDeviceInfo info(audioDeviceInfo); if (!info.isFormatSupported(format)) { // qWarning() << "Default format not supported - trying to use nearest"; format = info.nearestFormat(format); } if(m_audioOutput) { delete m_audioOutput; m_audioOutput = 0; } m_audioOutput = new QAudioOutput(audioDeviceInfo, format, this); connect(m_audioOutput,SIGNAL(stateChanged(QAudio::State)),this,SLOT(onStateChanged())); if(m_PCMIODevice) { m_PCMIODevice->start(); } m_audioOutput->start(m_PCMIODevice); }
void TrackableDownloadItem::onProgress(const string& aDir, int64_t aDownloadedBytes) noexcept { { RLock l(cs); auto i = downloads.find(aDir); if (i == downloads.end()) { return; } i->second.downloaded = aDownloadedBytes; } onStateChanged(); }
AthanPlayer::AthanPlayer(QObject *parent): PlayerInterface(parent) { mPlayer = new MediaPlayer(this); for(int i = 0; i < PrayerTimes::TimesCount; i++) mFileList[i] = ""; updateAthanFiles(); connect(AthanSettings::instance(), SIGNAL(prayerFilesChanged()), this, SLOT(updateAthanFiles())); connect(mPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onError(QMediaPlayer::Error))); connect(AthanSettings::instance(), SIGNAL(silentModeChanged(bool)), this, SLOT(onSilenModeChanged(bool))); connect(mPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onStateChanged(QMediaPlayer::State))); }
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(); }
int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("SRFGames"); QCoreApplication::setOrganizationDomain("sol-online.org"), QCoreApplication::setApplicationName("ShareYourClipboard"); #ifdef Q_OS_MAC QDir dir(argv[0]); dir.cdUp(); QString currentDir = dir.absolutePath(); dir.cdUp(); dir.cd("PlugIns"); QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath())); #endif QApplication a(argc, argv); QApplication::setQuitOnLastWindowClosed(false); #ifdef Q_OS_MAC QDir::setCurrent(currentDir); #endif qDebug() << "init manager\n"; cClipboardManager manager(a.clipboard()); qDebug() << "init tray icon\n"; cTrayIcon trIcon(&manager); QObject::connect(&trIcon, SIGNAL(switchState()), &manager, SLOT(switchState())); QObject::connect(&trIcon, SIGNAL(pasteFiles()), &manager, SLOT(pasteFiles())); QObject::connect(&manager, SIGNAL(onStateChanged(cClipboardManager::eClipboardState)), &trIcon, SLOT(setState(cClipboardManager::eClipboardState))); qDebug() << "init settings window\n"; SettingsWindow settingsWindow(&manager); QObject::connect(&trIcon, SIGNAL(showSettings()), &settingsWindow, SLOT(showNormal())); QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &manager, SLOT(onPreferencesChanged())); qDebug() << "init copy dialog\n"; CopyProgressDialog copydialog; QObject::connect(&manager, SIGNAL(onStartCopyProcess(QString)), ©dialog, SLOT(start(QString))); QObject::connect(&manager, SIGNAL(onStopCopyProcess()), ©dialog, SLOT(stop())); QObject::connect(&manager, SIGNAL(showMessage(QString)), ©dialog, SLOT(showMessage(QString))); QObject::connect(&manager, SIGNAL(onSetProgressMain(QString,int,int)), ©dialog, SLOT(setProgressMain(QString,int,int))); QObject::connect(&manager, SIGNAL(onSetProgressSecond(QString,int,int)), ©dialog, SLOT(setProgressSecond(QString,int,int))); QObject::connect(©dialog, SIGNAL(cancel()), &manager, SLOT(cancelDownloading())); qDebug() << "start app loop\n"; int result = a.exec(); qDebug() << "application close\n"; return result; }
void Button::mouseReleaseEvent(QMouseEvent *e) { if (_state & StateDown) { int oldState = _state; _state &= ~StateDown; emit stateChanged(oldState, ButtonByPress); onStateChanged(oldState, ButtonByPress); if (oldState & StateOver) { _modifiers = e->modifiers(); emit clicked(); } else { leaveEvent(e); } } }
void TrackableDownloadItem::onRunningStateChanged(const Download* aDownload, bool aFailed) noexcept { { RLock l(cs); auto d = downloads.find(aDownload->getPath()); if (d == downloads.end()) { return; } auto& di = d->second; di.running = !aFailed; } onStateChanged(); }