mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
voice message recording / sending done
This commit is contained in:
@@ -373,9 +373,9 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr
|
||||
connect(&history, SIGNAL(peerShown(PeerData*)), this, SLOT(onPeerShown(PeerData*)));
|
||||
connect(&updateNotifySettingTimer, SIGNAL(timeout()), this, SLOT(onUpdateNotifySettings()));
|
||||
connect(this, SIGNAL(showPeerAsync(quint64,qint32,bool,bool)), this, SLOT(showPeer(quint64,qint32,bool,bool)), Qt::QueuedConnection);
|
||||
if (audioVoice()) {
|
||||
connect(audioVoice(), SIGNAL(updated(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
connect(audioVoice(), SIGNAL(stopped(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
if (audioPlayer()) {
|
||||
connect(audioPlayer(), SIGNAL(updated(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
connect(audioPlayer(), SIGNAL(stopped(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
}
|
||||
connect(&_updateMutedTimer, SIGNAL(timeout()), this, SLOT(onUpdateMuted()));
|
||||
|
||||
@@ -1358,16 +1358,16 @@ void MainWidget::audioLoadProgress(mtpFileLoader *loader) {
|
||||
if (audio->loader->done()) {
|
||||
audio->finish();
|
||||
QString already = audio->already();
|
||||
bool play = audio->openOnSave > 0 && audioVoice();
|
||||
bool play = audio->openOnSave > 0 && audioPlayer();
|
||||
if ((!already.isEmpty() && audio->openOnSave) || (!audio->data.isEmpty() && play)) {
|
||||
if (play) {
|
||||
AudioData *playing = 0;
|
||||
VoiceMessageState state = VoiceMessageStopped;
|
||||
audioVoice()->currentState(&playing, &state);
|
||||
if (playing == audio && state != VoiceMessageStopped) {
|
||||
audioVoice()->pauseresume();
|
||||
AudioPlayerState state = AudioPlayerStopped;
|
||||
audioPlayer()->currentState(&playing, &state);
|
||||
if (playing == audio && state != AudioPlayerStopped) {
|
||||
audioPlayer()->pauseresume();
|
||||
} else {
|
||||
audioVoice()->play(audio);
|
||||
audioPlayer()->play(audio);
|
||||
if (App::main()) App::main()->audioMarkRead(audio);
|
||||
}
|
||||
} else {
|
||||
@@ -1393,10 +1393,10 @@ void MainWidget::audioLoadProgress(mtpFileLoader *loader) {
|
||||
|
||||
void MainWidget::audioPlayProgress(AudioData *audio) {
|
||||
AudioData *playing = 0;
|
||||
VoiceMessageState state = VoiceMessageStopped;
|
||||
audioVoice()->currentState(&playing, &state);
|
||||
if (playing == audio && state == VoiceMessageStoppedAtStart) {
|
||||
audioVoice()->clearStoppedAtStart(audio);
|
||||
AudioPlayerState state = AudioPlayerStopped;
|
||||
audioPlayer()->currentState(&playing, &state);
|
||||
if (playing == audio && state == AudioPlayerStoppedAtStart) {
|
||||
audioPlayer()->clearStoppedAtStart(audio);
|
||||
QString already = audio->already(true);
|
||||
if (already.isEmpty() && !audio->data.isEmpty()) {
|
||||
bool mp3 = (audio->mime == QLatin1String("audio/mp3"));
|
||||
@@ -1455,8 +1455,10 @@ void MainWidget::documentLoadProgress(mtpFileLoader *loader) {
|
||||
HistoryItem *item = App::histItemById(document->openOnSaveMsgId);
|
||||
if (reader.supportsAnimation() && reader.imageCount() > 1 && item) {
|
||||
startGif(item, already);
|
||||
} else {
|
||||
} else if (item) {
|
||||
App::wnd()->showDocument(document, item);
|
||||
} else {
|
||||
psOpenFile(already);
|
||||
}
|
||||
} else {
|
||||
psOpenFile(already);
|
||||
|
Reference in New Issue
Block a user