mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
fix(app): test another solution to show correctly windows...
This commit is contained in:
parent
33d648c88f
commit
368a4eb132
7 changed files with 24 additions and 25 deletions
|
|
@ -26,12 +26,6 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
void Utils::smartShowWindow (QQuickWindow *window) {
|
||||
window->show();
|
||||
window->raise();
|
||||
window->requestActivate();
|
||||
}
|
||||
|
||||
char *Utils::rstrstr (const char *a, const char *b) {
|
||||
size_t a_len = strlen(a);
|
||||
size_t b_len = strlen(b);
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void App::initContentApp () {
|
|||
QObject::connect(
|
||||
this, &App::receivedMessage, this, [this](int, QByteArray message) {
|
||||
if (message == "show")
|
||||
Utils::smartShowWindow(getMainWindow());
|
||||
App::smartShowWindow(getMainWindow());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -251,6 +251,18 @@ QQuickWindow *App::getSettingsWindow () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void App::smartShowWindow (QQuickWindow *window) {
|
||||
window->setVisible(true);
|
||||
|
||||
if (window->visibility() == QWindow::Minimized)
|
||||
window->show();
|
||||
|
||||
window->raise();
|
||||
window->requestActivate();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool App::hasFocus () const {
|
||||
return getMainWindow()->isActive() || (mCallsWindow && mCallsWindow->isActive());
|
||||
}
|
||||
|
|
@ -333,7 +345,7 @@ void App::setTrayIcon () {
|
|||
|
||||
QAction *restoreAction = new QAction("Restore", root);
|
||||
root->connect(restoreAction, &QAction::triggered, root, [root] {
|
||||
Utils::smartShowWindow(root);
|
||||
App::smartShowWindow(root);
|
||||
});
|
||||
|
||||
// trayIcon: Left click actions.
|
||||
|
|
@ -344,7 +356,7 @@ void App::setTrayIcon () {
|
|||
) {
|
||||
if (reason == QSystemTrayIcon::Trigger) {
|
||||
if (root->visibility() == QWindow::Hidden)
|
||||
Utils::smartShowWindow(root);
|
||||
App::smartShowWindow(root);
|
||||
else
|
||||
root->hide();
|
||||
}
|
||||
|
|
@ -400,9 +412,9 @@ void App::openAppAfterInit () {
|
|||
setTrayIcon();
|
||||
|
||||
if (!mParser.isSet("iconified"))
|
||||
Utils::smartShowWindow(getMainWindow());
|
||||
App::smartShowWindow(getMainWindow());
|
||||
#else
|
||||
Utils::smartShowWindow(getMainWindow());
|
||||
App::smartShowWindow(getMainWindow());
|
||||
#endif // ifndef __APPLE__
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ public:
|
|||
return static_cast<App *>(QApplication::instance());
|
||||
}
|
||||
|
||||
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
|
||||
|
||||
public slots:
|
||||
void quit ();
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void CallModel::accept () {
|
|||
params->enableVideo(false);
|
||||
setRecordFile(params);
|
||||
|
||||
Utils::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
App::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
mLinphoneCall->acceptWithParams(params);
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void CallModel::acceptWithVideo () {
|
|||
params->enableVideo(true);
|
||||
setRecordFile(params);
|
||||
|
||||
Utils::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
App::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
mLinphoneCall->acceptWithParams(params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ bool CallsListModel::removeRows (int row, int count, const QModelIndex &parent)
|
|||
|
||||
void CallsListModel::addCall (const shared_ptr<linphone::Call> &linphoneCall) {
|
||||
if (linphoneCall->getDir() == linphone::CallDirOutgoing)
|
||||
Utils::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
App::smartShowWindow(App::getInstance()->getCallsWindow());
|
||||
|
||||
CallModel *call = new CallModel(linphoneCall);
|
||||
|
||||
|
|
|
|||
|
|
@ -205,16 +205,6 @@ function setTimeout (parent, delay, cb) {
|
|||
return timer
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Bring a window to front.
|
||||
// See: http://stackoverflow.com/questions/6087887/bring-window-to-front-raise-show-activatewindow-don-t-work
|
||||
function smartShowWindow (window) {
|
||||
window.show()
|
||||
window.raise()
|
||||
window.requestActivate()
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// GENERIC.
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// `MainWindow.qml` Logic.
|
||||
// =============================================================================
|
||||
|
||||
.import Linphone 1.0 as Linphone
|
||||
.import QtQuick.Window 2.2 as Window
|
||||
|
||||
.import 'qrc:/ui/scripts/Utils/utils.js' as Utils
|
||||
|
|
@ -35,7 +36,7 @@ function unlockView () {
|
|||
|
||||
function setView (view, props) {
|
||||
function apply (view, props) {
|
||||
Utils.smartShowWindow(window)
|
||||
Linphone.App.smartShowWindow(window)
|
||||
|
||||
var item = mainLoader.item
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue