Subversion Repositories tpanel

Rev

Rev 249 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 249 Rev 250
Line 83... Line 83...
83
#include "tqdownload.h"
83
#include "tqdownload.h"
84
#include "tqtphone.h"
84
#include "tqtphone.h"
85
#include "tqeditline.h"
85
#include "tqeditline.h"
86
#include "terror.h"
86
#include "terror.h"
87
#ifdef Q_OS_IOS
87
#ifdef Q_OS_IOS
88
#include "QASettings.h"
88
#include "ios/QASettings.h"
89
#include "tiosrotate.h"
89
#include "ios/tiosrotate.h"
90
#include "tiosbattery.h"
90
#include "ios/tiosbattery.h"
91
#endif
91
#endif
92
 
92
 
93
#if __cplusplus < 201402L
93
#if __cplusplus < 201402L
94
#   error "This module requires at least C++14 standard!"
94
#   error "This module requires at least C++14 standard!"
95
#else
95
#else
Line 596... Line 596...
596
            MSG_ERROR("Unexpected exception occured [MainWindow::MainWindow()]");
596
            MSG_ERROR("Unexpected exception occured [MainWindow::MainWindow()]");
597
        }
597
        }
598
    }
598
    }
599
#endif
599
#endif
600
#ifdef Q_OS_IOS
600
#ifdef Q_OS_IOS
-
 
601
    START_TEMPORARY_TRACE();
601
    // To get the battery level periodicaly we setup a timer.
602
    // To get the battery level periodicaly we setup a timer.
602
    if (!mIosBattery)
603
    if (!mIosBattery)
603
        mIosBattery = new TIOSBattery;
604
        mIosBattery = new TIOSBattery;
604
 
605
 
605
    mIosBattery->update();
606
    mIosBattery->update();
Line 617... Line 618...
617
 
618
 
618
    if (!mBatTimer)
619
    if (!mBatTimer)
619
        mBatTimer = new QTimer(this);
620
        mBatTimer = new QTimer(this);
620
 
621
 
621
    connect(mBatTimer, &QTimer::timeout, this, &MainWindow::onBatteryTimeout);
622
    connect(mBatTimer, &QTimer::timeout, this, &MainWindow::onBatteryTimeout);
622
    mBatTimer->start(3000);    // Every 3 seconds
623
    mBatTimer->start(30000);    // Every 30 seconds
-
 
624
    END_TEMPORARY_LOG();
623
#endif  // Q_OS_IOS
625
#endif  // Q_OS_IOS
624
 
626
 
625
    _restart_ = false;
627
    _restart_ = false;
626
}
628
}
627
 
629
 
Line 1168... Line 1170...
1168
    QAction *volMute = new QAction(QIcon(":/images/vol_mute.png"), tr("X"), this);
1170
    QAction *volMute = new QAction(QIcon(":/images/vol_mute.png"), tr("X"), this);
1169
    connect(volMute, &QAction::triggered, this, &MainWindow::volumeMute);
1171
    connect(volMute, &QAction::triggered, this, &MainWindow::volumeMute);
1170
    mToolbar->addAction(volMute);
1172
    mToolbar->addAction(volMute);
1171
*/
1173
*/
1172
    mToolbar->addSeparator();
1174
    mToolbar->addSeparator();
1173
#ifndef Q_OS_IOS
-
 
1174
    const QIcon settingsIcon = QIcon::fromTheme("settings-configure", QIcon(":/images/settings.png"));
1175
    const QIcon settingsIcon = QIcon::fromTheme("settings-configure", QIcon(":/images/settings.png"));
1175
    QAction *settingsAct = new QAction(settingsIcon, tr("&Settings..."), this);
1176
    QAction *settingsAct = new QAction(settingsIcon, tr("&Settings..."), this);
1176
    settingsAct->setStatusTip(tr("Change the settings"));
1177
    settingsAct->setStatusTip(tr("Change the settings"));
1177
    connect(settingsAct, &QAction::triggered, this, &MainWindow::settings);
1178
    connect(settingsAct, &QAction::triggered, this, &MainWindow::settings);
1178
    mToolbar->addAction(settingsAct);
1179
    mToolbar->addAction(settingsAct);
1179
#endif
1180
 
1180
    const QIcon aboutIcon = QIcon::fromTheme("help-about", QIcon(":/images/info.png"));
1181
    const QIcon aboutIcon = QIcon::fromTheme("help-about", QIcon(":/images/info.png"));
1181
    QAction *aboutAct = new QAction(aboutIcon, tr("&About..."), this);
1182
    QAction *aboutAct = new QAction(aboutIcon, tr("&About..."), this);
1182
    aboutAct->setShortcuts(QKeySequence::Open);
1183
    aboutAct->setShortcuts(QKeySequence::Open);
1183
    aboutAct->setStatusTip(tr("About this program"));
1184
    aboutAct->setStatusTip(tr("About this program"));
1184
    connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
1185
    connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
Line 1313... Line 1314...
1313
        return;
1314
        return;
1314
    }
1315
    }
1315
    else    // This "else" should never be executed!
1316
    else    // This "else" should never be executed!
1316
        displayMessage("<b>Fatal error</b>: An internal mandatory class was not initialized!<br>Unable to show setup dialog!", "Fatal error");
1317
        displayMessage("<b>Fatal error</b>: An internal mandatory class was not initialized!<br>Unable to show setup dialog!", "Fatal error");
1317
#else
1318
#else
1318
    displayMessage("Please use the settings in the <i>System settings</i>. Search there for <b>tpanel</b>.", "Information");
1319
    QASettings::openSettings();
1319
#endif
1320
#endif
1320
#else
1321
#else
1321
    // Save some old values to decide whether to start over or not.
1322
    // Save some old values to decide whether to start over or not.
1322
    string oldHost = TConfig::getController();
1323
    string oldHost = TConfig::getController();
1323
    int oldPort = TConfig::getPort();
1324
    int oldPort = TConfig::getPort();
Line 1906... Line 1907...
1906
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1907
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1907
#else
1908
#else
1908
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1909
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1909
#endif
1910
#endif
1910
#endif
1911
#endif
-
 
1912
#ifdef Q_OS_IOS
-
 
1913
            if (mBatTimer)
-
 
1914
                mBatTimer->stop();
-
 
1915
#endif
1911
        break;
1916
        break;
1912
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)      // On a normal desktop we can ignore this signals
1917
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)      // On a normal desktop we can ignore this signals
1913
        case Qt::ApplicationInactive:
1918
        case Qt::ApplicationInactive:
1914
            MSG_INFO("Switched to mode INACTIVE");
1919
            MSG_INFO("Switched to mode INACTIVE");
1915
            mHasFocus = false;
1920
            mHasFocus = false;
Line 1919... Line 1924...
1919
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1924
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1920
#else
1925
#else
1921
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1926
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1922
#endif
1927
#endif
1923
#endif
1928
#endif
-
 
1929
#ifdef Q_OS_IOS
-
 
1930
            if (mBatTimer)
-
 
1931
                mBatTimer->stop();
-
 
1932
#endif
1924
        break;
1933
        break;
1925
 
1934
 
1926
        case Qt::ApplicationHidden:
1935
        case Qt::ApplicationHidden:
1927
            MSG_INFO("Switched to mode HIDDEN");
1936
            MSG_INFO("Switched to mode HIDDEN");
1928
            mHasFocus = false;
1937
            mHasFocus = false;
Line 1931... Line 1940...
1931
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1940
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1932
#else
1941
#else
1933
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1942
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
1934
#endif
1943
#endif
1935
#endif
1944
#endif
-
 
1945
#ifdef Q_OS_IOS
-
 
1946
            if (mBatTimer)
-
 
1947
                mBatTimer->stop();
-
 
1948
#endif
1936
        break;
1949
        break;
1937
#endif
1950
#endif
1938
        case Qt::ApplicationActive:
1951
        case Qt::ApplicationActive:
1939
            MSG_INFO("Switched to mode ACTIVE");
1952
            MSG_INFO("Switched to mode ACTIVE");
1940
            mHasFocus = true;
1953
            mHasFocus = true;
Line 1966... Line 1979...
1966
#else
1979
#else
1967
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
1980
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
1968
#endif
1981
#endif
1969
#endif
1982
#endif
1970
#ifdef Q_OS_IOS
1983
#ifdef Q_OS_IOS
-
 
1984
            if (mBatTimer)
-
 
1985
                mBatTimer->start();
-
 
1986
 
1971
            {
1987
            {
1972
                QMargins margins = QASettings::getNotchSize();
1988
                QMargins margins = QASettings::getNotchSize();
1973
                MSG_DEBUG("Notch top: " << margins.top() << ", bottom: " << margins.bottom() << ", left: " << margins.left() << ", right: " << margins.right());
1989
                MSG_DEBUG("Notch top: " << margins.top() << ", bottom: " << margins.bottom() << ", left: " << margins.left() << ", right: " << margins.right());
1974
 
1990
 
1975
                if (gPageManager->getSettings()->isPortrait())
1991
                if (gPageManager->getSettings()->isPortrait())
Line 3748... Line 3764...
3748
{
3764
{
3749
    DECL_TRACER("MainWindow::showSetup()");
3765
    DECL_TRACER("MainWindow::showSetup()");
3750
#ifdef QTSETTINGS
3766
#ifdef QTSETTINGS
3751
    settings();
3767
    settings();
3752
#else
3768
#else
-
 
3769
#ifndef Q_OS_IOS
3753
    if (gPageManager)
3770
    if (gPageManager)
3754
        gPageManager->showSetup();
3771
        gPageManager->showSetup();
3755
#endif
3772
#else
-
 
3773
    QASettings::openSettings();
-
 
3774
#endif  // Q_OS_IOS
-
 
3775
#endif  // QTSETTINGS
3756
}
3776
}
3757
 
3777
 
3758
void MainWindow::playSound(const string& file)
3778
void MainWindow::playSound(const string& file)
3759
{
3779
{
3760
    DECL_TRACER("MainWindow::playSound(const string& file)");
3780
    DECL_TRACER("MainWindow::playSound(const string& file)");