Subversion Repositories tpanel

Rev

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

Rev 368 Rev 369
Line 900... Line 900...
900
 
900
 
901
void MainWindow::_activateSettings(const std::string& oldNetlinx, int oldPort, int oldChannelID, const std::string& oldSurface, bool oldToolbarSuppress, bool oldToolbarForce)
901
void MainWindow::_activateSettings(const std::string& oldNetlinx, int oldPort, int oldChannelID, const std::string& oldSurface, bool oldToolbarSuppress, bool oldToolbarForce)
902
{
902
{
903
    DECL_TRACER("MainWindow::_activateSettings(const std::string& oldNetlinx, int oldPort, int oldChannelID, const std::string& oldSurface, bool oldToolbarSuppress, bool oldToolbarForce)");
903
    DECL_TRACER("MainWindow::_activateSettings(const std::string& oldNetlinx, int oldPort, int oldChannelID, const std::string& oldSurface, bool oldToolbarSuppress, bool oldToolbarForce)");
904
 
904
 
-
 
905
    if (!mHasFocus)
-
 
906
        return;
-
 
907
 
905
    emit sigActivateSettings(oldNetlinx, oldPort, oldChannelID, oldSurface, oldToolbarSuppress, oldToolbarForce);
908
    emit sigActivateSettings(oldNetlinx, oldPort, oldChannelID, oldSurface, oldToolbarSuppress, oldToolbarForce);
906
}
909
}
907
 
910
 
908
/**
911
/**
909
 * @brief MainWindow::activateSettings
912
 * @brief MainWindow::activateSettings
Line 1077... Line 1080...
1077
 
1080
 
1078
void MainWindow::_repaintWindows()
1081
void MainWindow::_repaintWindows()
1079
{
1082
{
1080
    DECL_TRACER("MainWindow::_repaintWindows()");
1083
    DECL_TRACER("MainWindow::_repaintWindows()");
1081
 
1084
 
-
 
1085
    if (mHasFocus)
1082
    emit sigRepaintWindows();
1086
        emit sigRepaintWindows();
1083
}
1087
}
1084
 
1088
 
1085
void MainWindow::_toFront(ulong handle)
1089
void MainWindow::_toFront(ulong handle)
1086
{
1090
{
1087
    DECL_TRACER("MainWindow::_toFront(ulong handle)");
1091
    DECL_TRACER("MainWindow::_toFront(ulong handle)");
1088
 
1092
 
-
 
1093
    if (mHasFocus)
1089
    emit sigToFront(handle);
1094
        emit sigToFront(handle);
1090
}
1095
}
1091
 
1096
 
1092
void MainWindow::_downloadSurface(const string &file, size_t size)
1097
void MainWindow::_downloadSurface(const string &file, size_t size)
1093
{
1098
{
1094
    DECL_TRACER("MainWindow::_downloadSurface(const string &file, size_t size)");
1099
    DECL_TRACER("MainWindow::_downloadSurface(const string &file, size_t size)");
1095
 
1100
 
-
 
1101
    if (mHasFocus)
1096
    emit sigDownloadSurface(file, size);
1102
        emit sigDownloadSurface(file, size);
1097
}
1103
}
1098
 
1104
 
1099
void MainWindow::_startWait(const string& text)
1105
void MainWindow::_startWait(const string& text)
1100
{
1106
{
1101
    DECL_TRACER("MainWindow::_startWait(const string& text)");
1107
    DECL_TRACER("MainWindow::_startWait(const string& text)");
Line 2101... Line 2107...
2101
        setScreenDone();
2107
        setScreenDone();
2102
#endif
2108
#endif
2103
        return;
2109
        return;
2104
    }
2110
    }
2105
 
2111
 
2106
    TLOCKER(anim_mutex);
2112
//    TLOCKER(anim_mutex);
2107
    map<ulong, OBJECT_t *>::iterator iter;
2113
    map<ulong, OBJECT_t *>::iterator iter;
2108
 
2114
 
2109
    for (iter = mAnimObjects.begin(); iter != mAnimObjects.end(); ++iter)
2115
    for (iter = mAnimObjects.begin(); iter != mAnimObjects.end(); ++iter)
2110
    {
2116
    {
2111
        if (!iter->second->animation)
2117
        if (!iter->second->animation)
Line 2160... Line 2166...
2160
        setScreenDone();
2166
        setScreenDone();
2161
#endif
2167
#endif
2162
        return;
2168
        return;
2163
    }
2169
    }
2164
 
2170
 
2165
    TLOCKER(anim_mutex);
2171
//    TLOCKER(anim_mutex);
2166
    map<ulong, OBJECT_t *>::iterator iter;
2172
    map<ulong, OBJECT_t *>::iterator iter;
2167
 
2173
 
2168
    for (iter = mAnimObjects.begin(); iter != mAnimObjects.end(); ++iter)
2174
    for (iter = mAnimObjects.begin(); iter != mAnimObjects.end(); ++iter)
2169
    {
2175
    {
2170
        OBJECT_t *obj = findObject(iter->first);
2176
        OBJECT_t *obj = findObject(iter->first);
Line 2624... Line 2630...
2624
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
2630
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
2625
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
2631
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
2626
#else
2632
#else
2627
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
2633
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "pauseOrientationListener", "()V");
2628
#endif
2634
#endif
2629
//#elif defined(Q_OS_IOS)
-
 
2630
//            if (mIosRotate)
-
 
2631
//                mIosRotate->automaticRotation(false);
-
 
2632
#endif
2635
#endif
2633
        break;
2636
        break;
2634
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)      // On a normal desktop we can ignore this signals
2637
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)      // On a normal desktop we can ignore this signals
2635
        case Qt::ApplicationInactive:
2638
        case Qt::ApplicationInactive:
2636
            MSG_INFO("Switched to mode INACTIVE");
2639
            MSG_INFO("Switched to mode INACTIVE");
Line 2657... Line 2660...
2657
#endif
2660
#endif
2658
        break;
2661
        break;
2659
#endif
2662
#endif
2660
        case Qt::ApplicationActive:
2663
        case Qt::ApplicationActive:
2661
            MSG_INFO("Switched to mode ACTIVE");
2664
            MSG_INFO("Switched to mode ACTIVE");
-
 
2665
/*
-
 
2666
#ifdef Q_OS_ANDROID
-
 
2667
            // On Android we must give the surface some time to recover.
-
 
2668
            // Otherwise it may freeze or stay black and the app doesn't
-
 
2669
            // react any more.
-
 
2670
            std::this_thread::sleep_for(std::chrono::seconds(1));
-
 
2671
#endif
-
 
2672
*/
2662
            mHasFocus = true;
2673
            mHasFocus = true;
2663
 
2674
 
2664
            if (!isRunning && gPageManager)
2675
            if (!isRunning && gPageManager)
2665
            {
2676
            {
2666
                // Start the core application
2677
                // Start the core application
Line 2716... Line 2727...
2716
            else
2727
            else
2717
            {
2728
            {
2718
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_OS_ANDROID)
2729
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_OS_ANDROID)
2719
                _freezeWorkaround();
2730
                _freezeWorkaround();
2720
#endif
2731
#endif
2721
                playShowList();
2732
//                playShowList();
2722
 
2733
 
2723
                if (mDoRepaint && mWasInactive)
2734
//                if (mDoRepaint && mWasInactive)
2724
                    repaintObjects();
2735
//                    repaintObjects();
2725
 
2736
 
2726
                mDoRepaint = false;
2737
                mDoRepaint = false;
2727
                mWasInactive = false;
2738
                mWasInactive = false;
2728
            }
2739
            }
2729
#ifdef Q_OS_ANDROID
2740
#ifdef Q_OS_ANDROID
Line 2731... Line 2742...
2731
            QAndroidJniObject activity = QtAndroid::androidActivity();
2742
            QAndroidJniObject activity = QtAndroid::androidActivity();
2732
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/HideToolbar", "hide", "(Landroid/app/Activity;Z)V", activity.object(), true);
2743
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/HideToolbar", "hide", "(Landroid/app/Activity;Z)V", activity.object(), true);
2733
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
2744
            QAndroidJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
2734
#else
2745
#else
2735
            QJniObject activity = QNativeInterface::QAndroidApplication::context();
2746
            QJniObject activity = QNativeInterface::QAndroidApplication::context();
2736
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/HideToolbar", "hide", "(Landroid/app/Activity;Z)V", activity.object(), true);
2747
//            QJniObject::callStaticMethod<void>("org/qtproject/theosys/HideToolbar", "hide", "(Landroid/app/Activity;Z)V", activity.object(), true);
2737
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
2748
            QJniObject::callStaticMethod<void>("org/qtproject/theosys/Orientation", "resumeOrientationListener", "()V");
2738
#endif
2749
#endif
2739
#endif
2750
#endif
2740
#ifdef Q_OS_IOS
2751
#ifdef Q_OS_IOS
2741
            if (mIOSSettingsActive)
2752
            if (mIOSSettingsActive)
Line 2803... Line 2814...
2803
 
2814
 
2804
void MainWindow::_displayButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top, bool passthrough)
2815
void MainWindow::_displayButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top, bool passthrough)
2805
{
2816
{
2806
    DECL_TRACER("MainWindow::_displayButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top, bool passthrough)");
2817
    DECL_TRACER("MainWindow::_displayButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top, bool passthrough)");
2807
 
2818
 
2808
    if (prg_stopped)
2819
    if (prg_stopped || ! mHasFocus)
2809
        return;
2820
        return;
2810
 
2821
/*
2811
    if (!mHasFocus)     // Suspended?
2822
    if (!mHasFocus)     // Suspended?
2812
    {
2823
    {
2813
        addButton(handle, parent, buffer, left, top, width, height, passthrough);
2824
        addButton(handle, parent, buffer, left, top, width, height, passthrough);
2814
        return;
2825
        return;
2815
    }
2826
    }
2816
 
2827
*/
2817
    emit sigDisplayButton(handle, parent, buffer, width, height, left, top, passthrough);
2828
    emit sigDisplayButton(handle, parent, buffer, width, height, left, top, passthrough);
2818
}
2829
}
2819
 
2830
 
2820
void MainWindow::_displayViewButton(ulong handle, ulong parent, bool vertical, TBitmap buffer, int width, int height, int left, int top, int space, TColor::COLOR_T fillColor)
2831
void MainWindow::_displayViewButton(ulong handle, ulong parent, bool vertical, TBitmap buffer, int width, int height, int left, int top, int space, TColor::COLOR_T fillColor)
2821
{
2832
{
2822
    DECL_TRACER("MainWindow::_displayViewButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top)");
2833
    DECL_TRACER("MainWindow::_displayViewButton(ulong handle, ulong parent, TBitmap buffer, int width, int height, int left, int top)");
2823
 
2834
 
2824
    if (prg_stopped)
2835
    if (prg_stopped || !mHasFocus)
2825
        return;
2836
        return;
2826
 
2837
/*
2827
    if (!mHasFocus)     // Suspended?
2838
    if (!mHasFocus)     // Suspended?
2828
    {
2839
    {
2829
        addViewButton(handle, parent, vertical, buffer, left, top, width, height, space, fillColor);
2840
        addViewButton(handle, parent, vertical, buffer, left, top, width, height, space, fillColor);
2830
        return;
2841
        return;
2831
    }
2842
    }
2832
 
2843
*/
2833
    emit sigDisplayViewButton(handle, parent, vertical, buffer, width, height, left, top, space, fillColor);
2844
    emit sigDisplayViewButton(handle, parent, vertical, buffer, width, height, left, top, space, fillColor);
2834
}
2845
}
2835
 
2846
 
2836
void MainWindow::_addViewButtonItems(ulong parent, vector<PGSUBVIEWITEM_T> items)
2847
void MainWindow::_addViewButtonItems(ulong parent, vector<PGSUBVIEWITEM_T> items)
2837
{
2848
{
2838
    DECL_TRACER("MainWindow::_addViewButtonItems(ulong parent, vector<PGSUBVIEWITEM_T> items)");
2849
    DECL_TRACER("MainWindow::_addViewButtonItems(ulong parent, vector<PGSUBVIEWITEM_T> items)");
2839
 
2850
 
2840
    if (prg_stopped)
2851
    if (prg_stopped || !mHasFocus)
2841
        return;
2852
        return;
2842
 
2853
 
2843
    try
-
 
2844
    {
-
 
2845
        emit sigAddViewButtonItems(parent, items);
2854
    emit sigAddViewButtonItems(parent, items);
2846
    }
-
 
2847
    catch(std::exception& e)
-
 
2848
    {
-
 
2849
        MSG_ERROR("Error triggering function \"addViewButtonItems()\": " << e.what());
-
 
2850
    }
-
 
2851
}
2855
}
2852
 
2856
 
2853
void MainWindow::_updateViewButton(ulong handle, ulong parent, TBitmap buffer, TColor::COLOR_T fillColor)
2857
void MainWindow::_updateViewButton(ulong handle, ulong parent, TBitmap buffer, TColor::COLOR_T fillColor)
2854
{
2858
{
2855
    DECL_TRACER("MainWindow::_updateViewButton(ulong handle, ulong parent, TBitmap buffer, TColor::COLOR_T fillColor)");
2859
    DECL_TRACER("MainWindow::_updateViewButton(ulong handle, ulong parent, TBitmap buffer, TColor::COLOR_T fillColor)");
2856
 
2860
 
2857
    if (prg_stopped)
2861
    if (prg_stopped || !mHasFocus)
2858
        return;
2862
        return;
2859
 
2863
 
2860
    try
2864
//    try
2861
    {
2865
//    {
2862
        emit sigUpdateViewButton(handle, parent, buffer, fillColor);
2866
        emit sigUpdateViewButton(handle, parent, buffer, fillColor);
2863
    }
2867
//    }
2864
    catch (std::exception& e)
2868
//    catch (std::exception& e)
2865
    {
2869
//    {
2866
        MSG_ERROR("Error triggering function \"updateViewButton()\": " << e.what());
2870
//        MSG_ERROR("Error triggering function \"updateViewButton()\": " << e.what());
2867
    }
2871
//    }
2868
}
2872
}
2869
 
2873
 
2870
void MainWindow::_updateViewButtonItem(PGSUBVIEWITEM_T& item, ulong parent)
2874
void MainWindow::_updateViewButtonItem(PGSUBVIEWITEM_T& item, ulong parent)
2871
{
2875
{
2872
    DECL_TRACER("MainWindow::_updateViewButtonItem(PGSUBVIEWITEM_T& item, ulong parent)");
2876
    DECL_TRACER("MainWindow::_updateViewButtonItem(PGSUBVIEWITEM_T& item, ulong parent)");
2873
 
2877
 
2874
    if (prg_stopped)
2878
    if (prg_stopped || !mHasFocus)
2875
        return;
2879
        return;
2876
 
2880
 
2877
    try
2881
//    try
2878
    {
2882
//    {
2879
        emit sigUpdateViewButtonItem(item, parent);
2883
        emit sigUpdateViewButtonItem(item, parent);
2880
    }
2884
//    }
2881
    catch (std::exception& e)
2885
//    catch (std::exception& e)
2882
    {
2886
//    {
2883
        MSG_ERROR("Error triggering function \"updateViewButtonItem()\": " << e.what());
2887
//        MSG_ERROR("Error triggering function \"updateViewButtonItem()\": " << e.what());
2884
    }
2888
//    }
2885
}
2889
}
2886
 
2890
 
2887
void MainWindow::_showViewButtonItem(ulong handle, ulong parent, int position, int timer)
2891
void MainWindow::_showViewButtonItem(ulong handle, ulong parent, int position, int timer)
2888
{
2892
{
2889
    DECL_TRACER("MainWindow::_showViewButtonItem(ulong handle, ulong parent, int position, int timer)");
2893
    DECL_TRACER("MainWindow::_showViewButtonItem(ulong handle, ulong parent, int position, int timer)");
2890
 
2894
 
2891
    if (prg_stopped)
2895
    if (prg_stopped || !mHasFocus)
2892
        return;
2896
        return;
2893
 
2897
 
2894
    try
2898
//    try
2895
    {
2899
//    {
2896
        emit sigShowViewButtonItem(handle, parent, position, timer);
2900
        emit sigShowViewButtonItem(handle, parent, position, timer);
2897
    }
2901
//    }
2898
    catch (std::exception& e)
2902
//    catch (std::exception& e)
2899
    {
2903
//    {
2900
        MSG_ERROR("Error triggering function \"showViewButtonItem()\": " << e.what());
2904
//        MSG_ERROR("Error triggering function \"showViewButtonItem()\": " << e.what());
2901
    }
2905
//    }
2902
}
2906
}
2903
 
2907
 
2904
void MainWindow::_hideAllViewItems(ulong handle)
2908
void MainWindow::_hideAllViewItems(ulong handle)
2905
{
2909
{
2906
    DECL_TRACER("MainWindow::_hideAllViewItems(ulong handle)");
2910
    DECL_TRACER("MainWindow::_hideAllViewItems(ulong handle)");
2907
 
2911
 
2908
    if (prg_stopped)
2912
    if (prg_stopped || !mHasFocus)
2909
        return;
2913
        return;
2910
 
2914
 
2911
    emit sigHideAllViewItems(handle);
2915
    emit sigHideAllViewItems(handle);
2912
}
2916
}
2913
 
2917
 
2914
void MainWindow::_toggleViewButtonItem(ulong handle, ulong parent, int position, int timer)
2918
void MainWindow::_toggleViewButtonItem(ulong handle, ulong parent, int position, int timer)
2915
{
2919
{
2916
    DECL_TRACER("MainWindow::_toggleViewButtonItem(ulong handle, ulong parent, int position, int timer)");
2920
    DECL_TRACER("MainWindow::_toggleViewButtonItem(ulong handle, ulong parent, int position, int timer)");
2917
 
2921
 
2918
    if (prg_stopped)
2922
    if (prg_stopped || !mHasFocus)
2919
        return;
2923
        return;
2920
 
2924
 
2921
    emit sigToggleViewButtonItem(handle, parent, position, timer);
2925
    emit sigToggleViewButtonItem(handle, parent, position, timer);
2922
}
2926
}
2923
 
2927
 
2924
void MainWindow::_hideViewItem(ulong handle, ulong parent)
2928
void MainWindow::_hideViewItem(ulong handle, ulong parent)
2925
{
2929
{
2926
    DECL_TRACER("MainWindow::_hideViewItem(ulong handle, ulong parent)");
2930
    DECL_TRACER("MainWindow::_hideViewItem(ulong handle, ulong parent)");
2927
 
2931
 
2928
    if (prg_stopped)
2932
    if (prg_stopped || !mHasFocus)
2929
        return;
2933
        return;
2930
 
2934
 
2931
    emit sigHideViewItem(handle, parent);
2935
    emit sigHideViewItem(handle, parent);
2932
}
2936
}
2933
 
2937
 
2934
void MainWindow::_setVisible(ulong handle, bool state)
2938
void MainWindow::_setVisible(ulong handle, bool state)
2935
{
2939
{
2936
    DECL_TRACER("MainWindow::_setVisible(ulong handle, bool state)");
2940
    DECL_TRACER("MainWindow::_setVisible(ulong handle, bool state)");
2937
 
2941
 
2938
    if (prg_stopped)
2942
    if (prg_stopped || !mHasFocus)
2939
        return;
2943
        return;
2940
 
2944
 
2941
    emit sigSetVisible(handle, state);
2945
    emit sigSetVisible(handle, state);
2942
}
2946
}
2943
 
2947
 
2944
void MainWindow::_setSubViewPadding(ulong handle, int padding)
2948
void MainWindow::_setSubViewPadding(ulong handle, int padding)
2945
{
2949
{
2946
    DECL_TRACER("MainWindow::_setSubViewPadding(ulong handle, int padding)");
2950
    DECL_TRACER("MainWindow::_setSubViewPadding(ulong handle, int padding)");
2947
 
2951
 
2948
    if (prg_stopped)
2952
    if (prg_stopped || !mHasFocus)
2949
        return;
2953
        return;
2950
 
2954
 
2951
    emit sigSetSubViewPadding(handle, padding);
2955
    emit sigSetSubViewPadding(handle, padding);
2952
}
2956
}
2953
 
2957
 
2954
void MainWindow::_setPage(ulong handle, int width, int height)
2958
void MainWindow::_setPage(ulong handle, int width, int height)
2955
{
2959
{
2956
    DECL_TRACER("MainWindow::_setPage(ulong handle, int width, int height)");
2960
    DECL_TRACER("MainWindow::_setPage(ulong handle, int width, int height)");
2957
 
2961
 
2958
    if (prg_stopped)
2962
    if (prg_stopped || !mHasFocus)
2959
        return;
2963
        return;
2960
 
2964
/*
2961
    if (!mHasFocus)
2965
    if (!mHasFocus)
2962
    {
2966
    {
2963
        addPage(handle, width, height);
2967
        addPage(handle, width, height);
2964
        return;
2968
        return;
2965
    }
2969
    }
2966
 
2970
*/
2967
    emit sigSetPage(handle, width, height);
2971
    emit sigSetPage(handle, width, height);
2968
}
2972
}
2969
 
2973
 
2970
void MainWindow::_setSubPage(ulong handle, ulong parent, int left, int top, int width, int height, ANIMATION_t animate)
2974
void MainWindow::_setSubPage(ulong handle, ulong parent, int left, int top, int width, int height, ANIMATION_t animate)
2971
{
2975
{
2972
    DECL_TRACER("MainWindow::_setSubPage(ulong handle, ulong parent, int left, int top, int width, int height)");
2976
    DECL_TRACER("MainWindow::_setSubPage(ulong handle, ulong parent, int left, int top, int width, int height)");
2973
 
2977
 
2974
    if (prg_stopped)
2978
    if (prg_stopped || !mHasFocus)
2975
        return;
2979
        return;
2976
 
2980
/*
2977
    if (!mHasFocus)
2981
    if (!mHasFocus)
2978
    {
2982
    {
2979
        addSubPage(handle, parent, left, top, width, height, animate);
2983
        addSubPage(handle, parent, left, top, width, height, animate);
2980
        return;
2984
        return;
2981
    }
2985
    }
2982
 
2986
*/
2983
    emit sigSetSubPage(handle, parent, left, top, width, height, animate);
2987
    emit sigSetSubPage(handle, parent, left, top, width, height, animate);
2984
//#ifndef Q_OS_ANDROID
-
 
2985
//    std::this_thread::sleep_for(std::chrono::milliseconds(THREAD_WAIT));
-
 
2986
//#endif
-
 
2987
}
2988
}
2988
 
2989
 
2989
#ifdef _OPAQUE_SKIA_
2990
#ifdef _OPAQUE_SKIA_
2990
void MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color)
2991
void MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color)
2991
#else
2992
#else
2992
void MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color, int opacity)
2993
void MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color, int opacity)
2993
#endif
2994
#endif
2994
{
2995
{
2995
    DECL_TRACER("MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color [, int opacity])");
2996
    DECL_TRACER("MainWindow::_setBackground(ulong handle, TBitmap image, int width, int height, ulong color [, int opacity])");
2996
 
2997
 
2997
    if (prg_stopped)
2998
    if (prg_stopped || !mHasFocus)
2998
        return;
2999
        return;
2999
 
3000
/*
3000
    if (!mHasFocus)
3001
    if (!mHasFocus)
3001
    {
3002
    {
3002
#ifdef _OPAQUE_SKIA_
3003
#ifdef _OPAQUE_SKIA_
3003
        addBackground(handle, image, width, height, color);
3004
        addBackground(handle, image, width, height, color);
3004
#else
3005
#else
3005
        addBackground(handle, image, width, height, color, opacity);
3006
        addBackground(handle, image, width, height, color, opacity);
3006
#endif
3007
#endif
3007
        return;
3008
        return;
3008
    }
3009
    }
3009
 
3010
*/
3010
#ifdef _OPAQUE_SKIA_
3011
#ifdef _OPAQUE_SKIA_
3011
    emit sigSetBackground(handle, image, width, height, color);
3012
    emit sigSetBackground(handle, image, width, height, color);
3012
#else
3013
#else
3013
    emit sigSetBackground(handle, image, width, height, color, opacity);
3014
    emit sigSetBackground(handle, image, width, height, color, opacity);
3014
#endif
3015
#endif
Line 3016... Line 3017...
3016
 
3017
 
3017
void MainWindow::_dropPage(ulong handle)
3018
void MainWindow::_dropPage(ulong handle)
3018
{
3019
{
3019
    DECL_TRACER("MainWindow::_dropPage(ulong handle)");
3020
    DECL_TRACER("MainWindow::_dropPage(ulong handle)");
3020
 
3021
 
-
 
3022
    if (!mHasFocus)
3021
    doReleaseButton();
3023
        return;
3022
 
3024
 
-
 
3025
    doReleaseButton();
-
 
3026
/*
3023
    if (!mHasFocus)
3027
    if (!mHasFocus)
3024
    {
3028
    {
3025
        markDrop(handle);
3029
        markDrop(handle);
3026
        return;
3030
        return;
3027
    }
3031
    }
3028
 
3032
*/
3029
    emit sigDropPage(handle);
3033
    emit sigDropPage(handle);
3030
}
3034
}
3031
 
3035
 
3032
void MainWindow::_dropSubPage(ulong handle, ulong parent)
3036
void MainWindow::_dropSubPage(ulong handle, ulong parent)
3033
{
3037
{
3034
    DECL_TRACER("MainWindow::_dropSubPage(ulong handle, ulong parent)");
3038
    DECL_TRACER("MainWindow::_dropSubPage(ulong handle, ulong parent)");
3035
 
3039
 
-
 
3040
    if (!mHasFocus)
3036
    doReleaseButton();
3041
        return;
3037
 
3042
 
-
 
3043
    doReleaseButton();
-
 
3044
/*
3038
    if (!mHasFocus)
3045
    if (!mHasFocus)
3039
    {
3046
    {
3040
        markDrop(handle);
3047
        markDrop(handle);
3041
        return;
3048
        return;
3042
    }
3049
    }
3043
 
3050
*/
3044
    emit sigDropSubPage(handle, parent);
3051
    emit sigDropSubPage(handle, parent);
3045
}
3052
}
3046
 
3053
 
3047
void MainWindow::_dropButton(ulong handle)
3054
void MainWindow::_dropButton(ulong handle)
3048
{
3055
{
3049
    DECL_TRACER("MainWindow::_dropButton(ulong handle)");
3056
    DECL_TRACER("MainWindow::_dropButton(ulong handle)");
3050
 
3057
/*
3051
    if (!mHasFocus)
3058
    if (!mHasFocus)
3052
    {
3059
    {
3053
        markDrop(handle);
3060
        markDrop(handle);
3054
        return;
3061
        return;
3055
    }
3062
    }
3056
 
3063
*/
-
 
3064
    if (mHasFocus)
3057
    emit sigDropButton(handle);
3065
        emit sigDropButton(handle);
3058
}
3066
}
3059
 
3067
 
3060
void MainWindow::_playVideo(ulong handle, ulong parent, int left, int top, int width, int height, const string& url, const string& user, const string& pw)
3068
void MainWindow::_playVideo(ulong handle, ulong parent, int left, int top, int width, int height, const string& url, const string& user, const string& pw)
3061
{
3069
{
3062
    DECL_TRACER("MainWindow::_playVideo(ulong handle, const string& url)");
3070
    DECL_TRACER("MainWindow::_playVideo(ulong handle, const string& url)");
3063
 
3071
 
3064
    if (prg_stopped)
3072
    if (prg_stopped || !mHasFocus)
3065
        return;
3073
        return;
3066
 
3074
/*
3067
    if (!mHasFocus)
3075
    if (!mHasFocus)
3068
    {
3076
    {
3069
        addVideo(handle, parent, left, top, width, height, url, user, pw);
3077
        addVideo(handle, parent, left, top, width, height, url, user, pw);
3070
        return;
3078
        return;
3071
    }
3079
    }
3072
 
3080
*/
3073
    emit sigPlayVideo(handle, parent, left, top, width, height, url, user, pw);
3081
    emit sigPlayVideo(handle, parent, left, top, width, height, url, user, pw);
3074
//#ifndef Q_OS_ANDROID
-
 
3075
//    std::this_thread::sleep_for(std::chrono::milliseconds(THREAD_WAIT));
-
 
3076
//#endif
-
 
3077
}
3082
}
3078
 
3083
 
3079
void MainWindow::_inputText(Button::TButton *button, Button::BITMAP_t& bm, int frame)
3084
void MainWindow::_inputText(Button::TButton *button, Button::BITMAP_t& bm, int frame)
3080
{
3085
{
3081
    DECL_TRACER("MainWindow::_inputText(Button::TButton *button, Button::BITMAP_t& bm, int frame)");
3086
    DECL_TRACER("MainWindow::_inputText(Button::TButton *button, Button::BITMAP_t& bm, int frame)");
3082
 
3087
 
3083
    if (prg_stopped || !button)
3088
    if (prg_stopped || !button || !mHasFocus)
3084
        return;
3089
        return;
3085
 
3090
/*
3086
    if (!mHasFocus)
3091
    if (!mHasFocus)
3087
    {
3092
    {
3088
        addInText(button->getHandle(), button, bm, frame);
3093
        addInText(button->getHandle(), button, bm, frame);
3089
        return;
3094
        return;
3090
    }
3095
    }
3091
 
3096
*/
3092
    QByteArray buf;
3097
    QByteArray buf;
3093
 
3098
 
3094
    if (bm.buffer && bm.rowBytes > 0)
3099
    if (bm.buffer && bm.rowBytes > 0)
3095
    {
3100
    {
3096
        size_t size = (size_t)bm.width * (size_t)bm.height * (size_t)(bm.rowBytes / bm.width);
3101
        size_t size = (size_t)bm.width * (size_t)bm.height * (size_t)(bm.rowBytes / bm.width);
3097
        buf.insert(0, (const char *)bm.buffer, size);
3102
        buf.insert(0, (const char *)bm.buffer, size);
3098
    }
3103
    }
3099
 
3104
 
3100
    emit sigInputText(button, buf, bm.width, bm.height, frame, bm.rowBytes);
3105
    emit sigInputText(button, buf, bm.width, bm.height, frame, bm.rowBytes);
3101
//#ifndef Q_OS_ANDROID
-
 
3102
//    std::this_thread::sleep_for(std::chrono::milliseconds(THREAD_WAIT));
-
 
3103
//#endif
-
 
3104
}
3106
}
3105
 
3107
 
3106
void MainWindow::_listBox(Button::TButton *button, Button::BITMAP_t& bm, int frame)
3108
void MainWindow::_listBox(Button::TButton *button, Button::BITMAP_t& bm, int frame)
3107
{
3109
{
3108
    DECL_TRACER("MainWindow::_listBox(Button::TButton& button, Button::BITMAP_t& bm, int frame)");
3110
    DECL_TRACER("MainWindow::_listBox(Button::TButton& button, Button::BITMAP_t& bm, int frame)");
3109
 
3111
 
3110
    if (prg_stopped)
3112
    if (prg_stopped || !mHasFocus)
3111
        return;
3113
        return;
3112
 
3114
/*
3113
    if (!mHasFocus)
3115
    if (!mHasFocus)
3114
    {
3116
    {
3115
        addListBox(button, bm, frame);
3117
        addListBox(button, bm, frame);
3116
        return;
3118
        return;
3117
    }
3119
    }
3118
 
3120
*/
3119
    QByteArray buf;
3121
    QByteArray buf;
3120
 
3122
 
3121
    if (bm.buffer && bm.rowBytes > 0)
3123
    if (bm.buffer && bm.rowBytes > 0)
3122
    {
3124
    {
3123
        size_t size = (size_t)bm.width * (size_t)bm.height * (size_t)(bm.rowBytes / bm.width);
3125
        size_t size = (size_t)bm.width * (size_t)bm.height * (size_t)(bm.rowBytes / bm.width);
Line 3129... Line 3131...
3129
 
3131
 
3130
void MainWindow::_showKeyboard(const std::string& init, const std::string& prompt, bool priv)
3132
void MainWindow::_showKeyboard(const std::string& init, const std::string& prompt, bool priv)
3131
{
3133
{
3132
    DECL_TRACER("MainWindow::_showKeyboard(std::string &init, std::string &prompt, bool priv)");
3134
    DECL_TRACER("MainWindow::_showKeyboard(std::string &init, std::string &prompt, bool priv)");
3133
 
3135
 
3134
    if (prg_stopped)
3136
    if (prg_stopped || !mHasFocus)
3135
        return;
3137
        return;
3136
 
3138
 
3137
    doReleaseButton();
3139
    doReleaseButton();
3138
    emit sigKeyboard(init, prompt, priv);
3140
    emit sigKeyboard(init, prompt, priv);
3139
}
3141
}
3140
 
3142
 
3141
void MainWindow::_showKeypad(const std::string& init, const std::string& prompt, bool priv)
3143
void MainWindow::_showKeypad(const std::string& init, const std::string& prompt, bool priv)
3142
{
3144
{
3143
    DECL_TRACER("MainWindow::_showKeypad(std::string &init, std::string &prompt, bool priv)");
3145
    DECL_TRACER("MainWindow::_showKeypad(std::string &init, std::string &prompt, bool priv)");
3144
 
3146
 
3145
    if (prg_stopped)
3147
    if (prg_stopped || mHasFocus)
3146
        return;
3148
        return;
3147
 
3149
 
3148
    doReleaseButton();
3150
    doReleaseButton();
3149
    emit sigKeypad(init, prompt, priv);
3151
    emit sigKeypad(init, prompt, priv);
3150
}
3152
}
3151
 
3153
 
3152
void MainWindow::_resetKeyboard()
3154
void MainWindow::_resetKeyboard()
3153
{
3155
{
3154
    DECL_TRACER("MainWindow::_resetKeyboard()");
3156
    DECL_TRACER("MainWindow::_resetKeyboard()");
3155
 
3157
 
-
 
3158
    if (mHasFocus)
3156
    emit sigResetKeyboard();
3159
        emit sigResetKeyboard();
3157
}
3160
}
3158
 
3161
 
3159
void MainWindow::_showSetup()
3162
void MainWindow::_showSetup()
3160
{
3163
{
3161
    DECL_TRACER("MainWindow::_showSetup()");
3164
    DECL_TRACER("MainWindow::_showSetup()");
3162
 
3165
 
-
 
3166
    if (mHasFocus)
3163
    emit sigShowSetup();
3167
        emit sigShowSetup();
3164
}
3168
}
3165
 
3169
 
3166
void MainWindow::_playSound(const string& file)
3170
void MainWindow::_playSound(const string& file)
3167
{
3171
{
3168
    DECL_TRACER("MainWindow::_playSound(const string& file)");
3172
    DECL_TRACER("MainWindow::_playSound(const string& file)");
3169
 
3173
 
-
 
3174
    if (mHasFocus)
3170
    emit sigPlaySound(file);
3175
        emit sigPlaySound(file);
3171
}
3176
}
3172
 
3177
 
3173
void MainWindow::_stopSound()
3178
void MainWindow::_stopSound()
3174
{
3179
{
3175
    DECL_TRACER("MainWindow::_stopSound()");
3180
    DECL_TRACER("MainWindow::_stopSound()");
3176
 
3181
 
-
 
3182
    if (mHasFocus)
3177
    emit sigStopSound();
3183
        emit sigStopSound();
3178
}
3184
}
3179
 
3185
 
3180
void MainWindow::_muteSound(bool state)
3186
void MainWindow::_muteSound(bool state)
3181
{
3187
{
3182
    DECL_TRACER("MainWindow::_muteSound(bool state)");
3188
    DECL_TRACER("MainWindow::_muteSound(bool state)");
3183
 
3189
 
-
 
3190
    if (mHasFocus)
3184
    emit sigMuteSound(state);
3191
        emit sigMuteSound(state);
3185
}
3192
}
3186
 
3193
 
3187
void MainWindow::_setVolume(int volume)
3194
void MainWindow::_setVolume(int volume)
3188
{
3195
{
3189
    DECL_TRACER("MainWindow::_setVolume(int volume)");
3196
    DECL_TRACER("MainWindow::_setVolume(int volume)");
3190
 
3197
 
-
 
3198
    if (mHasFocus)
3191
    emit sigSetVolume(volume);
3199
        emit sigSetVolume(volume);
3192
}
3200
}
3193
 
3201
 
3194
void MainWindow::_setOrientation(J_ORIENTATION ori)
3202
void MainWindow::_setOrientation(J_ORIENTATION ori)
3195
{
3203
{
3196
#ifdef Q_OS_ANDROID
3204
#ifdef Q_OS_ANDROID
Line 3248... Line 3256...
3248
 
3256
 
3249
void MainWindow::_sendVirtualKeys(const string& str)
3257
void MainWindow::_sendVirtualKeys(const string& str)
3250
{
3258
{
3251
    DECL_TRACER("MainWindow::_sendVirtualKeys(const string& str)");
3259
    DECL_TRACER("MainWindow::_sendVirtualKeys(const string& str)");
3252
 
3260
 
-
 
3261
    if (mHasFocus)
3253
    emit sigSendVirtualKeys(str);
3262
        emit sigSendVirtualKeys(str);
3254
}
3263
}
3255
 
3264
 
3256
void MainWindow::_showPhoneDialog(bool state)
3265
void MainWindow::_showPhoneDialog(bool state)
3257
{
3266
{
3258
    DECL_TRACER("MainWindow::_showPhoneDialog(bool state)");
3267
    DECL_TRACER("MainWindow::_showPhoneDialog(bool state)");
3259
 
3268
 
-
 
3269
    if (mHasFocus)
3260
    emit sigShowPhoneDialog(state);
3270
        emit sigShowPhoneDialog(state);
3261
}
3271
}
3262
 
3272
 
3263
void MainWindow::_setPhoneNumber(const std::string& number)
3273
void MainWindow::_setPhoneNumber(const std::string& number)
3264
{
3274
{
3265
    DECL_TRACER("MainWindow::_setPhoneNumber(const std::string& number)");
3275
    DECL_TRACER("MainWindow::_setPhoneNumber(const std::string& number)");
3266
 
3276
 
-
 
3277
    if (mHasFocus)
3267
    emit sigSetPhoneNumber(number);
3278
        emit sigSetPhoneNumber(number);
3268
}
3279
}
3269
 
3280
 
3270
void MainWindow::_setPhoneStatus(const std::string& msg)
3281
void MainWindow::_setPhoneStatus(const std::string& msg)
3271
{
3282
{
3272
    DECL_TRACER("MainWindow::_setPhoneStatus(const std::string& msg)");
3283
    DECL_TRACER("MainWindow::_setPhoneStatus(const std::string& msg)");
3273
 
3284
 
-
 
3285
    if (mHasFocus)
3274
    emit sigSetPhoneStatus(msg);
3286
        emit sigSetPhoneStatus(msg);
3275
}
3287
}
3276
 
3288
 
3277
void MainWindow::_setPhoneState(int state, int id)
3289
void MainWindow::_setPhoneState(int state, int id)
3278
{
3290
{
3279
    DECL_TRACER("MainWindow::_setPhoneState(int state, int id)");
3291
    DECL_TRACER("MainWindow::_setPhoneState(int state, int id)");
3280
 
3292
 
-
 
3293
    if (mHasFocus)
3281
    emit sigSetPhoneState(state, id);
3294
        emit sigSetPhoneState(state, id);
3282
}
3295
}
3283
 
3296
 
3284
void MainWindow::_onProgressChanged(int percent)
3297
void MainWindow::_onProgressChanged(int percent)
3285
{
3298
{
3286
    DECL_TRACER("MainWindow::_onProgressChanged(int percent)");
3299
    DECL_TRACER("MainWindow::_onProgressChanged(int percent)");
3287
 
3300
 
-
 
3301
    if (mHasFocus)
3288
    emit sigOnProgressChanged(percent);
3302
        emit sigOnProgressChanged(percent);
3289
}
3303
}
3290
 
3304
 
3291
void MainWindow::_displayMessage(const string &msg, const string &title)
3305
void MainWindow::_displayMessage(const string &msg, const string &title)
3292
{
3306
{
3293
    DECL_TRACER("MainWindow::_displayMessage(const string &msg, const string &title)");
3307
    DECL_TRACER("MainWindow::_displayMessage(const string &msg, const string &title)");
3294
 
3308
 
-
 
3309
    if (mHasFocus)
3295
    emit sigDisplayMessage(msg, title);
3310
        emit sigDisplayMessage(msg, title);
3296
}
3311
}
3297
 
3312
 
3298
void MainWindow::_fileDialog(ulong handle, const string &path, const std::string& extension, const std::string& suffix)
3313
void MainWindow::_fileDialog(ulong handle, const string &path, const std::string& extension, const std::string& suffix)
3299
{
3314
{
3300
    DECL_TRACER("MainWindow::_fileDialog(ulong handle, const string &path, const std::string& extension, const std::string& suffix)");
3315
    DECL_TRACER("MainWindow::_fileDialog(ulong handle, const string &path, const std::string& extension, const std::string& suffix)");
Line 3328... Line 3343...
3328
    {
3343
    {
3329
        MSG_WARNING("Invalid parameters for scroll area!");
3344
        MSG_WARNING("Invalid parameters for scroll area!");
3330
        return;
3345
        return;
3331
    }
3346
    }
3332
 
3347
 
-
 
3348
    if (mHasFocus)
3333
    emit sigListViewArea(handle, parent, button, list);
3349
        emit sigListViewArea(handle, parent, button, list);
3334
}
3350
}
3335
 
3351
 
3336
void MainWindow::doReleaseButton()
3352
void MainWindow::doReleaseButton()
3337
{
3353
{
3338
    DECL_TRACER("MainWindow::doReleaseButton()");
3354
    DECL_TRACER("MainWindow::doReleaseButton()");
3339
 
3355
 
3340
    if (mLastPressX >= 0 && mLastPressX >= 0 && gPageManager)
3356
    if (mLastPressX >= 0 && mLastPressY >= 0 && gPageManager)
3341
    {
3357
    {
3342
        MSG_DEBUG("Sending outstanding mouse release event for coordinates x" << mLastPressX << ", y" << mLastPressY);
3358
        MSG_DEBUG("Sending outstanding mouse release event for coordinates x" << mLastPressX << ", y" << mLastPressY);
3343
        int x = mLastPressX;
3359
        int x = mLastPressX;
3344
        int y = mLastPressY;
3360
        int y = mLastPressY;
3345
 
3361
 
Line 3366... Line 3382...
3366
 */
3382
 */
3367
void MainWindow::repaintObjects()
3383
void MainWindow::repaintObjects()
3368
{
3384
{
3369
    DECL_TRACER("MainWindow::repaintObjects()");
3385
    DECL_TRACER("MainWindow::repaintObjects()");
3370
 
3386
 
3371
    TLOCKER(draw_mutex);
3387
//    TLOCKER(draw_mutex);
3372
#ifdef Q_OS_ANDROID
3388
#ifdef Q_OS_ANDROID
3373
    std::this_thread::sleep_for(std::chrono::milliseconds(200));    // Necessary for slow devices
3389
    std::this_thread::sleep_for(std::chrono::milliseconds(200));    // Necessary for slow devices
3374
#endif
3390
#endif
3375
    TObject::OBJECT_t *obj = findFirstWindow();
3391
    TObject::OBJECT_t *obj = findFirstWindow();
3376
 
3392
 
Line 4252... Line 4268...
4252
        setScreenDone();
4268
        setScreenDone();
4253
#endif
4269
#endif
4254
        return;
4270
        return;
4255
    }
4271
    }
4256
 
4272
 
4257
    TLOCKER(draw_mutex);
4273
//    TLOCKER(draw_mutex);
4258
    QWidget *wBackground = centralWidget();
4274
    QWidget *wBackground = centralWidget();
4259
 
4275
 
4260
    if (!wBackground)
4276
    if (!wBackground)
4261
    {
4277
    {
4262
        MSG_ERROR("No central widget!");
4278
        MSG_ERROR("No central widget!");
Line 4499... Line 4515...
4499
void MainWindow::setBackground(ulong handle, TBitmap image, int width, int height, ulong color)
4515
void MainWindow::setBackground(ulong handle, TBitmap image, int width, int height, ulong color)
4500
#else
4516
#else
4501
void MainWindow::setBackground(ulong handle, TBitmap image, int width, int height, ulong color, int opacity)
4517
void MainWindow::setBackground(ulong handle, TBitmap image, int width, int height, ulong color, int opacity)
4502
#endif
4518
#endif
4503
{
4519
{
4504
    TLOCKER(draw_mutex);
4520
//    TLOCKER(draw_mutex);
4505
    DECL_TRACER("MainWindow::setBackground(ulong handle, TBitmap image, ulong color [, int opacity])");
4521
    DECL_TRACER("MainWindow::setBackground(ulong handle, TBitmap image, ulong color [, int opacity])");
4506
 
4522
 
4507
    if (!mCentralWidget)
4523
    if (!mCentralWidget)
4508
    {
4524
    {
4509
        MSG_ERROR("The internal page stack is not initialized!");
4525
        MSG_ERROR("The internal page stack is not initialized!");
Line 5885... Line 5901...
5885
    {
5901
    {
5886
        MSG_ERROR("Got no object to start the animation!");
5902
        MSG_ERROR("Got no object to start the animation!");
5887
        return false;
5903
        return false;
5888
    }
5904
    }
5889
 
5905
 
5890
    TLOCKER(anim_mutex);
5906
//    TLOCKER(anim_mutex);
5891
    int scLeft = obj->left;
5907
    int scLeft = obj->left;
5892
    int scTop = obj->top;
5908
    int scTop = obj->top;
5893
    int scWidth = obj->width;
5909
    int scWidth = obj->width;
5894
    int scHeight = obj->height;
5910
    int scHeight = obj->height;
5895
    int duration = (in ? ani.showTime : ani.hideTime);
5911
    int duration = (in ? ani.showTime : ani.hideTime);