Import Upstream version 3.1.4+2022.0531
This commit is contained in:
commit
4150dafb7d
|
@ -0,0 +1,69 @@
|
|||
# UKUI-Bluetooth
|
||||
## Simple bluetooth tool for ukui desktop environment
|
||||
|
||||
### 依赖
|
||||
- KF5
|
||||
- libkf5bluezqt6
|
||||
- libkf5bluezqt-dev
|
||||
- libkf5windowsystem-dev
|
||||
- libqt5x11extras5-dev
|
||||
- libgsettings-qt-dev
|
||||
- libkf5bluezqt-data
|
||||
|
||||
- libglib2.0-dev,
|
||||
- libxrandr-dev,
|
||||
- libxinerama-dev,
|
||||
- libxi-dev,
|
||||
- libxcursor-dev,
|
||||
- libukui-log4qt-dev
|
||||
- bluez
|
||||
- bluez-obexd
|
||||
|
||||
### 编译
|
||||
|
||||
------
|
||||
|
||||
```shell
|
||||
$ cd ukui-bluetooth
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ qmake ..
|
||||
$ make
|
||||
```
|
||||
|
||||
### 安装
|
||||
|
||||
------
|
||||
|
||||
```shell
|
||||
$ sudo make install
|
||||
```
|
||||
### 主体框架
|
||||
- **InProgress**
|
||||
- [x] 界面绘制
|
||||
- [x] 功能实现
|
||||
- [x] 基础DBus接口提供
|
||||
- **TROUBLE**
|
||||
- 无
|
||||
- **TODO**
|
||||
- 无
|
||||
|
||||
### 功能插件
|
||||
##### 蓝牙服务bluetoothService
|
||||
- **InProgress**
|
||||
- [x] 功能实现
|
||||
- [x] 基础DBus接口提供
|
||||
- **TODO**
|
||||
- 无
|
||||
##### 任务栏蓝牙ukui-bluetooth
|
||||
- **InProgress**
|
||||
- [x] 界面绘制
|
||||
- [x] 功能实现
|
||||
- **TODO**
|
||||
- 无
|
||||
##### 控制面板蓝牙ukcc-bluetooth
|
||||
- **InProgress**
|
||||
- [x] 界面绘制
|
||||
- [x] 功能实现
|
||||
- **TODO**
|
||||
- 无
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
|
||||
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<!-- Only root can own the service -->
|
||||
<policy user="root">
|
||||
<allow own="com.bluetooth.systemdbus"/>
|
||||
<allow send_interface="com.bluetooth.interface"/>
|
||||
</policy>
|
||||
|
||||
<!-- Allow anyone to invoke methods on the interfaces -->
|
||||
<policy context="default">
|
||||
<allow send_destination="com.bluetooth.systemdbus"
|
||||
send_interface="com.bluetooth.interface"/>
|
||||
<allow send_destination="com.bluetooth.systemdbus"
|
||||
send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||
<allow send_destination="com.bluetooth.systemdbus"
|
||||
send_interface="org.freedesktop.DBus.Properties"/>
|
||||
</policy>
|
||||
</busconfig>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>kylin os</vendor>
|
||||
<vendor_url>http://github.com/ukui/</vendor_url>
|
||||
<action id="com.bluetooth.systemdbus.service">
|
||||
<description>ukui bluetooth</description>
|
||||
<message>system policy bluetooth</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
|
@ -0,0 +1,4 @@
|
|||
[D-BUS Service]
|
||||
Name=com.bluetooth.systemdbus
|
||||
Exec=/usr/bin/profileDaemon
|
||||
User=root
|
|
@ -0,0 +1,13 @@
|
|||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M31.2941 38.3589C31.2131 38.1383 31.115 37.9243 31.0008 37.7189C30.9158 37.4954 30.8086 37.281 30.6808 37.0789C30.2375 36.2975 29.6903 35.5799 29.0542 34.9455C28.4233 34.3054 27.7051 33.7578 26.9208 33.3189C26.7191 33.1947 26.5098 33.0834 26.2941 32.9855C26.0808 32.8788 25.8675 32.7855 25.6541 32.6922C23.7957 31.9441 21.7584 31.7589 19.7955 32.1595C17.8326 32.5602 16.0308 33.529 14.6141 34.9455L8.28082 41.2789C6.37531 43.1957 5.30753 45.7898 5.31153 48.4926C5.31554 51.1954 6.39099 53.7863 8.30216 55.6975C10.2133 57.6087 12.8043 58.6841 15.5071 58.6881C18.2099 58.6921 20.804 57.6244 22.7208 55.7189L29.0542 49.3855C30.4665 47.969 31.4317 46.1689 31.83 44.2086C32.2282 42.2483 32.0419 40.2142 31.2941 38.3589ZM25.2808 45.6122L18.9475 51.9455C18.0334 52.8596 16.7936 53.3732 15.5008 53.3732C14.2081 53.3732 12.9683 52.8596 12.0541 51.9455C11.14 51.0314 10.6265 49.7916 10.6265 48.4989C10.6265 47.2061 11.14 45.9663 12.0541 45.0522L18.3875 38.7189C19.0967 38.0082 20.0105 37.5373 21.0008 37.3722C21.2777 37.3191 21.5589 37.2923 21.8408 37.2921C21.8857 37.2899 21.9306 37.2944 21.9741 37.3055C22.2657 37.3035 22.5564 37.3349 22.8408 37.3989C23.7655 37.5915 24.6136 38.0503 25.2808 38.7189C25.9588 39.379 26.4193 40.2302 26.6008 41.1589C26.6648 41.4433 26.6961 41.734 26.6942 42.0255C26.719 42.3559 26.6965 42.6882 26.6275 43.0122C26.4678 44.0004 25.9958 44.9116 25.2808 45.6122ZM29.0542 34.9455C28.4233 34.3054 27.7051 33.7578 26.9208 33.3189L22.8408 37.3989C23.7655 37.5916 24.6136 38.0504 25.2808 38.7189C25.9588 39.379 26.4193 40.2303 26.6008 41.1589L30.6808 37.079C30.2375 36.2976 29.6903 35.5799 29.0542 34.9455V34.9455Z" fill="#F6F6F6"/>
|
||||
<path d="M55.7194 8.28299C53.8043 6.36848 51.2073 5.29297 48.4994 5.29297C45.7914 5.29297 43.1944 6.36848 41.2794 8.28299L34.946 14.6163C33.5336 16.0328 32.5684 17.833 32.1702 19.7933C31.772 21.7536 31.9583 23.7877 32.706 25.643C32.7871 25.8636 32.8851 26.0776 32.9994 26.283C33.0844 26.5065 33.1916 26.7209 33.3194 26.923C33.7627 27.7044 34.3099 28.422 34.946 29.0563C35.5769 29.6964 36.2951 30.2441 37.0794 30.683C37.2811 30.8071 37.4904 30.9184 37.706 31.0163C37.9194 31.123 38.1326 31.2162 38.346 31.3097C40.2052 32.0535 42.2414 32.2364 44.2034 31.836C46.1654 31.4355 47.9671 30.4692 49.386 29.0563L55.7194 22.723C57.6279 20.8048 58.6993 18.2089 58.6993 15.503C58.6993 12.797 57.6279 10.2012 55.7194 8.28299V8.28299ZM51.946 18.9497L45.6127 25.283C44.907 25.9985 43.9915 26.4702 42.9994 26.6297C42.6798 26.6987 42.352 26.7212 42.026 26.6963C41.7345 26.6983 41.4437 26.6669 41.1594 26.6029C40.235 26.4094 39.3871 25.9507 38.7193 25.2829C38.0516 24.6151 37.5929 23.7672 37.3994 22.8429C37.3354 22.5585 37.3041 22.2677 37.306 21.9762C37.2812 21.6458 37.3037 21.3136 37.3727 20.9896C37.5324 20.0013 38.0043 19.0902 38.7194 18.3897L45.0527 12.0563C45.9668 11.1422 47.2066 10.6287 48.4994 10.6287C49.1395 10.6287 49.7733 10.7547 50.3647 10.9997C50.9561 11.2447 51.4934 11.6037 51.946 12.0563C52.3986 12.5089 52.7577 13.0463 53.0026 13.6377C53.2476 14.229 53.3737 14.8629 53.3737 15.503C53.3737 16.1431 53.2476 16.7769 53.0026 17.3683C52.7577 17.9597 52.3986 18.497 51.946 18.9497Z" fill="#F6F6F6"/>
|
||||
<path d="M23.9993 42.6651C23.4719 42.665 22.9564 42.5086 22.518 42.2155C22.0795 41.9225 21.7378 41.5061 21.536 41.0188C21.3342 40.5316 21.2814 39.9955 21.3842 39.4783C21.4871 38.9611 21.741 38.4859 22.1139 38.113L27.1139 33.113C27.6139 32.613 28.2921 32.332 28.9993 32.332C29.7064 32.332 30.3846 32.613 30.8847 33.113C31.3847 33.613 31.6656 34.2912 31.6656 34.9984C31.6656 35.7056 31.3847 36.3838 30.8847 36.8838L25.8847 41.8838C25.6374 42.1318 25.3435 42.3285 25.0199 42.4626C24.6964 42.5967 24.3495 42.6655 23.9993 42.6651Z" fill="#ECECEC"/>
|
||||
<path d="M34.6663 32.333C34.1389 32.333 33.6234 32.1765 33.185 31.8835C32.7465 31.5905 32.4048 31.174 32.203 30.6868C32.0012 30.1996 31.9484 29.6635 32.0512 29.1462C32.1541 28.629 32.408 28.1539 32.7808 27.781L37.7808 22.781C38.2809 22.2809 38.9591 22 39.6663 22C40.3734 22 41.0516 22.2809 41.5517 22.781C42.0517 23.281 42.3326 23.9592 42.3326 24.6664C42.3326 25.3735 42.0517 26.0517 41.5517 26.5518L36.5517 31.5518C36.3044 31.7998 36.0105 31.9965 35.6869 32.1306C35.3634 32.2647 35.0165 32.3335 34.6663 32.333Z" fill="#ECECEC"/>
|
||||
<circle cx="50" cy="50" r="12" fill="#FB5050"/>
|
||||
<rect x="54.2422" y="42.9297" width="4" height="16" rx="2" transform="rotate(45 54.2422 42.9297)" fill="white"/>
|
||||
<rect width="4" height="16" rx="2" transform="matrix(-0.707107 0.707107 0.707107 0.707107 45.7578 42.9297)" fill="white"/>
|
||||
<line x1="27.1456" y1="24.9698" x2="25.9698" y2="20.8544" stroke="#ECECEC" stroke-width="3" stroke-linecap="round"/>
|
||||
<line x1="35.1456" y1="41.9698" x2="33.9698" y2="37.8544" stroke="#ECECEC" stroke-width="3" stroke-linecap="round"/>
|
||||
<line x1="24.1456" y1="28.0302" x2="20.0302" y2="26.8544" stroke="#ECECEC" stroke-width="3" stroke-linecap="round"/>
|
||||
<line x1="41.1456" y1="36.0302" x2="37.0302" y2="34.8544" stroke="#ECECEC" stroke-width="3" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 5.0 KiB |
|
@ -0,0 +1,8 @@
|
|||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect opacity="0.01" width="64" height="64" rx="2" fill="#737373"/>
|
||||
<path d="M30.6324 2.83675L6.16184 51.793C5.6521 52.8112 6.40842 54 7.56466 54H56.4353C57.5916 54 58.3479 52.8112 57.8382 51.793L33.3676 2.83675C32.8123 1.72108 31.1898 1.72108 30.6324 2.83675Z" fill="#F6F6F6"/>
|
||||
<path d="M32 10L24 53.976L31.0257 61.5643C31.5635 62.1452 32.4365 62.1452 32.9743 61.5643L40 53.976L32 10Z" fill="#ECECEC"/>
|
||||
<circle cx="50" cy="50" r="12" fill="#FB5050"/>
|
||||
<rect x="54.2422" y="42.9297" width="4" height="16" rx="2" transform="rotate(45 54.2422 42.9297)" fill="white"/>
|
||||
<rect width="4" height="16" rx="2" transform="matrix(-0.707107 0.707107 0.707107 0.707107 45.7578 42.9297)" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 791 B |
|
@ -0,0 +1,7 @@
|
|||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect opacity="0.01" width="64" height="64" rx="2" fill="#737373"/>
|
||||
<path d="M30.6324 2.83675L6.16184 51.793C5.6521 52.8112 6.40842 54 7.56466 54H56.4353C57.5916 54 58.3479 52.8112 57.8382 51.793L33.3676 2.83675C32.8123 1.72108 31.1898 1.72108 30.6324 2.83675Z" fill="#F6F6F6"/>
|
||||
<path d="M32 10L24 53.976L31.0257 61.5643C31.5635 62.1452 32.4365 62.1452 32.9743 61.5643L40 53.976L32 10Z" fill="#ECECEC"/>
|
||||
<circle cx="50" cy="50" r="12" fill="#0FCE75"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M57.4244 45.317C56.6434 44.536 55.3771 44.536 54.596 45.317L48.232 51.681L45.4036 48.8525C44.6226 48.0715 43.3562 48.0715 42.5752 48.8525C41.7941 49.6336 41.7941 50.8999 42.5752 51.681L46.8178 55.9236C47.5989 56.7047 48.8652 56.7047 49.6463 55.9236L57.4244 48.1454C58.2055 47.3644 58.2055 46.0981 57.4244 45.317Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 933 B |
|
@ -0,0 +1,3 @@
|
|||
<svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.75" fill-rule="evenodd" clip-rule="evenodd" d="M34.625 20.7539C34.625 18.9767 36.7697 18.0823 38.0324 19.333L38.1254 19.425C38.9154 20.2076 38.9154 21.4844 38.1254 22.267L35.36 25.006L39.0612 28.672L45.5528 22.2422C46.3434 21.4592 46.3429 20.1814 45.5516 19.399L32.5436 6.5375C32.1953 6.19314 31.7253 6 31.2355 6C30.208 6 29.375 6.83298 29.375 7.86051V19.078L34.625 24.278V20.7539ZM16.1087 12.594C15.3292 11.822 14.0733 11.822 13.2938 12.594L12.4346 13.445C11.6445 14.2276 11.6445 15.5044 12.4346 16.287L28.2987 32L15.0596 45.113C14.2695 45.8956 14.2695 47.1724 15.0596 47.955L15.9188 48.806C16.6983 49.578 17.9542 49.578 18.7337 48.806L29.375 38.266V56.1402C29.375 57.1673 30.2077 58 31.2348 58C31.725 58 32.1954 57.8065 32.5436 57.4615L41.8569 48.237C42.6351 47.4661 43.8887 47.4648 44.6686 48.2339L47.8913 51.4121C48.6713 52.1812 49.9248 52.1799 50.7031 51.409L51.5654 50.555C52.3554 49.7724 52.3554 48.4956 51.5654 47.713L16.1087 12.594ZM39.56 43.154L34.625 38.266V48.042L39.56 43.154Z" fill="#A8A8A8"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
|
||||
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<!-- Only root can own the service -->
|
||||
<policy user="root">
|
||||
<allow own="org.bluez.Agent1"/>
|
||||
<allow send_interface="org.bluez.Agent1"/>
|
||||
</policy>
|
||||
|
||||
<!-- Allow anyone to invoke methods on the interfaces -->
|
||||
<policy context="default">
|
||||
<allow own="org.bluez.Agent1"/>
|
||||
<allow send_destination="org.bluez.Agent1"/>
|
||||
<allow send_destination="org.bluez.Agent1"
|
||||
send_interface="org.bluez.Agent1"/>
|
||||
<allow send_destination="org.bluez.Agent1"
|
||||
send_interface="org.bluez.Agent1"/>
|
||||
<allow send_destination="org.bluez.Agent1"
|
||||
send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||
</policy>
|
||||
</busconfig>
|
|
@ -0,0 +1,54 @@
|
|||
<schemalist gettext-domain="ukui-bluetooth">
|
||||
<schema id="org.ukui.bluetooth" path="/org/ukui/bluetooth/">
|
||||
<key type="b" name="switch">
|
||||
<default>true</default>
|
||||
<summary>bluetooth power switch</summary>
|
||||
<description>bluetooth power switch</description>
|
||||
</key>
|
||||
<key type="b" name="bluetooth-discoverable-switch">
|
||||
<default>true</default>
|
||||
<summary>bluetooth discoverable switch</summary>
|
||||
<description>bluetooth discoverable switch</description>
|
||||
</key>
|
||||
<key type="s" name="file-save-path">
|
||||
<default>""</default>
|
||||
<summary>File save path</summary>
|
||||
<description>File save path</description>
|
||||
</key>
|
||||
<key type="s" name="finally-connect-the-device">
|
||||
<default>""</default>
|
||||
<summary>Finally connect the device</summary>
|
||||
<description>Last connected device saved</description>
|
||||
</key>
|
||||
<key type="as" name="paired-device">
|
||||
<default>[]</default>
|
||||
<summary>List of paired devices</summary>
|
||||
<description>Save a list of paired devices</description>
|
||||
</key>
|
||||
<key type="as" name="paired-device-address">
|
||||
<default>[]</default>
|
||||
<summary>List of paired device address</summary>
|
||||
<description>Save a list of paired device address</description>
|
||||
</key>
|
||||
<key type="as" name="adapter-address-list">
|
||||
<default>[]</default>
|
||||
<summary>List of adapter address</summary>
|
||||
<description>Save a list of adapter address</description>
|
||||
</key>
|
||||
<key type="s" name="adapter-address">
|
||||
<default>""</default>
|
||||
<summary>Save the Adapter used by default</summary>
|
||||
<description>Save the Adapter used by default</description>
|
||||
</key>
|
||||
<key type="b" name="tray-show">
|
||||
<default>true</default>
|
||||
<summary>Whether to display the icon in the tray</summary>
|
||||
<description>Whether to display the icon in the tray</description>
|
||||
</key>
|
||||
<key type="b" name="active-connection">
|
||||
<default>true</default>
|
||||
<summary>Whether to active connection</summary>
|
||||
<description>Whether to active connection</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
|
@ -0,0 +1,39 @@
|
|||
<schemalist gettext-domain="ukui-log4qt-bluetoothserver">
|
||||
<schema id="org.ukui.ukui-log4qt-bluetoothserver" path="/org/ukui/ukui-log4qt-bluetoothserver/">
|
||||
<key type="s" name="log4j-handleqtmessages">
|
||||
<default>"true"</default>
|
||||
<summary>hook qt messages</summary>
|
||||
<description>Control if hook qt messages</description>
|
||||
</key>
|
||||
<key type="s" name="log4j-rootlogger">
|
||||
<default>"DEBUG,console,daily"</default>
|
||||
<summary>config rootLogger's level and appenders</summary>
|
||||
<description>config rootLogger's level and appenders:"level,appender"</description>
|
||||
</key>
|
||||
<key type="s" name="log4j-appender-daily-datepattern">
|
||||
<default>".yyyy-MM-dd"</default>
|
||||
<summary>daily log file pattern</summary>
|
||||
<description>set daily log file pattern format:one day</description>
|
||||
</key>
|
||||
<key type="s" name="log4j-appender-daily-layout-conversionpattern">
|
||||
<default>"%d{yyyy-MM-dd HH:mm:ss,zzz}(%-4r)[%t]|%-5p| - %m%n"</default>
|
||||
<summary>set log message's format</summary>
|
||||
<description>set log message's format</description>
|
||||
</key>
|
||||
<key type="i" name="delaytime">
|
||||
<default>3600</default>
|
||||
<summary>set check log files delay time</summary>
|
||||
<description>set check log files delay time</description>
|
||||
</key>
|
||||
<key type="i" name="maxfilecount">
|
||||
<default>7</default>
|
||||
<summary>set log files count</summary>
|
||||
<description>set log files count,unit s</description>
|
||||
</key>
|
||||
<key type="i" name="maxfilesize">
|
||||
<default>512</default>
|
||||
<summary>set log files total size</summary>
|
||||
<description>set log files total size, unit M</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=ukui-bluetooth-daemon
|
||||
Name[zh_CN]=蓝牙服务
|
||||
Comment=Simple bluetooth server for ukui desktop environment
|
||||
Comment[zh_CN]=UKUI桌面环境蓝牙系统级配置文件修改进程
|
||||
Exec=/usr/bin/profileDaemon
|
||||
NoDisplay=true
|
|
@ -0,0 +1,14 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=ukui-bluetooth
|
||||
Name[zh_CN]=蓝牙
|
||||
Comment=Simple bluetooth tool for ukui desktop environment
|
||||
Comment[zh_CN]=UKUI桌面环境简单的蓝牙工具
|
||||
Exec=/usr/bin/bluetoothService -o
|
||||
Icon=bluetooth
|
||||
StartupNotify=false
|
||||
OnlyShowIn=UKUI;
|
||||
X-UKUI-AutoRestart=true
|
||||
NoDisplay=true
|
||||
Terminal=false
|
|
@ -0,0 +1,8 @@
|
|||
FILES_INSTALL_DIR = $$[QT_INSTALL_LIBS]/ukui-control-center
|
||||
SCHEMAS_INSTALL_DIR = /usr/share/glib-2.0/schemas/
|
||||
SHARE_INSTALL_DIR = /usr/share/ukui-bluetooth/
|
||||
BIN_INSTALL_DIR = /usr/bin/
|
||||
ACTIONS_INSTALL_DIR = /usr/share/polkit-1/actions/
|
||||
SERVICE_INSTALL_DIR = /usr/share/dbus-1/system-services/
|
||||
CONF_INSTALL_DIR = /etc/dbus-1/system.d/
|
||||
SHARE_TRANSLATIONS_INSTALL_DIR = /usr/share/ukui-bluetooth/translations
|
|
@ -0,0 +1,102 @@
|
|||
From ff10669daffb0b6f5e31f6f60e52ba583824ad8a Mon Sep 17 00:00:00 2001
|
||||
From: supreme886 <985636263@qq.com>
|
||||
Date: Wed, 15 Dec 2021 11:04:57 +0800
|
||||
Subject: [PATCH] fixed bug#97200/bug#97056/bug#91207
|
||||
|
||||
---
|
||||
ukcc-bluetooth/bluetoothmain.cpp | 7 ++++---
|
||||
ukcc-bluetooth/deviceinfoitem.cpp | 27 ++++++++++++++-------------
|
||||
2 files changed, 18 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index d46b0e2..581a261 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -2136,11 +2136,11 @@ void BlueToothMain::adapterComboxChanged(int i)
|
||||
|
||||
void BlueToothMain::mDevFrameAddLineFrame(QString str,QString addr)
|
||||
{
|
||||
- qDebug() << Q_FUNC_INFO << "#########################" << addr;
|
||||
+ qDebug() << Q_FUNC_INFO << "#########################" << str << addr;
|
||||
|
||||
if ("paired" == str) {
|
||||
|
||||
- if (!frame_middle->findChildren<DeviceInfoItem *>().size()) {
|
||||
+ if (frame_middle->findChildren<DeviceInfoItem *>().size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2153,7 +2153,7 @@ void BlueToothMain::mDevFrameAddLineFrame(QString str,QString addr)
|
||||
|
||||
} else if ("other" == str) {
|
||||
|
||||
- if (!frame_bottom->findChildren<DeviceInfoItem *>().size()) {
|
||||
+ if (frame_bottom->findChildren<DeviceInfoItem *>().size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2223,6 +2223,7 @@ void BlueToothMain::cleanPairDevices()
|
||||
delete child;
|
||||
child = nullptr;
|
||||
}
|
||||
+ device_list->setVisible(false);
|
||||
}
|
||||
|
||||
void BlueToothMain::gSettingsChanged(const QString &key)
|
||||
diff --git a/ukcc-bluetooth/deviceinfoitem.cpp b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
index 57d890b..0bb9431 100644
|
||||
--- a/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
+++ b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
@@ -478,9 +478,9 @@ QColor DeviceInfoItem::getPainterBrushColor()
|
||||
break;
|
||||
case Status::Hover:
|
||||
if(_themeIsBlack)
|
||||
- color = QColor("#37373B");
|
||||
+ color = _inBtn?QColor(Qt::black):QColor("#37373B");
|
||||
else
|
||||
- color = QColor("#D1D1D1");
|
||||
+ color = _inBtn?QColor(Qt::white):QColor("#D1D1D1");
|
||||
break;
|
||||
case Status::Check:
|
||||
if(_themeIsBlack)
|
||||
@@ -764,14 +764,9 @@ void DeviceInfoItem::DrawFuncBtn(QPainter &painter)
|
||||
{
|
||||
painter.save();
|
||||
|
||||
- QPixmap pixmap;
|
||||
-
|
||||
if (_inBtn) {
|
||||
- painter.setPen(QColor("#2FB3E8"));
|
||||
- pixmap = ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"blue");
|
||||
- } else {
|
||||
- painter.setBrush(getPainterBrushColor());
|
||||
- pixmap = ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"default");
|
||||
+ painter.setPen(QColor("#D1CFCF"));
|
||||
+ painter.setBrush(QColor("#D1CFCF"));
|
||||
}
|
||||
|
||||
painter.drawRoundRect(this->width()-55,10,36,36,30,30);
|
||||
@@ -779,10 +774,16 @@ void DeviceInfoItem::DrawFuncBtn(QPainter &painter)
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
|
||||
|
||||
- if (_themeIsBlack && (Status::Hover != _MStatus))
|
||||
- style()->drawItemPixmap(&painter, QRect(this->width()-48,19,20,20), Qt::AlignCenter, ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"blue"));
|
||||
- else
|
||||
- style()->drawItemPixmap(&painter, QRect(this->width()-48,19,20,20), Qt::AlignCenter, pixmap);
|
||||
+ if (_themeIsBlack) {
|
||||
+ if (_inBtn)
|
||||
+ style()->drawItemPixmap(&painter,QRect(this->width()-48,19,20,20), Qt::AlignCenter,
|
||||
+ ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"black"));
|
||||
+ else
|
||||
+ style()->drawItemPixmap(&painter, QRect(this->width()-48,19,20,20), Qt::AlignCenter,
|
||||
+ ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"white"));
|
||||
+ } else
|
||||
+ style()->drawItemPixmap(&painter, QRect(this->width()-48,19,20,20), Qt::AlignCenter,
|
||||
+ ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("image-loading-symbolic").pixmap(20),"black"));
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
From 52235f325aa20fd700144749c0d9b79700e32730 Mon Sep 17 00:00:00 2001
|
||||
From: supreme886 <985636263@qq.com>
|
||||
Date: Fri, 24 Dec 2021 10:38:53 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?fixed=20bug#97561;=E8=A7=A3=E5=86=B3=E5=9B=A0?=
|
||||
=?UTF-8?q?=E4=B8=BA=E5=85=BC=E5=AE=B9=E9=A3=9E=E8=A1=8C=E6=A8=A1=E5=BC=8F?=
|
||||
=?UTF-8?q?,=E5=BC=95=E5=85=A5=E7=9A=84=E5=BC=80=E5=85=B3=E8=93=9D?=
|
||||
=?UTF-8?q?=E7=89=99=E4=B8=8D=E5=9B=9E=E8=BF=9E=E9=97=AE=E9=A2=98?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
service/daemon.cpp | 13 ++-----------
|
||||
service/daemon.h | 3 ++-
|
||||
service/sessiondbusregister.cpp | 10 +++++++---
|
||||
3 files changed, 11 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 26d5ebf..3d39132 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -292,10 +292,6 @@ void Daemon::initBluezManager()
|
||||
connect(_BluezManager,&BluezQt::Manager::bluetoothOperationalChanged,this,[=](bool operational){
|
||||
qInfo() << Q_FUNC_INFO << "bluetoothOperationalChanged" << operational << resetFlag << QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
- ::powerChangeTime = QDateTime::currentMSecsSinceEpoch();
|
||||
-
|
||||
- if (operational)
|
||||
- reconnectFunc();
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::bluetoothBlockedChanged,this,[=](bool operational){
|
||||
@@ -633,7 +629,7 @@ void Daemon::launchDbusSignal()
|
||||
void Daemon::reconnectFunc()
|
||||
{
|
||||
qInfo() << Q_FUNC_INFO << "START";
|
||||
- QTimer::singleShot(1000,this,[=]{
|
||||
+ QTimer::singleShot(1000,[=]{
|
||||
|
||||
if (nullptr == _DefualtAdapter)
|
||||
{
|
||||
@@ -664,12 +660,7 @@ void Daemon::reconnectFunc()
|
||||
if (dev.data()->type() == BluezQt::Device::Headset ||
|
||||
dev.data()->type() == BluezQt::Device::AudioVideo) {
|
||||
|
||||
- BluezQt::PendingCall *pp = dev->connectToDevice();
|
||||
- connect(pp,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *call){
|
||||
- if(call->error() == 0){
|
||||
- return;
|
||||
- }
|
||||
- });
|
||||
+ dev->connectToDevice();
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/service/daemon.h b/service/daemon.h
|
||||
index 67d3012..8a34d31 100644
|
||||
--- a/service/daemon.h
|
||||
+++ b/service/daemon.h
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
// static void devOperateFunc(const QString,const DevOperate,const bool value = false);
|
||||
// static void sendDevSignal(DevOperate,QString);
|
||||
static QDBusMessage createCustomSignalMsg(QString);
|
||||
+ static void reconnectFunc();
|
||||
Q_SIGNALS:
|
||||
void startThread();
|
||||
|
||||
@@ -91,7 +92,7 @@ private:
|
||||
// void connectDefualtSignal();
|
||||
void monitorDbusSignal();
|
||||
void launchDbusSignal();
|
||||
- void reconnectFunc();
|
||||
+
|
||||
QString getFileName();
|
||||
|
||||
Rfkill *_rfkill = nullptr;
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 7f08669..b814928 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -176,10 +176,10 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
|
||||
if (!call->error()) {
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
- GlobalSize::refBlueDevActive(tmpdev->address());
|
||||
+ GlobalSize::refBlueDevActive(dev->address());
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
- GlobalSize::unrefBlueDevActive(tmpdev->address());
|
||||
+ GlobalSize::unrefBlueDevActive(dev->address());
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address(),
|
||||
callReturn->error(),
|
||||
@@ -358,6 +358,7 @@ void SessionDbusRegister::setDefaultAdapter(QString addr)
|
||||
BluezQt::AdapterPtr adapter = Daemon::_BluezManager->adapterForAddress(addr);
|
||||
if (!adapter.isNull()) {
|
||||
Daemon::_DefualtAdapter = adapter;
|
||||
+ emit this->defaultAdapterChanged(addr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,10 +741,13 @@ void SessionDbusRegister::connectSignal()
|
||||
});
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::poweredChanged,this,[=](bool powered){
|
||||
- qInfo() << Q_FUNC_INFO << "poweredChanged" << powered <<__LINE__;
|
||||
+ qDebug() << Q_FUNC_INFO << "poweredChanged" << powered <<__LINE__;
|
||||
|
||||
::powerChangeTime = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
+// if (powered)
|
||||
+ Daemon::reconnectFunc();
|
||||
+
|
||||
if (::resetFlag) {
|
||||
QTimer::singleShot(100,this,[=]{
|
||||
Daemon::_DefualtAdapter.data()->setPowered(false);
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
Index: ukui-bluetooth/ukui-bluetooth/component/qdevitem.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -241,11 +241,22 @@ void QDevItem::DrawBackground(QPainter &
|
||||
*************************************************/
|
||||
void QDevItem::DrawStatusIcon(QPainter &painter)
|
||||
{
|
||||
+ QPixmap batteryPixmap;
|
||||
+
|
||||
painter.save();
|
||||
painter.setBrush(getDevStatusColor());
|
||||
painter.drawEllipse(16,7,36,36);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
- style()->drawItemPixmap(&painter, QRect(25, 16, 18, 18), Qt::AlignCenter, getDevTypeIcon());
|
||||
+
|
||||
+ if(StyleSettings->get("style-name").toString() == "ukui-light") {
|
||||
+ painter.setPen(QColor(Qt::black));
|
||||
+ batteryPixmap = getDevTypeIcon();
|
||||
+ } else {
|
||||
+ painter.setPen(QColor(Qt::white));
|
||||
+ batteryPixmap = loadSvg(getDevTypeIcon(), PixmapColor::WHITE);
|
||||
+ }
|
||||
+
|
||||
+ style()->drawItemPixmap(&painter, QRect(25, 16, 18, 18), Qt::AlignCenter, batteryPixmap);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
@@ -281,14 +292,18 @@ void QDevItem::DrawBattery(QPainter &pai
|
||||
|
||||
QString batteryIcon = QString("battery-level-") + QString::number(battery / 10 * 10) + QString("-symbolic");
|
||||
QString batteryString = _Battery + QString("%");
|
||||
+ QPixmap batteryPixmap;
|
||||
|
||||
- if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
+ if(StyleSettings->get("style-name").toString() == "ukui-light") {
|
||||
painter.setPen(QColor(Qt::black));
|
||||
- else
|
||||
+ batteryPixmap = QIcon::fromTheme(batteryIcon).pixmap(20,20);
|
||||
+ } else {
|
||||
painter.setPen(QColor(Qt::white));
|
||||
+ batteryPixmap = loadSvg(QIcon::fromTheme(batteryIcon).pixmap(20,20), PixmapColor::WHITE);
|
||||
+ }
|
||||
|
||||
- painter.drawText(358,12,24,20,Qt::AlignLeft, batteryString);
|
||||
- style()->drawItemPixmap(&painter, QRect(334, 14, 20, 20), Qt::AlignCenter, QIcon::fromTheme(batteryIcon).pixmap(20,20));
|
||||
+ painter.drawText(348,12,38,20,Qt::AlignLeft, batteryString);
|
||||
+ style()->drawItemPixmap(&painter, QRect(324, 14, 20, 20), Qt::AlignCenter, batteryPixmap);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
@@ -316,3 +331,47 @@ void QDevItem::MouseClickedFunc()
|
||||
});
|
||||
}
|
||||
}
|
||||
+
|
||||
+
|
||||
+
|
||||
+const QPixmap QDevItem::loadSvg(const QPixmap &source, const PixmapColor &cgColor)
|
||||
+{
|
||||
+ QImage img = source.toImage();
|
||||
+ for (int x = 0; x < img.width(); x++) {
|
||||
+ for (int y = 0; y < img.height(); y++) {
|
||||
+ auto color = img.pixelColor(x, y);
|
||||
+ if (color.alpha() > 0) {
|
||||
+ switch (cgColor) {
|
||||
+ case PixmapColor::WHITE:
|
||||
+ color.setRed(255);
|
||||
+ color.setGreen(255);
|
||||
+ color.setBlue(255);
|
||||
+ img.setPixelColor(x, y, color);
|
||||
+ break;
|
||||
+ case PixmapColor::BLACK:
|
||||
+ color.setRed(0);
|
||||
+ color.setGreen(0);
|
||||
+ color.setBlue(0);
|
||||
+ img.setPixelColor(x, y, color);
|
||||
+ break;
|
||||
+ case PixmapColor::GRAY:
|
||||
+ color.setRed(152);
|
||||
+ color.setGreen(163);
|
||||
+ color.setBlue(164);
|
||||
+ img.setPixelColor(x, y, color);
|
||||
+ break;
|
||||
+ case PixmapColor::BLUE:
|
||||
+ color.setRed(61);
|
||||
+ color.setGreen(107);
|
||||
+ color.setBlue(229);
|
||||
+ img.setPixelColor(x, y, color);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return source;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return QPixmap::fromImage(img);
|
||||
+}
|
||||
Index: ukui-bluetooth/ukui-bluetooth/component/qdevitem.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/component/qdevitem.h
|
||||
+++ ukui-bluetooth/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -19,10 +19,7 @@
|
||||
class QDevItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
-public:
|
||||
- QDevItem(QString address, QStringList deviceinfo, bool connected, QWidget *parent = nullptr);
|
||||
- QDevItem(QWidget *parent);
|
||||
- ~QDevItem();
|
||||
+public:
|
||||
enum Status{
|
||||
Hover = 0,
|
||||
Nomal,
|
||||
@@ -30,6 +27,19 @@ public:
|
||||
};
|
||||
Q_ENUM(Status)
|
||||
|
||||
+ enum PixmapColor {
|
||||
+ WHITE = 0,
|
||||
+ BLACK,
|
||||
+ GRAY,
|
||||
+ BLUE,
|
||||
+ };
|
||||
+ Q_ENUM(PixmapColor)
|
||||
+
|
||||
+ QDevItem(QString address, QStringList deviceinfo, bool connected, QWidget *parent = nullptr);
|
||||
+ QDevItem(QWidget *parent);
|
||||
+ ~QDevItem();
|
||||
+ const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color);
|
||||
+
|
||||
void InitMemberVariables();
|
||||
|
||||
signals:
|
|
@ -0,0 +1,149 @@
|
|||
diff --git a/service/config.cpp b/service/config.cpp
|
||||
index d96ac66..2e817b2 100644
|
||||
--- a/service/config.cpp
|
||||
+++ b/service/config.cpp
|
||||
@@ -6,6 +6,8 @@ extern "C" {
|
||||
#include <glib/gprintf.h>
|
||||
}
|
||||
|
||||
+Environment envPC = Environment::NOMAL;
|
||||
+
|
||||
const QString UIExe = "/usr/bin/ukui-bluetooth";
|
||||
|
||||
QGSettings* Config::gsetting = new QGSettings("org.ukui.bluetooth");
|
||||
@@ -48,9 +50,14 @@ void Config::OpenBluetoothSettings()
|
||||
QProcess *process = new QProcess();
|
||||
QString cmd = "ukui-control-center";
|
||||
QStringList arg;
|
||||
- qDebug() << Q_FUNC_INFO;
|
||||
- arg << "-m";
|
||||
- arg << "Bluetooth";
|
||||
+ arg.clear();
|
||||
+ if (Environment::INTER == envPC) {
|
||||
+ arg << "--bluetooth";
|
||||
+ } else {
|
||||
+ arg << "-m";
|
||||
+ arg << "Bluetooth";
|
||||
+ }
|
||||
+ qDebug() << Q_FUNC_INFO << arg;
|
||||
process->startDetached(cmd,arg);
|
||||
}
|
||||
|
||||
@@ -122,5 +129,3 @@ void Config::removeKey(QString addr)
|
||||
qDebug() << Q_FUNC_INFO << addr << response.errorMessage();
|
||||
|
||||
}
|
||||
-
|
||||
-bool global_ishuawei = false;
|
||||
diff --git a/service/config.h b/service/config.h
|
||||
index 195e486..1bdcdb6 100644
|
||||
--- a/service/config.h
|
||||
+++ b/service/config.h
|
||||
@@ -13,7 +13,14 @@
|
||||
#include <QTimer>
|
||||
|
||||
//全局变量,是否是华为机器, 默认false, 在config.cpp文件定义
|
||||
-extern bool global_ishuawei;
|
||||
+enum Environment
|
||||
+{
|
||||
+ NOMAL = 0,
|
||||
+ HUAWEI,
|
||||
+ INTER,
|
||||
+};
|
||||
+
|
||||
+extern Environment envPC;
|
||||
|
||||
class Config : public QObject
|
||||
{
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 34a3a54..d02f9e2 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -194,7 +194,7 @@ void Daemon::rfkillStatusChange(int status)
|
||||
if (findStartupOptions("-o") || findStartupOptions("--obex"))
|
||||
{
|
||||
//非华为机器才存在文件传输功能
|
||||
- if(!global_ishuawei)
|
||||
+ if(Environment::HUAWEI == envPC)
|
||||
{
|
||||
initObexManager();
|
||||
}
|
||||
@@ -664,6 +664,7 @@ void Daemon::reconnectFunc()
|
||||
break;
|
||||
|
||||
if (dev.data()->type() == BluezQt::Device::Headset ||
|
||||
+ dev.data()->type() == BluezQt::Device::Headphones ||
|
||||
dev.data()->type() == BluezQt::Device::AudioVideo) {
|
||||
|
||||
dev->connectToDevice();
|
||||
diff --git a/service/main.cpp b/service/main.cpp
|
||||
index 0903a3f..4808e0b 100644
|
||||
--- a/service/main.cpp
|
||||
+++ b/service/main.cpp
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDebug>
|
||||
+#include <QFile>
|
||||
|
||||
#include <ukui-log4qt.h>
|
||||
|
||||
@@ -29,24 +30,26 @@ static QString executeLinuxCmd(QString strCmd)
|
||||
return strResult.toLower();
|
||||
}
|
||||
|
||||
-static bool IsHuawei()
|
||||
+static void setEnvPCValue()
|
||||
{
|
||||
+ envPC = Environment::NOMAL;
|
||||
+
|
||||
QString str = executeLinuxCmd("cat /proc/cpuinfo | grep Hardware");
|
||||
if(str.length() == 0)
|
||||
{
|
||||
- return false;
|
||||
+ goto FuncEnd;
|
||||
}
|
||||
|
||||
if(str.indexOf("huawei") != -1 || str.indexOf("pangu") != -1 ||
|
||||
str.indexOf("kirin") != -1)
|
||||
{
|
||||
- return true;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- return false;
|
||||
+ envPC = Environment::HUAWEI;
|
||||
}
|
||||
- return false;
|
||||
+
|
||||
+FuncEnd:
|
||||
+ if (QFile::exists("/etc/apt/ota_version"))
|
||||
+ envPC = Environment::INTER;
|
||||
+
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -54,8 +57,8 @@ int main(int argc, char *argv[])
|
||||
fprintf(stdout,"Program running.....\n");
|
||||
initUkuiLog4qt(QString("bluetoothserver"));
|
||||
|
||||
- global_ishuawei = IsHuawei();
|
||||
- qDebug() << "Ishuawei: "<< global_ishuawei;
|
||||
+ setEnvPCValue();
|
||||
+ qDebug() << "envPC: "<< envPC;
|
||||
|
||||
QtSingleCoreApplication a(argc, argv);
|
||||
a.setOrganizationName("Kylin Team");
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index fa7422c..d85d5ec 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -1736,7 +1736,7 @@ void BlueToothMain::refreshUIWhenAdapterChanged()
|
||||
m_open_bluetooth_btn->setChecked(true);
|
||||
// bluetooth_name->setVisible(true);
|
||||
frame_middle->setVisible(m_myDev_show_flag);
|
||||
- if (!frame_bottom->isVisible())
|
||||
+ if (!frame_bottom->isVisible() && frame_bottom->children().size())
|
||||
frame_bottom->setVisible(true);
|
||||
}
|
||||
else
|
|
@ -0,0 +1,101 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 8e7f13d..1d8fb26 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -162,48 +162,6 @@ void Daemon::setBluetoothBlock(bool)
|
||||
|
||||
}
|
||||
|
||||
-/*void Daemon::devOperateFunc(const QString addr, const DevOperate operate, const bool value)
|
||||
-{
|
||||
- qDebug() << Q_FUNC_INFO << addr << operate;
|
||||
- if (addr.isEmpty() || addr.isNull())
|
||||
- return;
|
||||
-
|
||||
- BluezQt::DevicePtr targetDev = _DefualtAdapter.data()->deviceForAddress(addr);
|
||||
- if(nullptr == targetDev)
|
||||
- {
|
||||
- qDebug() << Q_FUNC_INFO << "null targetDev: "<< addr;
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- BluezQt::PendingCall *targetCall;
|
||||
-
|
||||
- switch (operate) {
|
||||
- case DevOperate::CONNECT:
|
||||
- devConnectFunc(targetDev);
|
||||
- break;
|
||||
- case DevOperate::DISCONNECT:
|
||||
- qDebug() << Q_FUNC_INFO << "DISCONNECT";
|
||||
- targetCall = targetDev.data()->disconnectFromDevice();
|
||||
- break;
|
||||
- case DevOperate::REMOVE:
|
||||
- qDebug() << Q_FUNC_INFO << "REMOVE";
|
||||
- targetCall = targetDev.data()->disconnectFromDevice();
|
||||
- break;
|
||||
- case DevOperate::TRUST:
|
||||
- qDebug() << Q_FUNC_INFO << "TRUST";
|
||||
- targetCall = targetDev.data()->setTrusted(value);
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- connect(targetCall,&BluezQt::PendingCall::finished,[=](BluezQt::PendingCall *newCall){
|
||||
- qDebug() << Q_FUNC_INFO << newCall->error() <<__LINE__;
|
||||
- if (newCall->error() == 0)
|
||||
- sendDevSignal(operate,addr);
|
||||
- else
|
||||
- sendDevSignal(DevOperate::ERROR,addr);
|
||||
- });
|
||||
-}*/
|
||||
-
|
||||
/************************************************
|
||||
* @brief 监听gsetting key的改变,并同步更新对应的value
|
||||
* @param key value改变的键名
|
||||
@@ -306,20 +264,29 @@ void Daemon::initBluezManager()
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::adapterAdded,this,[=](BluezQt::AdapterPtr ptr){
|
||||
+ Q_UNUSED(ptr)
|
||||
qInfo() << Q_FUNC_INFO << "adapterAdded";
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::usableAdapterChanged,this,[=](BluezQt::AdapterPtr ptr){
|
||||
+ Q_UNUSED(ptr)
|
||||
qInfo() << Q_FUNC_INFO << "usableAdapterChanged" ;
|
||||
+ _DefualtAdapter = getDefualtAdapter();
|
||||
+ qDebug() << Q_FUNC_INFO << _DefualtAdapter.data()->name();
|
||||
+ launchDbusSignal();
|
||||
+
|
||||
+ connect(_DefualtAdapter.data(),&BluezQt::Adapter::poweredChanged,this,[=](bool v){
|
||||
+
|
||||
+ _mConfig->gsetting->set("switch",QVariant(v));
|
||||
+
|
||||
+ if (v)
|
||||
+ reconnectFunc();
|
||||
+ });
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::adapterChanged,this,[=](BluezQt::AdapterPtr ptr){
|
||||
-
|
||||
+ Q_UNUSED(ptr)
|
||||
qInfo() << Q_FUNC_INFO << "adapterChanged";
|
||||
-
|
||||
- _DefualtAdapter = getDefualtAdapter();
|
||||
- qDebug() << Q_FUNC_INFO << _DefualtAdapter.data()->name();
|
||||
- launchDbusSignal();
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::bluetoothOperationalChanged,this,[=](bool operational){
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index e026131..046c3e5 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -1342,7 +1342,7 @@ void BlueToothMain::showBluetoothNormalMainWindow()
|
||||
|
||||
main_layout = new QVBoxLayout(m_normal_main_widget);
|
||||
main_layout->setSpacing(40);
|
||||
- main_layout->setContentsMargins(0,0,30,10);
|
||||
+ main_layout->setContentsMargins(0,0,0,10);
|
||||
frame_top = new QWidget(m_normal_main_widget);
|
||||
frame_top->setObjectName("frame_top");
|
||||
if ((m_adapter_address_list.size() > 1) &&
|
|
@ -0,0 +1,78 @@
|
|||
Index: ukui-bluetooth/service/daemon.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/service/daemon.cpp
|
||||
+++ ukui-bluetooth/service/daemon.cpp
|
||||
@@ -478,7 +478,6 @@ BluezQt::AdapterPtr Daemon::getDefualtAd
|
||||
return nullptr;
|
||||
|
||||
}else if(_BluezManager->adapters().size() == 1){
|
||||
-
|
||||
return _BluezManager->adapters().at(0);
|
||||
_mConfig->gsetting->set("adapter-address",QVariant::fromValue(_DefualtAdapter->address()));
|
||||
|
||||
@@ -487,10 +486,18 @@ BluezQt::AdapterPtr Daemon::getDefualtAd
|
||||
if(_mGsetting["adapter-address-list"].toStringList().indexOf(_mGsetting["adapter-address"].toString()) != -1){
|
||||
return _BluezManager->adapterForAddress(_mGsetting["adapter-address"].toString());
|
||||
}else{
|
||||
- return _BluezManager->adapterForAddress(_mGsetting["adapter-address-list"].toStringList().at(0));
|
||||
+ //这里adapter-address-list的数据不一定存在
|
||||
+ if (_mGsetting["adapter-address-list"].toStringList().size() > 0)
|
||||
+ {
|
||||
+ return _BluezManager->adapterForAddress(_mGsetting["adapter-address-list"].toStringList().at(0));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return _BluezManager->adapterForAddress(_mGsetting["adapter-address"].toString());
|
||||
+ }
|
||||
}
|
||||
}
|
||||
- qWarning("No bluetooth adapter end!!!");
|
||||
+ qWarning("get bluetooth adapter end!!!");
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -496,6 +496,11 @@ void BlueToothMain::removeAdapterDataLis
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << adapterAddress << __LINE__;
|
||||
int i = m_adapter_address_list.indexOf(adapterAddress);
|
||||
+ if (-1 == i)
|
||||
+ {
|
||||
+ qDebug () << Q_FUNC_INFO << "Not device :" << adapterAddress << __LINE__;
|
||||
+ return;
|
||||
+ }
|
||||
qDebug() << Q_FUNC_INFO << __LINE__ << m_adapter_address_list << m_adapter_name_list << i;
|
||||
m_adapter_name_list.removeAt(i);
|
||||
m_adapter_address_list.removeAll(adapterAddress);
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/ukcc-bluetooth.pro
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/ukcc-bluetooth.pro
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/ukcc-bluetooth.pro
|
||||
@@ -49,7 +49,8 @@ HEADERS += \
|
||||
loadinglabel.h
|
||||
|
||||
TRANSLATIONS += \
|
||||
- ukcc-bluetooth_zh_CN.ts
|
||||
+ ukcc-bluetooth_zh_CN.ts \
|
||||
+ ukcc-bluetooth_bo_CN.ts
|
||||
|
||||
DISTFILES += ukcc-bluetooth.json
|
||||
|
||||
Index: ukui-bluetooth/ukui-bluetooth/ukui-bluetooth.pro
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/ukui-bluetooth.pro
|
||||
+++ ukui-bluetooth/ukui-bluetooth/ukui-bluetooth.pro
|
||||
@@ -96,8 +96,8 @@ HEADERS += \
|
||||
|
||||
|
||||
TRANSLATIONS += \
|
||||
- translations/ukui-bluetooth_zh_CN.ts
|
||||
-
|
||||
+ translations/ukui-bluetooth_zh_CN.ts \
|
||||
+ translations/ukui-bluetooth_bo_CN.ts
|
||||
# Default rules for deployment.
|
||||
#qnx: target.path = /tmp/$${TARGET}/bin
|
||||
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|
@ -0,0 +1,82 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index b89cd61..f0c69a0 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -977,3 +977,8 @@ void SessionDbusRegister::cancelFileReceiving() {
|
||||
qDebug() << "SessionDbusRegister::cancelFileReceiving";
|
||||
emit cancelFileReceivingSignal();
|
||||
}
|
||||
+
|
||||
+void SessionDbusRegister::showTrayWidgetUI() {
|
||||
+ qDebug() << "SessionDbusRegister::showTrayWidgetUI";
|
||||
+ emit showTrayWidgetUISignal();
|
||||
+}
|
||||
diff --git a/service/sessiondbusregister.h b/service/sessiondbusregister.h
|
||||
index 3ac2518..a5225ef 100644
|
||||
--- a/service/sessiondbusregister.h
|
||||
+++ b/service/sessiondbusregister.h
|
||||
@@ -137,6 +137,8 @@ public slots:
|
||||
|
||||
void connectSignal();
|
||||
|
||||
+ void showTrayWidgetUI();
|
||||
+
|
||||
//test
|
||||
void sendReplyRequestConfirmation(bool);
|
||||
void sendReplyFileReceivingSignal(bool v);
|
||||
@@ -211,6 +213,8 @@ signals:
|
||||
void clearOldSession();
|
||||
|
||||
void cancelFileReceivingSignal();
|
||||
+
|
||||
+ void showTrayWidgetUISignal();
|
||||
};
|
||||
|
||||
#endif // SESSIONDBUSREGISTER_H
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 1bda657..149ea45 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -17,6 +17,8 @@ BluetoothDbus::~BluetoothDbus()
|
||||
|
||||
void BluetoothDbus::connectDBusSignals() {
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ TRANSFER_DBUS_SIGNAL("showTrayWidgetUISignal", showTrayWidgetUISignal());
|
||||
+
|
||||
//适配器相关dbus
|
||||
CONNECT_DBUS_SIGNAL("defaultAdapterPowerChanged", defaultAdapterPowerChangedSLot(bool));
|
||||
CONNECT_DBUS_SIGNAL("defaultAdapterChanged", defaultAdapterChangedSLot(QString));
|
||||
@@ -34,7 +36,6 @@ void BluetoothDbus::connectDBusSignals() {
|
||||
TRANSFER_DBUS_SIGNAL("requestConfirmation", requestConfirmationSignal(QString,QString));
|
||||
TRANSFER_DBUS_SIGNAL("pairAgentCanceled", pairAgentCanceledSignal());
|
||||
|
||||
-
|
||||
//文件传输相关dbus
|
||||
CONNECT_DBUS_SIGNAL("fileReceivingSignal", receiveFilesSlot(QString,QString,QString,QString,quint64));
|
||||
TRANSFER_DBUS_SIGNAL("obexAgentCanceled", obexAgentCanceledSignal());
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.h b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
index 556b62a..3cb9422 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -92,6 +92,7 @@ signals:
|
||||
void AdapterChangedSignal(QString);
|
||||
void devConnectStatusSignal(QString, bool);
|
||||
void fileReceiveMore(QString, quint64, QString);
|
||||
+ void showTrayWidgetUISignal();
|
||||
|
||||
private:
|
||||
void connectDBusSignals();
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index 82b8340..352b199 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -19,6 +19,9 @@ MainProgram::MainProgram(bool intel, QObject *parent) :
|
||||
connect(_sessionDbus, &BluetoothDbus::sendTransferFilesMesgSignal, this, &MainProgram::sendTransferFilesMesgSlot);
|
||||
}
|
||||
|
||||
+ connect(_sessionDbus, &BluetoothDbus::showTrayWidgetUISignal, this, [=]() {
|
||||
+ UI->showUI();
|
||||
+ });
|
||||
connect(_sessionDbus, &BluetoothDbus::displayPasskeySignal, this, &MainProgram::displayPasskeySlot);
|
||||
connect(_sessionDbus, &BluetoothDbus::requestConfirmationSignal, this, &MainProgram::requestConfirmationSlot);
|
||||
connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired) {
|
|
@ -0,0 +1,124 @@
|
|||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index cf56849..1c23ae2 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -10,10 +10,14 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
// 窗管适配
|
||||
-// MotifWmHints hints;
|
||||
-// hints.flags = MWM_HINTS_DECORATIONS;
|
||||
-// hints.decorations = MWM_DECOR_ALL;
|
||||
-// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
+ if (_Intel) {
|
||||
+ MotifWmHints hints;
|
||||
+ hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
+ hints.functions = MWM_FUNC_ALL;
|
||||
+ hints.decorations = MWM_DECOR_BORDER;
|
||||
+ XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
+ installEventFilter(this);
|
||||
+ }
|
||||
if (!_Intel) {
|
||||
trayicon = new TrayIcon();
|
||||
connect(this, &TrayWidget::trayIconStatusChanged, trayicon, &TrayIcon::SetTrayIcon);
|
||||
@@ -24,6 +28,9 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
connect(_SessionDBus, &BluetoothDbus::showTrayIcon, this, [=](bool show) {
|
||||
trayicon->SetAdapterFlag(show);
|
||||
});
|
||||
+ setProperty("useSystemStyleBlur", true);
|
||||
+ this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
+ this->setWindowFlags(Qt::Popup | Qt::FramelessWindowHint);
|
||||
}
|
||||
connect(QApplication::desktop(), &QDesktopWidget::resized, this, [=] {
|
||||
setWidgetPosition();
|
||||
@@ -39,9 +46,6 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
}
|
||||
});
|
||||
|
||||
- setProperty("useSystemStyleBlur", true);
|
||||
- this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
- this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
@@ -76,7 +80,6 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
this->setAutoFillBackground(true);
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("bluetooth"));
|
||||
-
|
||||
pairedDevices = _SessionDBus->getPairedDevices();
|
||||
|
||||
InitMemberVariables();
|
||||
@@ -387,6 +390,16 @@ void TrayWidget::layoutAddPairedDev()
|
||||
int count = 0;
|
||||
qDebug() << Q_FUNC_INFO << pairedDevices.size() << __LINE__;
|
||||
if (!_PairedWidget->findChildren<QDevItem *>().size()) {
|
||||
+ for (int i = 0; i < 5; i++) {
|
||||
+ QStringList list;
|
||||
+ list.append(QString("name"));
|
||||
+ list.append(QString("phone"));
|
||||
+ list.append(QString("-1"));
|
||||
+ QDevItem *dev = new QDevItem(QString("ppp"), list, false, _PairedWidget);
|
||||
+ _PairedLayout->addWidget(dev);
|
||||
+ isNull = false;
|
||||
+ count++;
|
||||
+ }
|
||||
for (auto item : pairedDevices.keys()) {
|
||||
QString name = pairedDevices.value(item).at(0);
|
||||
_SessionDBus->getDevConnectStatus(item);
|
||||
@@ -492,6 +505,18 @@ void TrayWidget::showUI()
|
||||
showNormal();
|
||||
}
|
||||
|
||||
+bool TrayWidget::eventFilter(QObject *o, QEvent *e)
|
||||
+{
|
||||
+ if (e->type() == QEvent::ActivationChange)
|
||||
+ {
|
||||
+ if(QApplication::activeWindow() != this)
|
||||
+ {
|
||||
+ this->hide();
|
||||
+ }
|
||||
+ }
|
||||
+ return QWidget::eventFilter(o,e);
|
||||
+}
|
||||
+
|
||||
void TrayWidget::paintEvent(QPaintEvent *event) {
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
@@ -499,13 +524,19 @@ void TrayWidget::paintEvent(QPaintEvent *event) {
|
||||
painter.setPen(Qt::transparent);
|
||||
QColor col;
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
- col = QColor(255,255,255,tran);
|
||||
+ col = QColor(255,255,255);
|
||||
} else{
|
||||
- col = QColor(35,36,38,tran);
|
||||
+ col = QColor(35,36,38);
|
||||
}
|
||||
- painter.setBrush(col);
|
||||
-
|
||||
QPainterPath rectPath;
|
||||
- rectPath.addRoundedRect(this->rect(),12,12);
|
||||
+
|
||||
+ if (_Intel)
|
||||
+ rectPath.addRect(this->rect());
|
||||
+ else {
|
||||
+ col.setAlpha(tran);
|
||||
+ rectPath.addRoundedRect(this->rect(),12,12);
|
||||
+ }
|
||||
+
|
||||
+ painter.setBrush(col);
|
||||
painter.drawPath(rectPath);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.h b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
index 0a00d1b..233910f 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.h
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
@@ -92,6 +92,7 @@ signals:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
+ bool eventFilter(QObject *o, QEvent *e);
|
||||
};
|
||||
|
||||
#endif // TRAYWIDGET_H
|
|
@ -0,0 +1,98 @@
|
|||
diff --git a/service/main.cpp b/service/main.cpp
|
||||
index 1bd0611..799718b 100644
|
||||
--- a/service/main.cpp
|
||||
+++ b/service/main.cpp
|
||||
@@ -4,54 +4,17 @@
|
||||
#include <QCommandLineParser>
|
||||
#include <QDebug>
|
||||
|
||||
+#include <ukui-log4qt.h>
|
||||
+
|
||||
#include "daemon.h"
|
||||
#include "sessiondbusregister.h"
|
||||
|
||||
+
|
||||
extern "C" {
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
}
|
||||
|
||||
-static bool debugFlag = false;
|
||||
-static bool infoFlag = false;
|
||||
-
|
||||
-static void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
-{
|
||||
- if (infoFlag) {
|
||||
- QByteArray localMsg = msg.toLocal8Bit();
|
||||
- switch (type) {
|
||||
- case QtDebugMsg:
|
||||
- if (debugFlag)
|
||||
- fprintf(stdout, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
- break;
|
||||
- case QtInfoMsg:
|
||||
- fprintf(stdout, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
- break;
|
||||
- case QtWarningMsg:
|
||||
- fprintf(stdout, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
- break;
|
||||
- case QtCriticalMsg:
|
||||
- fprintf(stdout, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
- break;
|
||||
- case QtFatalMsg:
|
||||
- fprintf(stdout, "\033[41;37;1m Fatal:\033[41;37;4m %s (%s:%u, %s)\033[0m\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
- abort();
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void getDebugFlag(int argc, char *argv[])
|
||||
-{
|
||||
-// fprintf(stderr,"\033[41;37;1m hello world\033[0m\n");
|
||||
- for (int i = 0; i < argc; i++) {
|
||||
- if (strcmp(argv[i],"-d") == 0 || strcmp(argv[i],"--debug") == 0)
|
||||
- debugFlag = true;
|
||||
- if (strcmp(argv[i],"-i") == 0 || strcmp(argv[i],"--info") == 0)
|
||||
- infoFlag = true;
|
||||
- }
|
||||
-// fprintf(stderr,"%d %d\n",debugFlag,infoFlag);
|
||||
-}
|
||||
-
|
||||
void signalHandlerFunc(int signal) {
|
||||
fprintf(stderr,"---------------------- %d",signal);
|
||||
}
|
||||
@@ -59,11 +22,10 @@ void signalHandlerFunc(int signal) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf(stdout,"Program running.....\n");
|
||||
- getDebugFlag(argc,argv);
|
||||
-// qInstallMessageHandler(myMessageOutput);
|
||||
+ initUkuiLog4qt(QString("bluetoothserver"));
|
||||
QtSingleCoreApplication a(argc, argv);
|
||||
a.setOrganizationName("Kylin Team");
|
||||
- a.setApplicationName("bus-bluetooth-service");
|
||||
+ a.setApplicationName("dbus-bluetooth-service");
|
||||
a.setApplicationVersion("1.0.0");
|
||||
|
||||
if (a.isRunning()) {
|
||||
@@ -77,8 +39,6 @@ int main(int argc, char *argv[])
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addOptions({{{"o","obex"},QCoreApplication::translate("main","Load the Bluetooth file transfer agent")}});
|
||||
- parser.addOptions({{{"d","debug"},QCoreApplication::translate("main","Debug options to enable")}});
|
||||
- parser.addOptions({{{"i","info"},QCoreApplication::translate("main","Info options to enable")}});
|
||||
|
||||
parser.setApplicationDescription(QCoreApplication::translate("main","UKUI bluetooth daemon"));
|
||||
parser.process(a);
|
||||
diff --git a/service/service.pro b/service/service.pro
|
||||
index 355ae38..d70ced2 100644
|
||||
--- a/service/service.pro
|
||||
+++ b/service/service.pro
|
||||
@@ -31,6 +31,8 @@ QMAKE_LFLAGS += -D_FORTIFY_SOURCE=2 -O2
|
||||
#ins3.path = /usr/share/polkit-1/actions/
|
||||
target.source += $$TARGET
|
||||
target.path = $$BIN_INSTALL_DIR
|
||||
+inst1.files += ../data/org.ukui.log4qt.bluetoothserver.gschema.xml
|
||||
+inst1.path = $$SCHEMAS_INSTALL_DIR
|
||||
INSTALLS += target
|
||||
|
||||
# The following define makes your compiler warn you if you use any
|
|
@ -0,0 +1,281 @@
|
|||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index 0472ca2..b87e4e5 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
MainProgram::MainProgram(bool intel, QObject *parent) :
|
||||
QObject(parent),
|
||||
- _sessionDbus(new BluetoothDbus(this)),
|
||||
- _mConfig(new Config(this)),
|
||||
_mIntel(intel)
|
||||
{
|
||||
+ _sessionDbus = new BluetoothDbus(this);
|
||||
+ _mConfig = new Config(this);
|
||||
initGSettingInfo();
|
||||
UI = TrayWidget::self(_sessionDbus, _mIntel);
|
||||
if (!_mIntel)
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.h b/ukui-bluetooth/main/mainprogram.h
|
||||
index 4debc4c..cb4b6ca 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.h
|
||||
+++ b/ukui-bluetooth/main/mainprogram.h
|
||||
@@ -60,10 +60,10 @@ private:
|
||||
|
||||
bool _mIntel;
|
||||
QStringList selectedFiles;
|
||||
- Config *_mConfig;
|
||||
QMap<QString,QVariant> _mGsetting;
|
||||
- FileReceivingPopupWidget *receiving_widget ;
|
||||
|
||||
+ FileReceivingPopupWidget *receiving_widget = nullptr;
|
||||
+ Config *_mConfig = nullptr;
|
||||
BluetoothDbus *_sessionDbus = nullptr;
|
||||
BluetoothFileTransferWidget *fileSendWidget = nullptr;
|
||||
QList<QString> *deviceAddressList = nullptr;
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.cpp b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
index 046dfb7..dc8f111 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
@@ -3,30 +3,20 @@
|
||||
TrayIcon::TrayIcon(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
-
|
||||
- // MainProgram *w = new MainProgram();
|
||||
-
|
||||
- //==============获取gsettings的配置信息==========================
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.bluetooth")){
|
||||
settings = new QGSettings("org.ukui.bluetooth");
|
||||
-
|
||||
- paired_device_address = settings->get("paired-device-address").toStringList();
|
||||
- finally_connect_the_device = settings->get("finally-connect-the-device").toString();
|
||||
- paired_device = settings->get("paired-device").toStringList();
|
||||
- Default_Adapter = settings->get("adapter-address").toString();
|
||||
- File_save_path = settings->get("file-save-path").toString();
|
||||
-
|
||||
- qDebug() << "GSetting Value: " << Default_Adapter << finally_connect_the_device << paired_device;
|
||||
connect(settings, &QGSettings::changed,this,&TrayIcon::GSettings_value_chanage);
|
||||
}
|
||||
- //========================END===================================
|
||||
|
||||
bluetooth_tray_icon = new QSystemTrayIcon(this);
|
||||
+ tray_Menu = new QMenu(this);
|
||||
+ QAction *settins_action = new QAction(QIcon::fromTheme("ukui-settings-symbolic"),tr("Set Bluetooth Item"),tray_Menu);
|
||||
+ tray_Menu->addAction(settins_action);
|
||||
|
||||
//Create taskbar tray icon and connect to signal slot
|
||||
//创建任务栏托盘图标,并连接信号槽
|
||||
bluetooth_tray_icon = new QSystemTrayIcon(this);
|
||||
- //bluetooth_tray_icon->setContextMenu(tray_Menu);
|
||||
+ bluetooth_tray_icon->setContextMenu(tray_Menu);
|
||||
bluetooth_tray_icon->setToolTip(tr("Bluetooth"));
|
||||
bluetooth_tray_icon->setVisible(settings->get("tray-show").toBool());
|
||||
|
||||
@@ -43,27 +33,24 @@ TrayIcon::TrayIcon(QWidget *parent)
|
||||
[=](QSystemTrayIcon::ActivationReason reason){
|
||||
switch (reason)
|
||||
{
|
||||
+ case QSystemTrayIcon::MiddleClick:
|
||||
case QSystemTrayIcon::DoubleClick: /* 来自于双击激活。 */
|
||||
case QSystemTrayIcon::Trigger: /* 来自于单击激活。 */
|
||||
- InitTrayMenu();
|
||||
- break;
|
||||
- case QSystemTrayIcon::Context:
|
||||
- //InitTrayMenu();
|
||||
+ InitTrayWidget();
|
||||
break;
|
||||
+ case QSystemTrayIcon::Unknown:
|
||||
+ case QSystemTrayIcon::Context:
|
||||
+ break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-void TrayIcon::replyRequestConfirmationFunc(bool a) {
|
||||
- qDebug() << Q_FUNC_INFO << a;
|
||||
-}
|
||||
-
|
||||
TrayIcon::~TrayIcon()
|
||||
{
|
||||
delete settings;
|
||||
}
|
||||
|
||||
-void TrayIcon::InitTrayMenu()
|
||||
+void TrayIcon::InitTrayWidget()
|
||||
{
|
||||
emit showTayWidget();
|
||||
}
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.h b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
index e5b9a78..313f3bd 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.h
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
@@ -5,15 +5,11 @@
|
||||
#include "daemon/bluetoothdbus.h"
|
||||
#include "component/switchaction.h"
|
||||
|
||||
-#include <string>
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
-#include <QDBusObjectPath>
|
||||
-
|
||||
#include <iostream>
|
||||
#include <QApplication>
|
||||
-#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QAction>
|
||||
@@ -21,28 +17,9 @@
|
||||
#include <QMenu>
|
||||
#include <QGSettings>
|
||||
#include <QDebug>
|
||||
-#include <QStringList>
|
||||
-#include <QFileDialog>
|
||||
-#include <QVariant>
|
||||
-#include <QPalette>
|
||||
-#include <QTextCodec>
|
||||
-#include <QFileSystemWatcher>
|
||||
-#include <QStandardPaths>
|
||||
-#include <QRect>
|
||||
-#include <QUrl>
|
||||
-#include <QProcess>
|
||||
-#include <QDir>
|
||||
-#include <QFile>
|
||||
-#include <QDateTime>
|
||||
#include <QWidgetAction>
|
||||
-#include <QDBusMessage>
|
||||
-#include <QMessageBox>
|
||||
-
|
||||
-#define LIST_PATH "/etc/pairDevice.list"
|
||||
-#define RFKILL_DEV "/dev/rfkill"
|
||||
|
||||
using namespace std;
|
||||
-class BluetoothDbus;
|
||||
|
||||
class TrayIcon : public QWidget
|
||||
{
|
||||
@@ -51,53 +28,18 @@ class TrayIcon : public QWidget
|
||||
public:
|
||||
TrayIcon(QWidget *parent = nullptr);
|
||||
~TrayIcon();
|
||||
- bool exit_flag = false;
|
||||
- void InitTrayMenu();
|
||||
+ void InitTrayWidget();
|
||||
|
||||
signals:
|
||||
- void ProgramExit();
|
||||
void showTayWidget();
|
||||
|
||||
public slots:
|
||||
void GSettings_value_chanage(const QString &key);
|
||||
void SetTrayIcon(bool open);
|
||||
|
||||
-
|
||||
-
|
||||
- void replyRequestConfirmationFunc(bool a);
|
||||
-
|
||||
private:
|
||||
- bool isPowered = false;
|
||||
- void InitGSettings();
|
||||
-
|
||||
-
|
||||
- QList<QString> is_connected;
|
||||
QSystemTrayIcon *bluetooth_tray_icon = nullptr;
|
||||
QMenu *tray_Menu = nullptr;
|
||||
- SwitchAction *m_action = nullptr;
|
||||
QGSettings *settings = nullptr;
|
||||
-
|
||||
- QStringList paired_device_address;
|
||||
- QStringList paired_device;
|
||||
- QString finally_connect_the_device;
|
||||
- QString Default_Adapter;
|
||||
- QString File_save_path;
|
||||
- QString cur_adapter_address;
|
||||
- QStringList adapter_list;
|
||||
- QString selected_file;
|
||||
- quint64 transfer_file_size = 0;
|
||||
- bool flag = true;
|
||||
-
|
||||
- BluetoothDbus *session_dbus = nullptr;
|
||||
- BluetoothFileTransferWidget *transfer_widget = nullptr;
|
||||
-
|
||||
- QTimer *notify_timer;
|
||||
- QDBusObjectPath pre_session;
|
||||
- bool dev_remove_flag = false;
|
||||
- bool sleep_flag = false;
|
||||
- bool dev_connected_when_sleep = false;
|
||||
- QString pair_device_file;
|
||||
- int dev_callbak_flag = 0;
|
||||
- bool pair_flag = true;
|
||||
} ;
|
||||
#endif // TRAYICON_H
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm
|
||||
index 63e204c..a22748f 100644
|
||||
Binary files a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm and b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
index 9188a0c..962d0ec 100644
|
||||
--- a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
+++ b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
@@ -11,7 +11,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="71"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="294"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="295"/>
|
||||
<source>Transferring to "</source>
|
||||
<translation>发送文件至 "</translation>
|
||||
</message>
|
||||
@@ -217,13 +217,13 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="66"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="195"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="196"/>
|
||||
<source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !</source>
|
||||
<translation>请在蓝牙设备 "%1" 上输入下列PIN码,并按连接进行匹配!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="64"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="193"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="194"/>
|
||||
<source>If '</source>
|
||||
<translation>如果 "</translation>
|
||||
</message>
|
||||
@@ -234,7 +234,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="64"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="193"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="194"/>
|
||||
<source>' the PIN on is the same as this PIN. Please press 'Connect'.</source>
|
||||
<translation>" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
</message>
|
||||
@@ -264,12 +264,12 @@
|
||||
<context>
|
||||
<name>QDevItem</name>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="46"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="45"/>
|
||||
<source>The connection with the Bluetooth device “%1” is successful!</source>
|
||||
<translation>与蓝牙设备“%1”连接成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="49"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="48"/>
|
||||
<source>Bluetooth device “%1” disconnected!</source>
|
||||
<translation>蓝牙设备“%1”失去连接!</translation>
|
||||
</message>
|
||||
@@ -285,7 +285,12 @@
|
||||
<context>
|
||||
<name>TrayIcon</name>
|
||||
<message>
|
||||
- <location filename="../mainwidget/trayicon.cpp" line="30"/>
|
||||
+ <location filename="../mainwidget/trayicon.cpp" line="13"/>
|
||||
+ <source>Set Bluetooth Item</source>
|
||||
+ <translation>设置蓝牙项</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../mainwidget/trayicon.cpp" line="20"/>
|
||||
<source>Bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
|
@ -0,0 +1,71 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 7a519b2..e8832d6 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -142,18 +142,18 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
|
||||
if (dev)
|
||||
{
|
||||
- if (Daemon::_DefualtAdapter.data()->isDiscovering()) {
|
||||
- ::isScan = true;
|
||||
- BluezQt::PendingCall * stop_call = Daemon::_DefualtAdapter.data()->stopDiscovery();
|
||||
- connect(stop_call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn)
|
||||
- {
|
||||
- qDebug() << Q_FUNC_INFO << "stopDiscovery:" << callReturn->error() << callReturn->errorText() << __LINE__;
|
||||
- });
|
||||
- //qDebug() << Q_FUNC_INFO << "stopDiscovery:111111111111111111" << __LINE__;
|
||||
- stop_call->waitForFinished();
|
||||
- //qDebug() << Q_FUNC_INFO << "stopDiscovery:222222222222222222" << __LINE__;
|
||||
-
|
||||
- }
|
||||
+// if (Daemon::_DefualtAdapter.data()->isDiscovering()) {
|
||||
+// ::isScan = true;
|
||||
+// BluezQt::PendingCall * stop_call = Daemon::_DefualtAdapter.data()->stopDiscovery();
|
||||
+// connect(stop_call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn)
|
||||
+// {
|
||||
+// qDebug() << Q_FUNC_INFO << "stopDiscovery:" << callReturn->error() << callReturn->errorText() << __LINE__;
|
||||
+// });
|
||||
+// //qDebug() << Q_FUNC_INFO << "stopDiscovery:111111111111111111" << __LINE__;
|
||||
+// stop_call->waitForFinished();
|
||||
+// //qDebug() << Q_FUNC_INFO << "stopDiscovery:222222222222222222" << __LINE__;
|
||||
+
|
||||
+// }
|
||||
|
||||
if (dev.data()->type() == BluezQt::Device::AudioVideo ||
|
||||
dev.data()->type() == BluezQt::Device::Headphones ||
|
||||
@@ -420,6 +420,17 @@ void SessionDbusRegister::devConnect(const QString addr)
|
||||
if (!devPtr)
|
||||
return;
|
||||
|
||||
+
|
||||
+ if (Daemon::_DefualtAdapter.data()->isDiscovering()) {
|
||||
+ ::isScan = true;
|
||||
+ BluezQt::PendingCall * stop_call = Daemon::_DefualtAdapter.data()->stopDiscovery();
|
||||
+ connect(stop_call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn)
|
||||
+ {
|
||||
+ qDebug() << Q_FUNC_INFO << "stopDiscovery:" << callReturn->error() << callReturn->errorText() << __LINE__;
|
||||
+ });
|
||||
+ stop_call->waitForFinished();
|
||||
+ }
|
||||
+
|
||||
if (devPtr.data()->isPaired()) {
|
||||
AudioDevConnectFunc(devPtr);
|
||||
} else {
|
||||
@@ -429,6 +440,17 @@ void SessionDbusRegister::devConnect(const QString addr)
|
||||
emit devOperateErrorSignal(devPtr.data()->address(),
|
||||
callReturn->error(),
|
||||
callReturn->errorText());
|
||||
+ //主动连接全部完成后,启动扫描
|
||||
+ if(GlobalSize::BlueDevActiveSize() == 0)
|
||||
+ {
|
||||
+ qDebug () << Q_FUNC_INFO << ::isScan << "===================startDiscovery====" << ::isScan << __LINE__;
|
||||
+ if (::isScan) {
|
||||
+ BluezQt::PendingCall * start_call = Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
+ connect(start_call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
} else
|
||||
AudioDevConnectFunc(devPtr);
|
||||
});
|
|
@ -0,0 +1,83 @@
|
|||
diff --git a/service/bluetoothagent.cpp b/service/bluetoothagent.cpp
|
||||
index bb80f6d..c6de8a5 100644
|
||||
--- a/service/bluetoothagent.cpp
|
||||
+++ b/service/bluetoothagent.cpp
|
||||
@@ -107,11 +107,10 @@ void BluetoothAgent::displayPasskey(BluezQt::DevicePtr device, const QString &pa
|
||||
cancelEmitDevStatus(device->address());
|
||||
if(m_displayedPasskey == passkey)
|
||||
return;
|
||||
-
|
||||
QDBusMessage displayPasskeySignal = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
"com.ukui.bluetooth",
|
||||
"displayPasskey");
|
||||
- displayPasskeySignal << device.data()->name() << passkey;
|
||||
+ displayPasskeySignal << device.data()->name() << passkey << device.data()->address();;
|
||||
QDBusConnection::sessionBus().send(displayPasskeySignal);
|
||||
}
|
||||
|
||||
@@ -121,16 +120,25 @@ void BluetoothAgent::requestConfirmation(BluezQt::DevicePtr device, const QStrin
|
||||
|
||||
cancelEmitDevStatus(device->address());
|
||||
|
||||
- QDBusMessage displayPasskeySignal = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
- "requestConfirmation");
|
||||
- displayPasskeySignal << device.data()->name() << passkey;
|
||||
- QDBusConnection::sessionBus().send(displayPasskeySignal);
|
||||
-
|
||||
m_device = device;
|
||||
- tmpRequestConfirmation = request;
|
||||
-
|
||||
+ //规避设备类型为耳机、音响设备时还会弹出pin窗口的问题
|
||||
+ if ((nullptr != m_device) &&
|
||||
+ (m_device.data()->type() == BluezQt::Device::AudioVideo ||
|
||||
+ m_device.data()->type() == BluezQt::Device::Headphones ||
|
||||
+ m_device.data()->type() == BluezQt::Device::Headset ))
|
||||
+ {
|
||||
+ request.accept();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ QDBusMessage displayPasskeySignal = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
+ "com.ukui.bluetooth",
|
||||
+ "requestConfirmation");
|
||||
+ displayPasskeySignal << device.data()->name() << passkey << device.data()->address();
|
||||
+ QDBusConnection::sessionBus().send(displayPasskeySignal);
|
||||
|
||||
+ tmpRequestConfirmation = request;
|
||||
+ }
|
||||
}
|
||||
|
||||
void BluetoothAgent::requestAuthorization(BluezQt::DevicePtr device, const BluezQt::Request<> &request)
|
||||
diff --git a/ukcc-bluetooth/devicebase.cpp b/ukcc-bluetooth/devicebase.cpp
|
||||
index 05a3a66..fdb6ec8 100644
|
||||
--- a/ukcc-bluetooth/devicebase.cpp
|
||||
+++ b/ukcc-bluetooth/devicebase.cpp
|
||||
@@ -183,8 +183,11 @@ bool bluetoothdevice::isPaired()
|
||||
void bluetoothdevice::devPairedChanged(bool value)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << value << __LINE__;
|
||||
- this->m_dev_isPaired = value;
|
||||
- emit pairedChanged(value);
|
||||
+ if(this->m_dev_isPaired != value)
|
||||
+ {
|
||||
+ this->m_dev_isPaired = value;
|
||||
+ emit pairedChanged(value);
|
||||
+ }
|
||||
}
|
||||
|
||||
bool bluetoothdevice::isConnected()
|
||||
@@ -195,8 +198,11 @@ bool bluetoothdevice::isConnected()
|
||||
|
||||
void bluetoothdevice::devConnectedChanged(bool value)
|
||||
{
|
||||
- this->m_dev_isConnected = value;
|
||||
- emit connectedChanged(value);
|
||||
+ if(this->m_dev_isConnected != value)
|
||||
+ {
|
||||
+ this->m_dev_isConnected = value;
|
||||
+ emit connectedChanged(value);
|
||||
+ }
|
||||
}
|
||||
|
||||
void bluetoothdevice::setErrorInfo(int errorId,QString errorText)
|
|
@ -0,0 +1,147 @@
|
|||
diff --git a/data/org.ukui.bluetooth.gschema.xml b/data/org.ukui.bluetooth.gschema.xml
|
||||
index 20da8c3..e4d8372 100644
|
||||
--- a/data/org.ukui.bluetooth.gschema.xml
|
||||
+++ b/data/org.ukui.bluetooth.gschema.xml
|
||||
@@ -2,8 +2,13 @@
|
||||
<schema id="org.ukui.bluetooth" path="/org/ukui/bluetooth/">
|
||||
<key type="b" name="switch">
|
||||
<default>true</default>
|
||||
- <summary>bluetooth switch</summary>
|
||||
- <description>bluetooth switch</description>
|
||||
+ <summary>bluetooth power switch</summary>
|
||||
+ <description>bluetooth power switch</description>
|
||||
+ </key>
|
||||
+ <key type="b" name="bluetooth-discoverable-switch">
|
||||
+ <default>true</default>
|
||||
+ <summary>bluetooth discoverable switch</summary>
|
||||
+ <description>bluetooth discoverable switch</description>
|
||||
</key>
|
||||
<key type="s" name="file-save-path">
|
||||
<default>""</default>
|
||||
diff --git a/service/config.h b/service/config.h
|
||||
index 1e4ba0e..7fa5818 100644
|
||||
--- a/service/config.h
|
||||
+++ b/service/config.h
|
||||
@@ -20,6 +20,16 @@ enum Environment
|
||||
INTER,
|
||||
};
|
||||
|
||||
+//gsetting name define
|
||||
+
|
||||
+//名称请勿随意改动,会导致升级时获取的gsetting值不一致,
|
||||
+#define GSETTING_STR_BLUETOOTH_POWER_SWTICH "switch"
|
||||
+#define GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH "bluetooth-discoverable-switch"
|
||||
+#define GSETTING_STR_FINALLY_CONNECT_THE_DEVICE "finally-connect-the-device"
|
||||
+#define GSETTING_STR_ADAPTER_ADDRESS "adapter-address"
|
||||
+#define GSETTING_STR_FILE_SAVE_PATH "file-save-path"
|
||||
+#define GSETTING_STR_ADAPTER_ADDRESS_LIST "adapter-address-list"
|
||||
+
|
||||
extern Environment envPC;
|
||||
|
||||
class Config : public QObject
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index dc24407..d2eba67 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -219,11 +219,12 @@ void Daemon::rfkillStatusChange(int status)
|
||||
void Daemon::initGSettingInfo()
|
||||
{
|
||||
_mGsetting.clear();
|
||||
- _mGsetting["switch"] = Config::gsetting->get("switch");
|
||||
- _mGsetting["finally-connect-the-device"] = Config::gsetting->get("finally-connect-the-device");
|
||||
- _mGsetting["adapter-address"] = Config::gsetting->get("adapter-address");
|
||||
- _mGsetting["file-save-path"] = Config::gsetting->get("file-save-path");
|
||||
- _mGsetting["adapter-address-list"] = Config::gsetting->get("adapter-address-list");
|
||||
+ _mGsetting[GSETTING_STR_BLUETOOTH_POWER_SWTICH] = Config::gsetting->get(GSETTING_STR_BLUETOOTH_POWER_SWTICH);
|
||||
+ _mGsetting[GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH] = Config::gsetting->get(GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH);
|
||||
+ _mGsetting[GSETTING_STR_FINALLY_CONNECT_THE_DEVICE] = Config::gsetting->get(GSETTING_STR_FINALLY_CONNECT_THE_DEVICE);
|
||||
+ _mGsetting[GSETTING_STR_ADAPTER_ADDRESS] = Config::gsetting->get(GSETTING_STR_ADAPTER_ADDRESS);
|
||||
+ _mGsetting[GSETTING_STR_FILE_SAVE_PATH] = Config::gsetting->get(GSETTING_STR_FILE_SAVE_PATH);
|
||||
+ _mGsetting[GSETTING_STR_ADAPTER_ADDRESS_LIST] = Config::gsetting->get(GSETTING_STR_ADAPTER_ADDRESS_LIST);
|
||||
|
||||
connect(Config::gsetting,SIGNAL(changed(QString)),this,SLOT(gsettingsChangedSlot(QString)));
|
||||
}
|
||||
@@ -334,8 +335,15 @@ void Daemon::initBluezManager()
|
||||
launchTrayUI();
|
||||
|
||||
if (!_DefualtAdapter.isNull())
|
||||
- _DefualtAdapter.data()->setPowered(_mGsetting["switch"].toBool());
|
||||
+ {
|
||||
+ _DefualtAdapter.data()->setPowered(_mGsetting[GSETTING_STR_BLUETOOTH_POWER_SWTICH].toBool());
|
||||
|
||||
+ //intel机型需要安装启动时为开启
|
||||
+ if ((Environment::INTER == envPC))
|
||||
+ {
|
||||
+ _DefualtAdapter.data()->setDiscoverable(_mGsetting[GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH].toBool());
|
||||
+ }
|
||||
+ }
|
||||
reconnectFunc();
|
||||
qInfo() << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
@@ -492,21 +500,21 @@ BluezQt::AdapterPtr Daemon::getDefualtAdapter()
|
||||
|
||||
}else if(_BluezManager->adapters().size() == 1){
|
||||
return _BluezManager->adapters().at(0);
|
||||
- Config::gsetting->set("adapter-address",QVariant::fromValue(_DefualtAdapter->address()));
|
||||
+ Config::gsetting->set(GSETTING_STR_ADAPTER_ADDRESS,QVariant::fromValue(_DefualtAdapter->address()));
|
||||
|
||||
}else{
|
||||
|
||||
- if(_mGsetting["adapter-address-list"].toStringList().indexOf(_mGsetting["adapter-address"].toString()) != -1){
|
||||
- return _BluezManager->adapterForAddress(_mGsetting["adapter-address"].toString());
|
||||
+ if(_mGsetting[GSETTING_STR_ADAPTER_ADDRESS_LIST].toStringList().indexOf(_mGsetting[GSETTING_STR_ADAPTER_ADDRESS].toString()) != -1){
|
||||
+ return _BluezManager->adapterForAddress(_mGsetting[GSETTING_STR_ADAPTER_ADDRESS].toString());
|
||||
}else{
|
||||
//这里adapter-address-list的数据不一定存在
|
||||
- if (_mGsetting["adapter-address-list"].toStringList().size() > 0)
|
||||
+ if (_mGsetting[GSETTING_STR_ADAPTER_ADDRESS_LIST].toStringList().size() > 0)
|
||||
{
|
||||
- return _BluezManager->adapterForAddress(_mGsetting["adapter-address-list"].toStringList().at(0));
|
||||
+ return _BluezManager->adapterForAddress(_mGsetting[GSETTING_STR_ADAPTER_ADDRESS_LIST].toStringList().at(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
- return _BluezManager->adapterForAddress(_mGsetting["adapter-address"].toString());
|
||||
+ return _BluezManager->adapterForAddress(_mGsetting[GSETTING_STR_ADAPTER_ADDRESS].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 82a2863..4172b44 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -804,7 +804,7 @@ void SessionDbusRegister::connectSignal()
|
||||
::sleepFlag = false;
|
||||
}
|
||||
|
||||
- Config::gsetting->set("switch",QVariant(powered));
|
||||
+ Config::gsetting->set(GSETTING_STR_BLUETOOTH_POWER_SWTICH,QVariant(powered));
|
||||
|
||||
emit defaultAdapterPowerChanged(powered);
|
||||
});
|
||||
@@ -816,6 +816,10 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::discoverableChanged,this,[=](bool discoverable){
|
||||
qDebug() << Q_FUNC_INFO << "discoverableChanged" << discoverable << __LINE__;
|
||||
+
|
||||
+ //这里是否需要增加intel机型判断,intel默认可被发状态为开启
|
||||
+ Config::gsetting->set(GSETTING_STR_BLUETOOTH_DISCOVERABLE_SWTICH,QVariant(discoverable));
|
||||
+
|
||||
emit defaultDiscoverableChanged(discoverable);
|
||||
});
|
||||
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index 912053d..da09619 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -2165,7 +2165,9 @@ void BlueToothMain::adapterComboxChanged(int i)
|
||||
setDefaultAdapterScanOn(false);
|
||||
clearAllUnPairedDevicelist();
|
||||
|
||||
- setDefaultAdapter(m_bluetooth_adapter_list.at(i)->getDevAddress());
|
||||
+ if (i < m_bluetooth_adapter_list.size())
|
||||
+ setDefaultAdapter(m_bluetooth_adapter_list.at(i)->getDevAddress());
|
||||
+
|
||||
refreshUIWhenAdapterChanged();
|
||||
}else{
|
||||
if(m_open_bluetooth_btn->isChecked()){
|
|
@ -0,0 +1,82 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 4172b44..6f950ad 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -241,7 +241,52 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
}
|
||||
|
||||
});
|
||||
- } else {
|
||||
+ }
|
||||
+ //Dt-test phone只连接媒体音频
|
||||
+ else if(dev.data()->type() == BluezQt::Device::Phone)
|
||||
+ {
|
||||
+ qDebug () << Q_FUNC_INFO <<
|
||||
+ dev.data()->name() <<
|
||||
+ dev.data()->address() <<
|
||||
+ dev.data()->type() << __LINE__;
|
||||
+
|
||||
+ if (Environment::HUAWEI == envPC)
|
||||
+ {
|
||||
+ //华为
|
||||
+ qDebug () << Q_FUNC_INFO << "Environment::HUAWEI??"<< envPC;
|
||||
+ return;
|
||||
+ }
|
||||
+ //背景:PC连接手机后,PC端播放音频无法从手机端输出
|
||||
+ //手机移动设备只连接媒体音频,可通过手机端发送音频至PC播放.将PC设备作为一个输出设备。
|
||||
+ //UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
|
||||
+ BluezQt::PendingCall *call = dev.data()->connectProfile("0000110a-0000-1000-8000-00805f9b34fb");
|
||||
+ GlobalSize::refBlueDevActive(dev->address());
|
||||
+ connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
+ GlobalSize::unrefBlueDevActive(dev->address());
|
||||
+ if (callReturn->error()) {
|
||||
+ emit devOperateErrorSignal(dev.data()->address(),
|
||||
+ callReturn->error(),
|
||||
+ callReturn->errorText());
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ //主动连接成功后,发送连接成功信号
|
||||
+ addDelay(dev);
|
||||
+ }
|
||||
+
|
||||
+ //不存在主动连接
|
||||
+ if(GlobalSize::BlueDevActiveSize() == 0)
|
||||
+ {
|
||||
+ qDebug () << Q_FUNC_INFO << ::isScan << "===================startDiscovery====" << ::isScan << __LINE__;
|
||||
+ if (::isScan) {
|
||||
+ if(!Daemon::_DefualtAdapter.data()->isDiscovering())
|
||||
+ Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ else {
|
||||
|
||||
qDebug () << Q_FUNC_INFO << dev.data()->type() << __LINE__;
|
||||
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index da09619..7370c3f 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -2297,7 +2297,6 @@ void BlueToothMain::cleanPairDevices()
|
||||
delete child;
|
||||
child = nullptr;
|
||||
|
||||
-
|
||||
}
|
||||
device_list->setVisible(false);
|
||||
qDebug() << Q_FUNC_INFO << "=============33333333" ;
|
||||
diff --git a/ukcc-bluetooth/ukccbluetoothconfig.cpp b/ukcc-bluetooth/ukccbluetoothconfig.cpp
|
||||
index b687b17..12258d4 100644
|
||||
--- a/ukcc-bluetooth/ukccbluetoothconfig.cpp
|
||||
+++ b/ukcc-bluetooth/ukccbluetoothconfig.cpp
|
||||
@@ -41,6 +41,7 @@ bool ukccbluetoothconfig::checkProcessRunning(const QString &processName, QList<
|
||||
// strCommand = "ps -ef|grep '" + processName + " -o' |grep -v grep |awk '{print $2}'";
|
||||
//else
|
||||
strCommand = "ps -ef|grep '" + processName + "' |grep -v grep |awk '{print $2}'";
|
||||
+ qDebug() << Q_FUNC_INFO << strCommand << __LINE__;
|
||||
|
||||
QByteArray ba = strCommand.toLatin1();
|
||||
const char* strFind_ComName = ba.data();
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 32b55bf..6dc15a3 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -333,7 +333,8 @@ void Daemon::initBluezManager()
|
||||
launchDbusSignal();
|
||||
launchTrayUI();
|
||||
|
||||
- _DefualtAdapter.data()->setPowered(_mGsetting["switch"].toBool());
|
||||
+ if (nullptr != _DefualtAdapter)
|
||||
+ _DefualtAdapter.data()->setPowered(_mGsetting["switch"].toBool());
|
||||
|
||||
reconnectFunc();
|
||||
qInfo() << Q_FUNC_INFO << __LINE__;
|
|
@ -0,0 +1,127 @@
|
|||
Index: ukui-bluetooth/ukcc-bluetooth/bluetooth.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetooth.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetooth.cpp
|
||||
@@ -39,6 +39,8 @@ QWidget *Bluetooth::pluginUi() {
|
||||
pluginWidget = new BlueToothMain;
|
||||
// pluginWidget = new BlueToothMainWindow;
|
||||
}
|
||||
+ if (!mFirstLoad && (nullptr != pluginWidget))
|
||||
+ pluginWidget->setbluetoothAdapterDiscoveringStatus(true);
|
||||
return pluginWidget;
|
||||
}
|
||||
|
||||
@@ -61,6 +63,10 @@ bool Bluetooth::isEnable() const
|
||||
return true;
|
||||
}
|
||||
|
||||
-
|
||||
+void Bluetooth::plugin_leave()
|
||||
+{
|
||||
+ if (nullptr != pluginWidget)
|
||||
+ pluginWidget->setbluetoothAdapterDiscoveringStatus(false);
|
||||
+}
|
||||
|
||||
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetooth.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetooth.h
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetooth.h
|
||||
@@ -27,6 +27,8 @@ public:
|
||||
QIcon icon() const Q_DECL_OVERRIDE;
|
||||
bool isEnable() const Q_DECL_OVERRIDE;
|
||||
|
||||
+ void plugin_leave() Q_DECL_OVERRIDE;
|
||||
+
|
||||
private:
|
||||
QString pluginName;
|
||||
int pluginType;
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -1193,6 +1193,11 @@ void BlueToothMain::setDefaultAdapterDis
|
||||
// 发送Message
|
||||
QDBusConnection::sessionBus().call(m, QDBus::NoBlock);
|
||||
}
|
||||
+void BlueToothMain::setbluetoothAdapterDiscoveringStatus(bool isScan)
|
||||
+{
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ setDefaultAdapterScanOn(isScan);
|
||||
+}
|
||||
|
||||
void BlueToothMain::setDefaultAdapterScanOn(bool value)
|
||||
{
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.h
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.h
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
//dev-3.1 界面服务分离
|
||||
|
||||
public:
|
||||
-
|
||||
+ void setbluetoothAdapterDiscoveringStatus(bool);
|
||||
signals:
|
||||
void sendAdapterNameChangeSignal(const QString &value);
|
||||
void defaultAdapterNameChanged(const QString &name);
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
@@ -100,6 +100,28 @@ void BluetoothNameLabel::dev_name_limit_
|
||||
}
|
||||
}
|
||||
}
|
||||
+void BluetoothNameLabel::mousePressEvent(QMouseEvent *event)
|
||||
+{
|
||||
+ Q_UNUSED(event);
|
||||
+
|
||||
+// m_label->setVisible(false);
|
||||
+// icon_pencil->setVisible(false);
|
||||
+
|
||||
+// m_lineedit->setText(device_name);
|
||||
+// m_lineedit->setVisible(true);
|
||||
+// m_lineedit->setFocus();
|
||||
+
|
||||
+ DevRenameDialog *renameDialog = new DevRenameDialog();
|
||||
+ renameDialog->setDevName(device_name);
|
||||
+
|
||||
+ connect(renameDialog,&DevRenameDialog::nameChanged,this,[=](QString name){
|
||||
+ m_label->setText(name);
|
||||
+ device_name = name;
|
||||
+ emit sendAdapterName(name);
|
||||
+ });
|
||||
+
|
||||
+ renameDialog->exec();
|
||||
+}
|
||||
|
||||
void BluetoothNameLabel::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
void set_dev_name(const QString &dev_name);
|
||||
void dev_name_limit_fun();
|
||||
protected:
|
||||
+ void mousePressEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
@@ -250,8 +250,8 @@ void DeviceInfoItem::setDeviceConnectSig
|
||||
_DevStatus = DEVSTATUS::ConnectFailed;
|
||||
}
|
||||
|
||||
- if (_MDev->isPaired())
|
||||
- emit devConnectionComplete();
|
||||
+ //if (_MDev->isPaired())
|
||||
+ emit devConnectionComplete();
|
||||
|
||||
update();
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
Index: ukui-bluetooth/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -79,7 +79,6 @@ TrayWidget::~TrayWidget()
|
||||
|
||||
void TrayWidget::openBluetoothSlot(bool v)
|
||||
{
|
||||
- qDebug() <<Q_FUNC_INFO << _SessionDBus->getPairedDevices().size();
|
||||
emit trayIconStatusChanged(v);
|
||||
if (v != _SessionDBus->isPowered())
|
||||
_SessionDBus->setDefaultAdapterPower(v);
|
|
@ -0,0 +1,67 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 30b6705..051c296 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -10,7 +10,13 @@ QDevItem::QDevItem(QString address, QStringList deviceinfo, bool connected, QWid
|
||||
_MType(deviceinfo.at(1))
|
||||
{
|
||||
initMap();
|
||||
+
|
||||
+ if (isHuaWei())
|
||||
+ _Battery = QString("-1");
|
||||
+ else
|
||||
+ qDebug() << "This is Normal Machine in Normal Progress.";
|
||||
qDebug() << " get dev Battery : " << deviceinfo.at(0) << _Battery;
|
||||
+
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
connect(StyleSettings,&QGSettings::changed,this,[=]{
|
||||
@@ -39,6 +45,21 @@ QDevItem::~QDevItem()
|
||||
|
||||
}
|
||||
|
||||
+bool QDevItem::isHuaWei() {
|
||||
+ QProcess p;
|
||||
+ p.start("bash", QStringList() <<"-c" << "cat /proc/cpuinfo | grep Hardware");
|
||||
+ p.waitForFinished();
|
||||
+ QString strResult = p.readAllStandardOutput();
|
||||
+
|
||||
+ QString str = strResult.toLower();
|
||||
+ if(str.length() == 0)
|
||||
+ return false;
|
||||
+ if(str.indexOf("huawei") != -1 || str.indexOf("pangu") != -1 ||
|
||||
+ str.indexOf("kirin") != -1)
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
void QDevItem::initMap() {
|
||||
typeMap = new QMap<QString, QIcon>();
|
||||
typeMap->insert(QString("phone"), QIcon::fromTheme("phone-symbolic"));
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index a7156d8..642efde 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -58,6 +58,7 @@ private:
|
||||
QColor getPainterBrushColor();
|
||||
QColor getDevStatusColor();
|
||||
QPixmap getDevTypeIcon();
|
||||
+ bool isHuaWei();
|
||||
void initMap();
|
||||
void DrawBackground(QPainter &);
|
||||
void DrawStatusIcon(QPainter &);
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index b1e0951..7e6795e 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -137,8 +137,8 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
title_text->setGeometry(38, 9, 160, 20);
|
||||
PIN_label->setGeometry(25,90,207,36);
|
||||
tip_label->setGeometry(25,56,437,40);
|
||||
- accept_btn->setGeometry(400,152,116,36);
|
||||
- refuse_btn->setGeometry(288,152,116,36);
|
||||
+ accept_btn->setGeometry(400,152,96,36);
|
||||
+ refuse_btn->setGeometry(288,152,96,36);
|
||||
}
|
||||
QList<QScreen *> list = QGuiApplication::screens();
|
||||
this->move(list.at(0)->size().width()/2-this->width()/2,list.at(0)->size().height()/2-this->height()/2);
|
|
@ -0,0 +1,11 @@
|
|||
diff --git a/debian/control b/debian/control
|
||||
index 5047fc4..2935656 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -30,6 +30,5 @@ Depends: libkf5bluezqt6,
|
||||
peony-bluetooth (>= 3.2.2+0611),
|
||||
${shlibs:Depends}, ${misc:Depends}
|
||||
Recommends: pulseaudio-module-bluetooth
|
||||
-Conflicts: blueman
|
||||
Description: Manual for UKUI desktop environment (common files)
|
||||
A lightweight Bluetooth tool based on libkf5bluezqt6 on the UKUI desktop environment
|
|
@ -0,0 +1,386 @@
|
|||
diff --git a/service/bluetoothobexagent.cpp b/service/bluetoothobexagent.cpp
|
||||
index 7ee5348..b9f05c8 100644
|
||||
--- a/service/bluetoothobexagent.cpp
|
||||
+++ b/service/bluetoothobexagent.cpp
|
||||
@@ -54,7 +54,7 @@ void BluetoothObexAgent::authorizePush(BluezQt::ObexTransferPtr transfer, BluezQ
|
||||
QDBusMessage fileReceivingSignal = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
"com.ukui.bluetooth",
|
||||
"fileReceivingSignal");
|
||||
- fileReceivingSignal << session->destination() << transfer->name() << session->source() << transfer.data()->size();
|
||||
+ fileReceivingSignal << session->destination() << transfer->name() << transfer->type() << session->source() << transfer.data()->size();
|
||||
QDBusConnection::sessionBus().send(fileReceivingSignal);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index f7de0d9..ef7c80f 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -335,7 +335,7 @@ void Daemon::continueSendFiles(QString filename) {
|
||||
filePtr = v.value<BluezQt::ObexTransferPtr>();
|
||||
if(!filePtr.isNull()){
|
||||
transfer_file_size = filePtr->size();
|
||||
- qDebug() << Q_FUNC_INFO << "Sending file size:" << transfer_file_size << __LINE__;
|
||||
+ qDebug() << Q_FUNC_INFO << "Sending file size:" << transfer_file_size << filePtr->type() << filePtr->name() <<__LINE__;
|
||||
|
||||
connect(filePtr.data(),&BluezQt::ObexTransfer::transferredChanged,this,[=](quint64 vl){
|
||||
qDebug() << Q_FUNC_INFO << "Sending file size:" << vl << __LINE__;
|
||||
diff --git a/service/sessiondbusregister.h b/service/sessiondbusregister.h
|
||||
index 92a2e41..3ac2518 100644
|
||||
--- a/service/sessiondbusregister.h
|
||||
+++ b/service/sessiondbusregister.h
|
||||
@@ -192,7 +192,7 @@ signals:
|
||||
|
||||
void statusChanged(QString);
|
||||
|
||||
- void fileReceivingSignal(QString,QString,QString,quint64);
|
||||
+ void fileReceivingSignal(QString,QString,QString,QString,quint64);
|
||||
|
||||
void replyFileReceivingSignal(bool);
|
||||
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 0a61b51..43aaefa 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -36,7 +36,7 @@ void BluetoothDbus::connectDBusSignals() {
|
||||
|
||||
|
||||
//文件传输相关dbus
|
||||
- CONNECT_DBUS_SIGNAL("fileReceivingSignal", receiveFilesSlot(QString,QString,QString,quint64));
|
||||
+ CONNECT_DBUS_SIGNAL("fileReceivingSignal", receiveFilesSlot(QString,QString,QString,QString,quint64));
|
||||
TRANSFER_DBUS_SIGNAL("obexAgentCanceled", obexAgentCanceledSignal());
|
||||
TRANSFER_DBUS_SIGNAL("fileReceiveMore", fileReceiveMore(QString, quint64, QString));
|
||||
TRANSFER_DBUS_SIGNAL("sendTransferFilesMesg", sendTransferFilesMesgSignal(QStringList));
|
||||
@@ -127,9 +127,10 @@ void BluetoothDbus::devErrorSignalSLot(QString a) {
|
||||
qDebug() << "-----------------------" << a;
|
||||
}
|
||||
|
||||
-void BluetoothDbus::receiveFilesSlot(QString destination, QString filename, QString source, quint64 size) {
|
||||
+void BluetoothDbus::receiveFilesSlot(QString destination, QString filename, QString type, QString source, quint64 size) {
|
||||
emit receiveFilesSignal(pairedDevice.value(destination).at(0),
|
||||
filename,
|
||||
+ type,
|
||||
source,
|
||||
size);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.h b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
index 3ca8036..556b62a 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
signals:
|
||||
void powerChangedSignal(bool);
|
||||
void displayPasskeySignal(QString,QString);
|
||||
- void receiveFilesSignal(QString,QString,QString,quint64);
|
||||
+ void receiveFilesSignal(QString,QString,QString,QString,quint64);
|
||||
void requestConfirmationSignal(QString,QString);
|
||||
void transferredChangedSignal(quint64);
|
||||
void statusChangedSignal(QString);
|
||||
@@ -109,7 +109,7 @@ private slots:
|
||||
void devErrorSignalSLot(QString);
|
||||
void devNameChangedSignalSLot(QString address, QString name);
|
||||
void devBatteryChangedSignalSLot(QString address, QString battery);
|
||||
- void receiveFilesSlot(QString destination, QString filename, QString source, quint64 size);
|
||||
+ void receiveFilesSlot(QString destination, QString filename, QString type, QString source, quint64 size);
|
||||
};
|
||||
|
||||
#endif // BLUETOOTHDBUS_H
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index b83fa7d..760c671 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "filereceivingpopupwidget.h"
|
||||
#include "config/xatom-helper.h"
|
||||
|
||||
-FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString filename, QString root, quint64 size):
|
||||
+FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString filename, QString type, QString root, quint64 size):
|
||||
target_name(devname),
|
||||
target_source(filename),
|
||||
+ target_type(type),
|
||||
root_address(root),
|
||||
target_size(size)
|
||||
{
|
||||
@@ -72,26 +73,32 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
this->close();
|
||||
});
|
||||
QIcon fileicon;
|
||||
- if (target_source.contains("."))
|
||||
- {
|
||||
- if (target_source.contains(".jpg", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".png", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".svg", Qt::CaseInsensitive)){
|
||||
- fileicon = QIcon::fromTheme("image");
|
||||
- }else if (target_source.contains(".mp4", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".mkv", Qt::CaseInsensitive))
|
||||
- fileicon = QIcon::fromTheme("video-x-generic");
|
||||
- if (target_source.contains(".txt", Qt::CaseInsensitive))
|
||||
- fileicon = QIcon::fromTheme("text-plain");
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
- }
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme("text-plain");
|
||||
+ if (target_type.split("/").at(0) == "image"){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ if (fileicon.isNull()) {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else if (target_type.split("/").at(0) == "video")
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ else if (target_type.split("/").at(0) == "audio" ||
|
||||
+ target_type.split("/").at(0) == "application" ||
|
||||
+ target_type.split("/").at(0) == "text" ||
|
||||
+ target_type.split("/").at(0) == "inode"){
|
||||
+ if (QIcon::hasThemeIcon(target_type.split("/").join("-"))) {
|
||||
+ fileicon = QIcon::fromTheme(target_type.split("/").join("-"));
|
||||
+ qDebug() << target_type.split("/").join("-");
|
||||
+ } else {
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme("text-plain");
|
||||
+ }
|
||||
+ }else
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
file_source->setGeometry(32,52,460,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
@@ -198,10 +205,41 @@ void FileReceivingPopupWidget::updateUI(QString name, quint64 size, QString type
|
||||
unitcount++;
|
||||
}
|
||||
qDebug() << type;
|
||||
+ target_type = type;
|
||||
target_source = name;
|
||||
+ QIcon fileicon;
|
||||
+ if (target_type.split("/").at(0) == "image"){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ if (fileicon.isNull()) {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else if (target_type.split("/").at(0) == "video")
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ else if (target_type.split("/").at(0) == "audio" ||
|
||||
+ target_type.split("/").at(0) == "application" ||
|
||||
+ target_type.split("/").at(0) == "text" ||
|
||||
+ target_type.split("/").at(0) == "inode"){
|
||||
+ if (QIcon::hasThemeIcon(target_type.split("/").join("-"))) {
|
||||
+ fileicon = QIcon::fromTheme(target_type.split("/").join("-"));
|
||||
+ qDebug() << target_type.split("/").join("-");
|
||||
+ } else {
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme("text-plain");
|
||||
+ }
|
||||
+ }else
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
file_name->setText(fileName);
|
||||
file_size->setText(QString::asprintf("%.2f", calc_size) + unitString[unitcount]);
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", is receiving... \(has recieved ")+QString::number(fileNums)+tr(" files\)"));
|
||||
+ this->update();
|
||||
}
|
||||
|
||||
void FileReceivingPopupWidget::configuration_transfer_progress_bar(quint64 value)
|
||||
@@ -323,46 +361,6 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
receiveTimer->stop();
|
||||
} else
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", is receiving..."));
|
||||
- QString filePathName = QDir::homePath()+"/.cache/obexd/"+target_source;
|
||||
- GError *error;
|
||||
- qDebug() << Q_FUNC_INFO << filePathName;
|
||||
- GFile *file = g_file_new_for_path(filePathName.toStdString().c_str());
|
||||
- GFileInfo *file_info = g_file_query_info(file,"*",G_FILE_QUERY_INFO_NONE,NULL,&error);
|
||||
- qDebug() << Q_FUNC_INFO << g_file_info_get_size(file_info) << g_file_info_get_content_type(file_info);
|
||||
- qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
-
|
||||
- QString str = g_file_info_get_content_type(file_info);
|
||||
- qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QIcon fileicon;
|
||||
- if (str.split("/").at(0) == "image"){
|
||||
- fileicon = QIcon::fromTheme("image");
|
||||
- if (fileicon.isNull()) {
|
||||
- fileicon = QIcon::fromTheme("text");
|
||||
- }
|
||||
- }else if (str.split("/").at(0) == "video")
|
||||
- fileicon = QIcon::fromTheme("video-x-generic");
|
||||
- else if (str.split("/").at(0) == "audio" ||
|
||||
- str.split("/").at(0) == "application" ||
|
||||
- str.split("/").at(0) == "text" ||
|
||||
- str.split("/").at(0) == "inode"){
|
||||
- if (QIcon::hasThemeIcon(str.split("/").join("-"))) {
|
||||
- fileicon = QIcon::fromTheme(str.split("/").join("-"));
|
||||
- qDebug() << str.split("/").join("-");
|
||||
- } else {
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme("text-plain");
|
||||
- }
|
||||
- }else
|
||||
- fileicon = QIcon::fromTheme("text");
|
||||
- qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
- this->update();
|
||||
cancel_btn->disconnect();
|
||||
cancel_btn->connect(cancel_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->cancel();
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
index f2dfe43..c2d8626 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
@@ -45,7 +45,7 @@ class FileReceivingPopupWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
- explicit FileReceivingPopupWidget(QString devname = "", QString filename = "", QString root = "", quint64 size = 0);
|
||||
+ explicit FileReceivingPopupWidget(QString devname = "", QString filename = "", QString type = "", QString root = "", quint64 size = 0);
|
||||
~FileReceivingPopupWidget();
|
||||
void configuration_transfer_progress_bar(quint64);
|
||||
void window_pop_up_animation();
|
||||
@@ -89,6 +89,7 @@ private:
|
||||
QString target_address;
|
||||
QString target_name;
|
||||
QString target_source;
|
||||
+ QString target_type;
|
||||
QString root_address;
|
||||
QString file_path;
|
||||
quint64 target_size;
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 1db6210..c36eb55 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -257,6 +257,7 @@ void BluetoothFileTransferWidget::Get_fie_type(int i)
|
||||
file_size.push_back(g_format_size_full(g_file_info_get_size(file_info),G_FORMAT_SIZE_IEC_UNITS));
|
||||
_filesize.push_back(g_file_info_get_size(file_info));
|
||||
QString str = g_file_info_get_content_type(file_info);
|
||||
+ filetype.push_back(str);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
QIcon fileicon;
|
||||
if (str.split("/").at(0) == "image"){
|
||||
@@ -335,6 +336,7 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
QList<QIcon> fileIconList;
|
||||
QList<quint64> _fileSizeList;
|
||||
QList<QString> fileSizeList;
|
||||
+ QList<QString> filetypeList;
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
GError *error;
|
||||
qDebug() << Q_FUNC_INFO << fileList.at(i);
|
||||
@@ -346,6 +348,7 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
fileSizeList.push_back(g_format_size_full(g_file_info_get_size(file_info),G_FORMAT_SIZE_IEC_UNITS));
|
||||
_fileSizeList.push_back(g_file_info_get_size(file_info));
|
||||
QString str = g_file_info_get_content_type(file_info);
|
||||
+ filetypeList.push_back(str);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
QIcon fileicon;
|
||||
if (str.split("/").at(0) == "image"){
|
||||
@@ -369,6 +372,7 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
fileIconList.push_back(fileicon);
|
||||
}
|
||||
+ filetype.append(filetypeList);
|
||||
file_icon.append(fileIconList);
|
||||
file_size.append(fileSizeList);
|
||||
_filesize.append(_fileSizeList);
|
||||
@@ -396,7 +400,7 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
qDebug() << Q_FUNC_INFO << status;
|
||||
if(status == QString("Complete")){
|
||||
if (selectedFiles.size() > 1) {
|
||||
- emit continueSendFiles(selectedFiles.at(1));
|
||||
+ emit continueSendFiles(selectedFiles.at(1) + QString(" ") + filetype.at(1));
|
||||
selectedFiles.pop_front();
|
||||
file_size.pop_front();
|
||||
file_icon.pop_front();
|
||||
@@ -544,6 +548,6 @@ void BluetoothFileTransferWidget::onClicked_OK_Btn()
|
||||
|
||||
}else{
|
||||
Initialize_and_start_animation();
|
||||
- emit this->sender_dev_name(dev_widget->get_seleter_device());
|
||||
+ emit this->sender_dev_name(dev_widget->get_seleter_device(), filetype.at(0));
|
||||
}
|
||||
}
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
index de34eea..725be3b 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
int get_send_data_state();
|
||||
|
||||
signals:
|
||||
- void sender_dev_name(QString);
|
||||
+ void sender_dev_name(QString, QString);
|
||||
void close_the_pre_session();
|
||||
void continueSendFiles(QString);
|
||||
public slots:
|
||||
@@ -132,6 +132,7 @@ private:
|
||||
QStringList selectedFiles;
|
||||
QList<QString> file_size;
|
||||
QList<quint64> _filesize;
|
||||
+ QList<QString> filetype;
|
||||
QString dev_name;
|
||||
SEND_DATA_STATE send_state = _SEND_NONE;
|
||||
bool is_Intel;
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index 79e8727..493f1e4 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -65,18 +65,18 @@ void MainProgram::gsettingsChangedSlot(const QString &key)
|
||||
}
|
||||
}
|
||||
|
||||
-void MainProgram::sendFiles(QString address) {
|
||||
- _sessionDbus->sendFiles(address, selectedFiles.at(0));
|
||||
+void MainProgram::sendFiles(QString address, QString type) {
|
||||
+ _sessionDbus->sendFiles(address, selectedFiles.at(0) + QString(" ") + type);
|
||||
}
|
||||
|
||||
void MainProgram::closeSession() {
|
||||
_sessionDbus->closeSession();
|
||||
}
|
||||
|
||||
-void MainProgram::receiveFileSlot(QString devname, QString filename, QString source, quint64 size)
|
||||
+void MainProgram::receiveFileSlot(QString devname, QString filename, QString type, QString source, quint64 size)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- receiving_widget = new FileReceivingPopupWidget(devname,filename,source, size);
|
||||
+ receiving_widget = new FileReceivingPopupWidget(devname, filename, type, source, size);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
connect(receiving_widget, &FileReceivingPopupWidget::clearOldSession, _sessionDbus, &BluetoothDbus::clearOldSession);
|
||||
connect(_sessionDbus, &BluetoothDbus::fileReceiveMore, receiving_widget, &FileReceivingPopupWidget::updateUI);
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.h b/ukui-bluetooth/main/mainprogram.h
|
||||
index cb4b6ca..3b993e7 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.h
|
||||
+++ b/ukui-bluetooth/main/mainprogram.h
|
||||
@@ -45,13 +45,13 @@ public:
|
||||
|
||||
private slots:
|
||||
void closeSession();
|
||||
- void sendFiles(QString address);
|
||||
+ void sendFiles(QString address, QString type);
|
||||
|
||||
private slots:
|
||||
void gsettingsChangedSlot(const QString &);
|
||||
void sendTransferFilesMesgSlot(QStringList);
|
||||
void sendTransferDeviceMesgSlot(QString address);
|
||||
- void receiveFileSlot(QString name, QString filename, QString source, quint64 size);
|
||||
+ void receiveFileSlot(QString name, QString filename, QString type, QString source, quint64 size);
|
||||
void displayPasskeySlot(QString name, QString passkey);
|
||||
void requestConfirmationSlot(QString name, QString passkey);
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 84a63a9..2736f5f 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -281,6 +281,7 @@ void Daemon::initBluezManager()
|
||||
::rebootFlag = false;
|
||||
}
|
||||
}
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << " ::rebootFlag " << ::rebootFlag;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -322,7 +323,7 @@ void Daemon::initBluezManager()
|
||||
else
|
||||
::resetFlag = false;
|
||||
}
|
||||
-
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << " ::resetFlag " << ::resetFlag;
|
||||
});
|
||||
|
||||
registerBluezAgent();
|
||||
@@ -506,7 +507,7 @@ BluezQt::AdapterPtr Daemon::getDefualtAdapter()
|
||||
}
|
||||
}
|
||||
}
|
||||
- qWarning("get bluetooth adapter end!!!");
|
||||
+ qWarning("get bluetooth adapter nullptr!!! adaptersize<%d>", _BluezManager->adapters().size());
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 5fe86bd..2b38703 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -304,6 +304,8 @@ void SessionDbusRegister::setDefaultAdapterPower(bool v)
|
||||
if (!Daemon::_DefualtAdapter.isNull()) {
|
||||
if (Daemon::_BluezManager && Daemon::_BluezManager->isBluetoothBlocked())
|
||||
Daemon::_BluezManager->setBluetoothBlocked(false);
|
||||
+
|
||||
+ qDebug() << Q_FUNC_INFO << "setDefaultAdapterPower" << v << __LINE__;
|
||||
Daemon::_DefualtAdapter.data()->setPowered(v)->errorText();
|
||||
}
|
||||
}
|
||||
@@ -611,7 +613,7 @@ QStringList SessionDbusRegister::getDefaultAdapterCacheDevAddress()
|
||||
{
|
||||
QStringList CacheDevList;
|
||||
CacheDevList.clear();
|
||||
- if (Daemon::_BluezManager) {
|
||||
+ if (!Daemon::_DefualtAdapter.isNull()) {
|
||||
for (auto item : Daemon::_DefualtAdapter.data()->devices()) {
|
||||
CacheDevList.append(item.data()->address());
|
||||
}
|
||||
@@ -722,7 +724,7 @@ void SessionDbusRegister::connectSignal()
|
||||
}
|
||||
else{
|
||||
if(adapter->isPowered()){
|
||||
- qDebug() << Q_FUNC_INFO << "adapter->isPowered() true, emit false" << __LINE__;
|
||||
+ qDebug() << Q_FUNC_INFO << "adapter->isPowered() true" << __LINE__;
|
||||
static_bluezreboot_power = 1;
|
||||
}
|
||||
else{
|
||||
@@ -759,7 +761,9 @@ void SessionDbusRegister::connectSignal()
|
||||
if (::resetFlag || ::rebootFlag) {
|
||||
QTimer::singleShot(100,this,[=]{
|
||||
Daemon::_DefualtAdapter.data()->setPowered(false);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
});
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__<< ::resetFlag << ::rebootFlag;
|
||||
::resetFlag = false;
|
||||
::rebootFlag = false;
|
||||
}
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index 7c97374..f212edf 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
-#include "bluetoothmain.h"
|
||||
+#include "bluetoothmain.h"
|
||||
|
||||
#include "bluetoothdbusservice.h"
|
||||
#include "devicebase.h"
|
||||
@@ -1742,11 +1742,17 @@ void BlueToothMain::refreshUIWhenAdapterChanged()
|
||||
//==============初始化蓝牙信息和基础信息====================================
|
||||
bluetooth_name->set_dev_name(m_default_adapter_name);
|
||||
|
||||
+
|
||||
+
|
||||
qDebug() << Q_FUNC_INFO << "m_current_adapter_power_swtich:" << m_current_adapter_power_swtich ;
|
||||
if(m_current_adapter_power_swtich)
|
||||
{
|
||||
if (!m_open_bluetooth_btn->isChecked())
|
||||
+ {
|
||||
+ //添加标识,从蓝牙服务获取的数据
|
||||
+ m_service_dbus_adapter_power_change_flag = true;
|
||||
m_open_bluetooth_btn->setChecked(true);
|
||||
+ }
|
||||
// bluetooth_name->setVisible(true);
|
||||
frame_middle->setVisible(m_myDev_show_flag);
|
||||
if (!frame_bottom->isVisible() && frame_bottom->children().size())
|
||||
@@ -1755,7 +1761,11 @@ void BlueToothMain::refreshUIWhenAdapterChanged()
|
||||
else
|
||||
{
|
||||
if (m_open_bluetooth_btn->isChecked())
|
||||
+ {
|
||||
+ //添加标识,从蓝牙服务获取的数据
|
||||
+ m_service_dbus_adapter_power_change_flag = true;
|
||||
m_open_bluetooth_btn->setChecked(false);
|
||||
+ }
|
||||
// bluetooth_name->setVisible(false);
|
||||
frame_bottom->setVisible(false);
|
||||
frame_middle->setVisible(false);
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 808e5d8..9c8f208 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -267,6 +267,7 @@ void BluetoothDbus::setDefaultAdapterPower(bool power) {
|
||||
SYSTEMD_INTERFACE,
|
||||
"setDefaultAdapterPower");
|
||||
m << power;
|
||||
+ qDebug() << " setDefaultAdapterPower " << power << __LINE__;
|
||||
QDBusConnection::sessionBus().call(m, QDBus::NoBlock);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 9342c48..9dcb9ea 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -407,6 +407,16 @@ void Daemon::fileTransferSessionCreator(QString address,QString filename)
|
||||
map["Source"] = _DefualtAdapter->address();
|
||||
map["Target"] = "OPP";
|
||||
|
||||
+ if (!_ObexManager->isOperational()) {
|
||||
+ connect(_ObexManager, &BluezQt::ObexManager::operationalChanged, this, [=](bool operational) {
|
||||
+ Q_UNUSED(operational)
|
||||
+ fileTransferSessionCreator(address, filename);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ disconnect(_ObexManager, &BluezQt::ObexManager::operationalChanged, nullptr, nullptr);
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
BluezQt::PendingCall *target = _ObexManager->createSession(address,map);
|
||||
qDebug() << Q_FUNC_INFO << target->error() << target->errorText();
|
||||
connect(target,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *call){
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 9388d01..6e6c1a9 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -64,7 +64,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
close_btn->setFixedSize(30,30);
|
||||
close_btn->setGeometry(484,4,30,30);
|
||||
connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- emit this->close_the_pre_session();
|
||||
+ emit close_the_pre_session();
|
||||
this->close();
|
||||
});
|
||||
|
||||
@@ -495,7 +495,6 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
tranfer_status_text->setVisible(true);
|
||||
|
||||
cancel_btn->setText(tr("OK"));
|
||||
- emit this->close_the_pre_session();
|
||||
}
|
||||
|
||||
int BluetoothFileTransferWidget::get_send_data_state()
|
|
@ -0,0 +1,105 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 0afc86c..1a225cb 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -323,6 +323,66 @@ void BluetoothFileTransferWidget::init_m_progressbar_value(quint64 value)
|
||||
m_progressbar->setValue(0);
|
||||
}
|
||||
|
||||
+void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
+ QList<QIcon> fileIconList;
|
||||
+ QList<quint64> _fileSizeList;
|
||||
+ QList<QString> fileSizeList;
|
||||
+ for (int i = 0; i < fileList.size(); i++) {
|
||||
+ GError *error;
|
||||
+ qDebug() << Q_FUNC_INFO << fileList.at(i);
|
||||
+ GFile *file = g_file_new_for_path(fileList.at(i).toStdString().c_str());
|
||||
+ GFileInfo *file_info = g_file_query_info(file,"*",G_FILE_QUERY_INFO_NONE,NULL,&error);
|
||||
+ qDebug() << Q_FUNC_INFO << g_file_info_get_size(file_info) << g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+
|
||||
+ fileSizeList.push_back(g_format_size_full(g_file_info_get_size(file_info),G_FORMAT_SIZE_IEC_UNITS));
|
||||
+ _fileSizeList.push_back(g_file_info_get_size(file_info));
|
||||
+ QString str = g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ QIcon fileicon;
|
||||
+ if (str.split("/").at(0) == "image"){
|
||||
+ fileicon = QIcon(fileList.at(i));
|
||||
+ if (fileicon.isNull()) {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else if (str.split("/").at(0) == "video")
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ else if (str.split("/").at(0) == "audio" ||
|
||||
+ str.split("/").at(0) == "application" ||
|
||||
+ str.split("/").at(0) == "text" ||
|
||||
+ str.split("/").at(0) == "inode"){
|
||||
+ if (QIcon::hasThemeIcon(str.split("/").join("-"))) {
|
||||
+ fileicon = QIcon::fromTheme(str.split("/").join("-"));
|
||||
+ } else {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ fileIconList.push_back(fileicon);
|
||||
+ }
|
||||
+ file_icon.append(fileIconList);
|
||||
+ file_size.append(fileSizeList);
|
||||
+ _filesize.append(_fileSizeList);
|
||||
+ selectedFiles.append(fileList);
|
||||
+ fileNums += fileList.size();
|
||||
+ if (selectedFiles.size() == 1)
|
||||
+ target_name->setText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1));
|
||||
+ else if(selectedFiles.size() > 1)
|
||||
+ {
|
||||
+ target_name->setText("\""
|
||||
+ +selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1)
|
||||
+ +"\""
|
||||
+ +tr(" and ")
|
||||
+ +QString::number(selectedFiles.size())
|
||||
+ +tr(" files more"));
|
||||
+ }
|
||||
+ int transfing = fileNums - selectedFiles.size() + 1;
|
||||
+ transNum->setText(QString::number(transfing)+"/"+QString::number(fileNums));
|
||||
+ this->update();
|
||||
+}
|
||||
+
|
||||
+
|
||||
void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << status;
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
index ca2be60..de34eea 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
void Initialize_and_start_animation();
|
||||
void init_m_progressbar_value(quint64);
|
||||
void tranfer_error();
|
||||
+ void insertNewFileList(QStringList fileList);
|
||||
|
||||
int get_send_data_state();
|
||||
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index acffbc4..0472ca2 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -196,6 +196,8 @@ void MainProgram::sendTransferDeviceMesgSlot(QString address)
|
||||
connect(_sessionDbus,&BluetoothDbus::statusChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::get_transfer_status);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::continueSendFiles,_sessionDbus,&BluetoothDbus::continueSendFiles);
|
||||
fileSendWidget->show();
|
||||
+ } else {
|
||||
+ fileSendWidget->insertNewFileList(selectedFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,6 +240,8 @@ void MainProgram::sendTransferFilesMesgSlot(QStringList targetList)
|
||||
connect(_sessionDbus,&BluetoothDbus::statusChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::get_transfer_status);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::continueSendFiles,_sessionDbus,&BluetoothDbus::continueSendFiles);
|
||||
fileSendWidget->show();
|
||||
+ } else {
|
||||
+ fileSendWidget->insertNewFileList(selectedFiles);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index d3b22f2..c3ad860 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -785,7 +785,7 @@ bool BlueToothMain::whetherToAddCurrentInterface(bluetoothdevice * device)
|
||||
case DevTypeShow::Audio:
|
||||
if (device->getDevType() == bluetoothdevice::DEVICE_TYPE::headset ||
|
||||
device->getDevType() == bluetoothdevice::DEVICE_TYPE::headphones ||
|
||||
- device->getDevType() == bluetoothdevice::DEVICE_TYPE::audioVideo) {
|
||||
+ device->getDevType() == bluetoothdevice::DEVICE_TYPE::audiovideo) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -816,7 +816,7 @@ bool BlueToothMain::whetherToAddCurrentInterface(bluetoothdevice * device)
|
||||
default:
|
||||
if (device->getDevType() == bluetoothdevice::DEVICE_TYPE::headset ||
|
||||
device->getDevType() == bluetoothdevice::DEVICE_TYPE::headphones ||
|
||||
- device->getDevType() == bluetoothdevice::DEVICE_TYPE::audioVideo ||
|
||||
+ device->getDevType() == bluetoothdevice::DEVICE_TYPE::audiovideo ||
|
||||
device->getDevType() == bluetoothdevice::DEVICE_TYPE::phone ||
|
||||
device->getDevType() == bluetoothdevice::DEVICE_TYPE::mouse ||
|
||||
device->getDevType() == bluetoothdevice::DEVICE_TYPE::keyboard ||
|
||||
@@ -1985,7 +1985,7 @@ void BlueToothMain::addDiscoverDevListByFlag(BlueToothMain::DevTypeShow flag)
|
||||
case DevTypeShow::Audio:
|
||||
if (dev->getDevType() == bluetoothdevice::DEVICE_TYPE::headset ||
|
||||
dev->getDevType() == bluetoothdevice::DEVICE_TYPE::headphones ||
|
||||
- dev->getDevType() == bluetoothdevice::DEVICE_TYPE::audioVideo) {
|
||||
+ dev->getDevType() == bluetoothdevice::DEVICE_TYPE::audiovideo) {
|
||||
addOneBluetoothDeviceItemUi(dev);
|
||||
}
|
||||
break;
|
||||
@@ -2008,7 +2008,7 @@ void BlueToothMain::addDiscoverDevListByFlag(BlueToothMain::DevTypeShow flag)
|
||||
case DevTypeShow::Other:
|
||||
if (dev->getDevType() == bluetoothdevice::DEVICE_TYPE::headset ||
|
||||
dev->getDevType() == bluetoothdevice::DEVICE_TYPE::headphones ||
|
||||
- dev->getDevType() == bluetoothdevice::DEVICE_TYPE::audioVideo ||
|
||||
+ dev->getDevType() == bluetoothdevice::DEVICE_TYPE::audiovideo ||
|
||||
dev->getDevType() == bluetoothdevice::DEVICE_TYPE::phone ||
|
||||
dev->getDevType() == bluetoothdevice::DEVICE_TYPE::mouse ||
|
||||
dev->getDevType() == bluetoothdevice::DEVICE_TYPE::keyboard ||
|
||||
diff --git a/ukcc-bluetooth/devicebase.h b/ukcc-bluetooth/devicebase.h
|
||||
index 543281f..1f38ca0 100644
|
||||
--- a/ukcc-bluetooth/devicebase.h
|
||||
+++ b/ukcc-bluetooth/devicebase.h
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
/** The device is a headphones. */
|
||||
headphones,
|
||||
/** The device is an uncategorized audio video device. */
|
||||
- audioVideo,
|
||||
+ audiovideo,
|
||||
/** The device is a keyboard. */
|
||||
keyboard,
|
||||
/** The device is a mouse. */
|
||||
diff --git a/ukcc-bluetooth/deviceinfoitem.cpp b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
index efd52a7..bf40f45 100644
|
||||
--- a/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
+++ b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
@@ -598,7 +598,7 @@ QPixmap DeviceInfoItem::getDevTypeIcon()
|
||||
case bluetoothdevice::DEVICE_TYPE::headphones:
|
||||
iconName = "audio-headphones-symbolic";
|
||||
break;
|
||||
- case bluetoothdevice::DEVICE_TYPE::audioVideo:
|
||||
+ case bluetoothdevice::DEVICE_TYPE::audiovideo:
|
||||
iconName = "audio-speakers-symbolic";
|
||||
break;
|
||||
case bluetoothdevice::DEVICE_TYPE::keyboard:
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 87985ba..7e7f69c 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -7,8 +7,9 @@ QDevItem::QDevItem(QString address, QStringList deviceinfo, bool connected, QWid
|
||||
_Connected(connected),
|
||||
_Name(deviceinfo.at(0)),
|
||||
_Battery(deviceinfo.at(2)),
|
||||
- _Type(BluezQt::Device::stringToType(deviceinfo.at(1)))
|
||||
+ _MType(deviceinfo.at(1))
|
||||
{
|
||||
+ initMap();
|
||||
qDebug() << " get dev Battery : " << deviceinfo.at(0) << _Battery;
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
@@ -38,6 +39,17 @@ QDevItem::~QDevItem()
|
||||
|
||||
}
|
||||
|
||||
+void QDevItem::initMap() {
|
||||
+ typeMap = new QMap<QString, QIcon>();
|
||||
+ typeMap->insert(QString("phone"), QIcon::fromTheme("phone-symbolic"));
|
||||
+ typeMap->insert(QString("computer"), QIcon::fromTheme("computer-symbolic"));
|
||||
+ typeMap->insert(QString("headset"), QIcon::fromTheme("audio-headset-symbolic"));
|
||||
+ typeMap->insert(QString("headphones"), QIcon::fromTheme("audio-headphones-symbolic"));
|
||||
+ typeMap->insert(QString("audiovideo"), QIcon::fromTheme("audio-speakers-symbolic"));
|
||||
+ typeMap->insert(QString("keyboard"), QIcon::fromTheme("input-keyboard-symbolic"));
|
||||
+ typeMap->insert(QString("mouse"), QIcon::fromTheme("input-mouse-symbolic"));
|
||||
+}
|
||||
+
|
||||
void QDevItem::SendMessage(bool connected)
|
||||
{
|
||||
QString text;
|
||||
@@ -207,32 +219,9 @@ QPixmap QDevItem::getDevTypeIcon()
|
||||
if (_clicked) {
|
||||
icon = QIcon::fromTheme("ukui-loading-" + QString::number(iconFlag));
|
||||
} else {
|
||||
- switch (_Type) {
|
||||
- case BluezQt::Device::Phone:
|
||||
- icon = QIcon::fromTheme("phone-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::Computer:
|
||||
- icon = QIcon::fromTheme("computer-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::Headset:
|
||||
- icon = QIcon::fromTheme("audio-headset-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::Headphones:
|
||||
- icon = QIcon::fromTheme("audio-headphones-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::AudioVideo:
|
||||
- icon = QIcon::fromTheme("audio-speakers-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::Keyboard:
|
||||
- icon = QIcon::fromTheme("input-keyboard-symbolic");
|
||||
- break;
|
||||
- case BluezQt::Device::Mouse:
|
||||
- icon = QIcon::fromTheme("input-mouse-symbolic");
|
||||
- break;
|
||||
- default:
|
||||
- icon = QIcon::fromTheme("bluetooth-symbolic");
|
||||
- break;
|
||||
- }
|
||||
+ icon = typeMap->value(_MType);
|
||||
+ if (icon.isNull())
|
||||
+ icon = QIcon::fromTheme("bluetooth-symbolic");
|
||||
}
|
||||
return icon.pixmap(18,18);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index 837f992..a7156d8 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -54,9 +54,11 @@ protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
private:
|
||||
+ QMap<QString, QIcon> *typeMap = nullptr;
|
||||
QColor getPainterBrushColor();
|
||||
QColor getDevStatusColor();
|
||||
QPixmap getDevTypeIcon();
|
||||
+ void initMap();
|
||||
void DrawBackground(QPainter &);
|
||||
void DrawStatusIcon(QPainter &);
|
||||
void DrawBattery(QPainter &painter);
|
||||
@@ -78,9 +80,9 @@ private:
|
||||
QString _Address;
|
||||
QString _Name;
|
||||
QString _Battery;
|
||||
- BluezQt::Device::Type _Type;
|
||||
QGSettings *StyleSettings = nullptr;
|
||||
QGSettings *transparency_gsettings = nullptr;
|
||||
+ QString _MType;
|
||||
|
||||
public slots:
|
||||
void connectedChangedSlot(bool connected);
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 7e7f69c..30b6705 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -219,8 +219,9 @@ QPixmap QDevItem::getDevTypeIcon()
|
||||
if (_clicked) {
|
||||
icon = QIcon::fromTheme("ukui-loading-" + QString::number(iconFlag));
|
||||
} else {
|
||||
- icon = typeMap->value(_MType);
|
||||
- if (icon.isNull())
|
||||
+ if (typeMap->keys().contains(_MType))
|
||||
+ icon = typeMap->value(_MType);
|
||||
+ else
|
||||
icon = QIcon::fromTheme("bluetooth-symbolic");
|
||||
}
|
||||
return icon.pixmap(18,18);
|
|
@ -0,0 +1,111 @@
|
|||
Index: upstream/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
===================================================================
|
||||
--- upstream.orig/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ upstream/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -22,17 +22,24 @@ TrayWidget::TrayWidget(bool intel, Bluet
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
|
||||
- if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
+ if(QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
connect(StyleSettings,&QGSettings::changed,this,&TrayWidget::GSettingsChanges);
|
||||
}
|
||||
|
||||
const QByteArray transparency_id(TRANSPARENCY_SETTINGS);
|
||||
- if(QGSettings::isSchemaInstalled(transparency_id)){
|
||||
+ if(QGSettings::isSchemaInstalled(transparency_id)) {
|
||||
transparency_gsettings = new QGSettings(transparency_id);
|
||||
}
|
||||
- if(QGSettings::isSchemaInstalled(transparency_id)){
|
||||
- tran=transparency_gsettings->get(TRANSPARENCY_KEY).toDouble()*255;
|
||||
+ if(QGSettings::isSchemaInstalled(transparency_id)) {
|
||||
+ getTransparency();
|
||||
+ connect(transparency_gsettings,&QGSettings::changed,this,[=](QString key) {
|
||||
+ qDebug() << Q_FUNC_INFO << key;
|
||||
+ if (key == QString(TRANSPARENCY_KEY)) {
|
||||
+ getTransparency();
|
||||
+ this->update();
|
||||
+ }
|
||||
+ });
|
||||
}
|
||||
QPalette palette;
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
@@ -49,7 +56,6 @@ TrayWidget::TrayWidget(bool intel, Bluet
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("bluetooth"));
|
||||
|
||||
-
|
||||
pairedDevices = _SessionDBus->getPairedDevices();
|
||||
|
||||
InitMemberVariables();
|
||||
@@ -77,6 +83,13 @@ TrayWidget::~TrayWidget()
|
||||
|
||||
}
|
||||
|
||||
+void TrayWidget::getTransparency() {
|
||||
+ double proportion = transparency_gsettings->get(TRANSPARENCY_KEY).toDouble();
|
||||
+ proportion = ((proportion > 0.85) ? 1 : (proportion + 0.15));
|
||||
+ qDebug() << Q_FUNC_INFO << proportion;
|
||||
+ tran = proportion * 255;
|
||||
+}
|
||||
+
|
||||
void TrayWidget::openBluetoothSlot(bool v)
|
||||
{
|
||||
emit trayIconStatusChanged(v);
|
||||
@@ -157,10 +170,10 @@ void TrayWidget::setWidgetPosition()
|
||||
void TrayWidget::GSettingsChanges(const QString &key)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << key;
|
||||
- tran=transparency_gsettings->get(TRANSPARENCY_KEY).toDouble()*255;
|
||||
if(key == "styleName"){
|
||||
QPalette palette;
|
||||
QPalette pl;
|
||||
+ getTransparency();
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
_MLabel->setStyleSheet("color:black;");
|
||||
palette.setColor(QPalette::Background,QColor(255,255,255,0));
|
||||
@@ -453,22 +466,19 @@ void TrayWidget::showUI()
|
||||
}
|
||||
|
||||
void TrayWidget::paintEvent(QPaintEvent *event) {
|
||||
- QPainter p(this);
|
||||
- p.setRenderHint(QPainter::Antialiasing);
|
||||
- p.setPen(Qt::transparent);
|
||||
- const QByteArray transparency_id(TRANSPARENCY_SETTINGS);
|
||||
- if(QGSettings::isSchemaInstalled(transparency_id)){
|
||||
- tran=transparency_gsettings->get(TRANSPARENCY_KEY).toDouble()*255;
|
||||
- }
|
||||
+ Q_UNUSED(event);
|
||||
+ QPainter painter(this);
|
||||
+ painter.setRenderHint(QPainter::Antialiasing);
|
||||
+ painter.setPen(Qt::transparent);
|
||||
+ QColor col;
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
- QColor col(255,255,255,tran);
|
||||
- p.setBrush(col);
|
||||
+ col = QColor(255,255,255,tran);
|
||||
} else{
|
||||
- QColor col(35,36,38,tran);
|
||||
- p.setBrush(col);
|
||||
+ col = QColor(35,36,38,tran);
|
||||
}
|
||||
+ painter.setBrush(col);
|
||||
|
||||
QPainterPath rectPath;
|
||||
rectPath.addRoundedRect(this->rect(),12,12);
|
||||
- p.drawPath(rectPath);
|
||||
+ painter.drawPath(rectPath);
|
||||
}
|
||||
Index: upstream/ukui-bluetooth/mainwidget/traywidget.h
|
||||
===================================================================
|
||||
--- upstream.orig/ukui-bluetooth/mainwidget/traywidget.h
|
||||
+++ upstream/ukui-bluetooth/mainwidget/traywidget.h
|
||||
@@ -56,6 +56,7 @@ private:
|
||||
void InitNomalWidget();
|
||||
void InitErrorWidget();
|
||||
void clearPairedWidget();
|
||||
+ void getTransparency();
|
||||
|
||||
TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent = nullptr);
|
||||
static TrayWidget* _MSelf;
|
|
@ -0,0 +1,105 @@
|
|||
Index: ukui-bluetooth/service/daemon.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/service/daemon.cpp
|
||||
+++ ukui-bluetooth/service/daemon.cpp
|
||||
@@ -464,6 +464,7 @@ BluezQt::AdapterPtr Daemon::getDefualtAd
|
||||
if(_BluezManager->adapters().size() == 0){
|
||||
|
||||
qWarning("No bluetooth adapter !!!");
|
||||
+ return nullptr;
|
||||
|
||||
}else if(_BluezManager->adapters().size() == 1){
|
||||
|
||||
@@ -478,6 +479,9 @@ BluezQt::AdapterPtr Daemon::getDefualtAd
|
||||
return _BluezManager->adapterForAddress(_mGsetting["adapter-address-list"].toStringList().at(0));
|
||||
}
|
||||
}
|
||||
+ qWarning("No bluetooth adapter end!!!");
|
||||
+ return nullptr;
|
||||
+
|
||||
}
|
||||
|
||||
/************************************************
|
||||
@@ -545,7 +549,10 @@ void Daemon::monitorSleepSlot(bool sleep
|
||||
|
||||
QTimer::singleShot(200,this,[=]{
|
||||
_DefualtAdapter = getDefualtAdapter();
|
||||
+ qDebug() <<__FUNCTION__<< "======================================1";
|
||||
launchDbusSignal();
|
||||
+ qDebug() <<__FUNCTION__<< "======================================2";
|
||||
+
|
||||
});
|
||||
|
||||
reconnectFunc();
|
||||
@@ -604,8 +611,11 @@ void Daemon::monitorDbusSignal()
|
||||
|
||||
void Daemon::launchDbusSignal()
|
||||
{
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
QDBusInterface interface(SERVICE,PATH,INTERFACE,QDBusConnection::sessionBus());
|
||||
interface.call("connectSignal");
|
||||
+ qDebug() << Q_FUNC_INFO << "end";
|
||||
+
|
||||
}
|
||||
|
||||
void Daemon::reconnectFunc()
|
||||
@@ -616,6 +626,11 @@ void Daemon::reconnectFunc()
|
||||
qInfo() << "reconnect dev list" << target_list;
|
||||
qDebug() << Q_FUNC_INFO << target_list;
|
||||
foreach (QString dev_address, target_list) {
|
||||
+ if (nullptr == _DefualtAdapter)
|
||||
+ {
|
||||
+ qInfo() << Q_FUNC_INFO << "_DefualtAdapter is null!!";
|
||||
+ return ;
|
||||
+ }
|
||||
BluezQt::DevicePtr dev = _DefualtAdapter->deviceForAddress(dev_address);
|
||||
|
||||
if (dev != nullptr) {
|
||||
Index: ukui-bluetooth/service/sessiondbusregister.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/service/sessiondbusregister.cpp
|
||||
+++ ukui-bluetooth/service/sessiondbusregister.cpp
|
||||
@@ -479,7 +479,17 @@ void SessionDbusRegister::openBluetoothS
|
||||
void SessionDbusRegister::connectSignal()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO ;
|
||||
+ if (nullptr == Daemon::_BluezManager)
|
||||
+ {
|
||||
+ qDebug() << Q_FUNC_INFO << "btManaher is null!" ;
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
+ if (nullptr == Daemon::_DefualtAdapter)
|
||||
+ {
|
||||
+ qDebug() << Q_FUNC_INFO << "_DefualtAdapter is null!" ;
|
||||
+ return;
|
||||
+ }
|
||||
connect(Daemon::_BluezManager,&BluezQt::Manager::adapterAdded,this,[=](BluezQt::AdapterPtr adapter){
|
||||
qDebug() << Q_FUNC_INFO << "adapterAdded" << __LINE__;
|
||||
emit adapterAddSignal(adapter.data()->address());
|
||||
Index: ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -297,7 +297,7 @@ void BluetoothDbus::getDefaultAdapterPow
|
||||
SYSTEMD_PATH,
|
||||
SYSTEMD_INTERFACE,
|
||||
"getDefaultAdapterPower");
|
||||
- QDBusMessage response = QDBusConnection::sessionBus().call(m, QDBus::NoBlock);
|
||||
+ QDBusMessage response = QDBusConnection::sessionBus().call(m);
|
||||
if (response.type() == QDBusMessage::ReplyMessage)
|
||||
{
|
||||
powered = response.arguments().takeFirst().toBool();
|
||||
Index: ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -90,7 +90,7 @@ signals:
|
||||
private:
|
||||
void connectDBusSignals();
|
||||
void addNewPairedDevice(QString address);
|
||||
- bool powered;
|
||||
+ bool powered = false;
|
||||
QMap<QString, QStringList> pairedDevice;
|
||||
QMap<QString, QString> connectedDevice;
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -316,17 +316,17 @@ void BlueToothMain::monitorBluetoothDbus
|
||||
QDBusConnection::sessionBus().connect(SERVICE,
|
||||
PATH,
|
||||
INTERFACE,
|
||||
- "devNameChangedSignal",this, SLOT(reportDevNameChangedSignal(QString,QString)));//设备mac地址+设备名称
|
||||
+ "devNameChangedSignal",this, SLOT(reportDevNameChangedSignal(QString,QString)));
|
||||
|
||||
QDBusConnection::sessionBus().connect(SERVICE,
|
||||
PATH,
|
||||
INTERFACE,
|
||||
- "devTypeChangedSignal",this, SLOT(reportDevTypeChangedSignal(QString,QString)));//设备mac地址+设备类型
|
||||
+ "devTypeChangedSignal",this, SLOT(reportDevTypeChangedSignal(QString,QString)));
|
||||
|
||||
QDBusConnection::sessionBus().connect(SERVICE,
|
||||
PATH,
|
||||
INTERFACE,
|
||||
- "devStatusChange",this, SLOT(reportDevStatusChange(QString)));//设备mac地址+设备状态
|
||||
+ "devStatusChange",this, SLOT(reportDevStatusChange(QString)));
|
||||
|
||||
}
|
||||
|
||||
@@ -1581,7 +1581,11 @@ void BlueToothMain::showBluetoothErrorMa
|
||||
errorWidgetTip0->setFont(QFont("Noto Sans CJK SC",18,QFont::Bold));
|
||||
|
||||
if (QIcon::hasThemeIcon("dialog-warning")) {
|
||||
- errorWidgetIcon->setPixmap(QIcon::fromTheme("bluetooth-error").pixmap(56,56));
|
||||
+
|
||||
+ if (isblack)
|
||||
+ errorWidgetIcon->setPixmap(ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("bluetooth-error").pixmap(56,56),"white"));
|
||||
+ else
|
||||
+ errorWidgetIcon->setPixmap(QIcon::fromTheme("bluetooth-error").pixmap(56,56));
|
||||
}
|
||||
|
||||
errorWidgetTip0->setText(tr("No Bluetooth adapter detected!"));
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.cpp
|
||||
@@ -5,8 +5,6 @@
|
||||
BluetoothNameLabel::BluetoothNameLabel(QWidget *parent, int x, int y):
|
||||
QWidget(parent)
|
||||
{
|
||||
-// qDebug() << Q_FUNC_INFO << x << y;
|
||||
-
|
||||
this->setAutoFillBackground(true);
|
||||
this->setObjectName("BluetoothNameLabel");
|
||||
this->setStyleSheet("QWidget{border: none;border-radius:2px;}");
|
||||
@@ -38,10 +36,15 @@ BluetoothNameLabel::BluetoothNameLabel(Q
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
settings = new QGSettings("org.ukui.style");
|
||||
if(settings->get("style-name").toString() == "ukui-black" || settings->get("style-name").toString() == "ukui-dark")
|
||||
+ {
|
||||
style_flag = true;
|
||||
+ icon_pencil->setPixmap(ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("document-edit-symbolic").pixmap(20,20),"white"));
|
||||
+ }
|
||||
else
|
||||
+ {
|
||||
style_flag = false;
|
||||
-
|
||||
+ icon_pencil->setPixmap(QIcon::fromTheme("document-edit-symbolic").pixmap(20,20));
|
||||
+ }
|
||||
switch (settings->get("systemFontSize").toInt()) {
|
||||
case 11:
|
||||
case 12:
|
||||
@@ -187,9 +190,15 @@ void BluetoothNameLabel::settings_change
|
||||
qDebug() << Q_FUNC_INFO <<key;
|
||||
if(key == "styleName"){
|
||||
if(settings->get("style-name").toString() == "ukui-black" || settings->get("style-name").toString() == "ukui-dark")
|
||||
+ {
|
||||
style_flag = true;
|
||||
+ icon_pencil->setPixmap(ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("document-edit-symbolic").pixmap(20,20),"white"));
|
||||
+ }
|
||||
else
|
||||
+ {
|
||||
style_flag = false;
|
||||
+ icon_pencil->setPixmap(QIcon::fromTheme("document-edit-symbolic").pixmap(20,20));
|
||||
+ }
|
||||
}else if(key == "systemFontSize"){
|
||||
QFont ft;
|
||||
ft.setPixelSize(settings->get("systemFontSize").toInt());
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothnamelabel.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QIcon>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
+#include <ukcc/widgets/imageutil.h>
|
||||
|
||||
#define DEVNAMELENGTH 30
|
||||
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
@@ -453,7 +453,8 @@ QColor DeviceInfoItem::getPainterBrushCo
|
||||
case Status::Nomal:
|
||||
|
||||
if(_themeIsBlack)
|
||||
- color = QColor("#1F2022");//("#EBEBEB");
|
||||
+ //color = QColor("#1F2022");//("#EBEBEB");
|
||||
+ color = QColor(Qt::black);//("#EBEBEB");
|
||||
else
|
||||
color = QColor(Qt::white);//("#EBEBEB");
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Index: ukui-bluetooth/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
@@ -64,7 +64,8 @@ QColor BluetoothSettingLabel::getPainter
|
||||
|
||||
void BluetoothSettingLabel::enterEvent(QEvent *event) {
|
||||
Q_UNUSED(event);
|
||||
- _MStatus = Hover;
|
||||
+ //_MStatus = Hover;
|
||||
+ _MStatus = Normal;
|
||||
this->update();
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ void BluetoothSettingLabel::paintEvent(Q
|
||||
painter.setPen(QColor(Qt::transparent));
|
||||
painter.setBrush(getPainterBrushColor());
|
||||
painter.drawRoundedRect(this->rect(),12,12,Qt::AbsoluteSize);
|
||||
+ //painter.drawRect(this->rect());
|
||||
painter.restore();
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
painter.setPen(QColor(Qt::black));
|
|
@ -0,0 +1,584 @@
|
|||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -174,6 +174,10 @@ void rfkill_exit(void)
|
||||
watch = 0;
|
||||
}
|
||||
|
||||
+const QString SERVICE = "com.ukui.bluetooth";
|
||||
+const QString PATH = "/com/ukui/bluetooth";
|
||||
+const QString INTERFACE = "com.ukui.bluetooth";
|
||||
+
|
||||
//dev-3.1 界面服务-分离
|
||||
BlueToothMain::BlueToothMain(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@@ -204,7 +208,7 @@ BlueToothMain::BlueToothMain(QWidget *pa
|
||||
}
|
||||
|
||||
//手动发起蓝牙服务连接
|
||||
- connectBluetoothServiceSignal();
|
||||
+ //connectBluetoothServiceSignal();
|
||||
|
||||
getAllAdapterData();
|
||||
|
||||
@@ -227,6 +231,7 @@ BlueToothMain::BlueToothMain(QWidget *pa
|
||||
// }
|
||||
|
||||
monitorBluetoothDbusConnection();
|
||||
+ monitorSleepSignal();
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -254,73 +259,73 @@ void BlueToothMain::monitorBluetoothDbus
|
||||
// const QString &name, QObject *receiver, const char *slot);
|
||||
//1.适配器数据上报
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"defaultAdapterChanged",this, SLOT(reportDefaultAdapterChanged(QString)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"defaultAdapterNameChanged",this, SLOT(reportDefaultAdapterNameChanged(QString)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"adapterAddSignal",this, SLOT(reportAdapterAddSignal(QString)));
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"adapterRemoveSignal",this, SLOT(reportAdapterRemoveSignal(QString)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"defaultAdapterPowerChanged",this, SLOT(reportDefaultAdapterPowerChanged(bool)));
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"defaultDiscoverableChanged",this, SLOT(reportDefaultDiscoverableChanged(bool)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"defaultScanStatusChanged",this, SLOT(reportDefaultScanStatusChanged(bool)));
|
||||
|
||||
//2.蓝牙设备数据上报
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"deviceScanResult",this, SLOT(reportDeviceScanResult(QString,QString)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devPairSignal",this, SLOT(reportDevPairSignal(QString,bool)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devConnectStatusSignal",this, SLOT(reportDevConnectStatusSignal(QString,bool)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devRemoveSignal",this, SLOT(reportDevRemoveSignal(QString)));
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devNameChangedSignal",this, SLOT(reportDevNameChangedSignal(QString,QString)));//设备mac地址+设备名称
|
||||
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
- "devTypeChangedSignal",this, SLOT(reportDevTypeChange(QString,QString)));//设备mac地址+设备类型
|
||||
-
|
||||
- QDBusConnection::sessionBus().connect("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
+ "devTypeChangedSignal",this, SLOT(reportDevTypeChangedSignal(QString,QString)));//设备mac地址+设备类型
|
||||
+
|
||||
+ QDBusConnection::sessionBus().connect(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devStatusChange",this, SLOT(reportDevStatusChange(QString)));//设备mac地址+设备状态
|
||||
|
||||
}
|
||||
@@ -429,6 +434,7 @@ void BlueToothMain::refreshBluetoothAdap
|
||||
if(1 == m_adapter_address_list.size())// ||
|
||||
//(m_adapter_address_list.size() > 0 && m_adapter_address_list.size() != m_adapter_name_list.size()))
|
||||
{
|
||||
+ m_default_bluetooth_adapter = m_bluetooth_adapter_list.at(0);
|
||||
if("normalWidget" != this->centralWidget()->objectName())
|
||||
{
|
||||
showBluetoothNormalMainWindow();
|
||||
@@ -436,7 +442,7 @@ void BlueToothMain::refreshBluetoothAdap
|
||||
if(frame_2->isVisible())
|
||||
frame_2->setVisible(false);
|
||||
frame_top->setMinimumSize(582,187);
|
||||
- frame_top->setMaximumSize(1000,187);
|
||||
+ frame_top->setMaximumSize(1800,187);
|
||||
}
|
||||
else if (m_adapter_address_list.size() > 1)
|
||||
{
|
||||
@@ -447,7 +453,7 @@ void BlueToothMain::refreshBluetoothAdap
|
||||
if(!frame_2->isVisible())
|
||||
frame_2->setVisible(true);
|
||||
frame_top->setMinimumSize(582,239);
|
||||
- frame_top->setMaximumSize(1000,239);
|
||||
+ frame_top->setMaximumSize(1800,239);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -457,6 +463,7 @@ void BlueToothMain::refreshBluetoothAdap
|
||||
}
|
||||
}
|
||||
|
||||
+ refreshUIWhenAdapterChanged();
|
||||
}
|
||||
|
||||
void BlueToothMain::addAdapterDataList(QString adapterAddress)
|
||||
@@ -856,9 +863,9 @@ void BlueToothMain::getDefaultAdapterDat
|
||||
void BlueToothMain::connectBluetoothServiceSignal()
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
iface.setTimeout(20);
|
||||
iface.call("connectSignal");
|
||||
@@ -914,9 +921,9 @@ void BlueToothMain::getAllAdapterData()
|
||||
bool BlueToothMain::getBluetoothBlock()
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -929,9 +936,9 @@ QString BlueToothMain::getDefaultAdapter
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -944,9 +951,9 @@ QStringList BlueToothMain::getAdapterDev
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -973,9 +980,9 @@ QString BlueToothMain::getAdapterName(QS
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -988,9 +995,9 @@ bool BlueToothMain::getDefaultAdapterPow
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间 ms
|
||||
iface.setTimeout(20);
|
||||
@@ -1003,12 +1010,12 @@ QStringList BlueToothMain::getDefaultAda
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间, ms
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<QStringList> reply=iface.call("getDefaultAdapterCacheDevAddress");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1018,9 +1025,9 @@ bool BlueToothMain::getDefaultAdapterDis
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1032,9 +1039,9 @@ bool BlueToothMain::getDefaultAdapterDis
|
||||
bool BlueToothMain::getDefaultAdapterScanStatus()
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1047,9 +1054,9 @@ bool BlueToothMain::getDefaultAdapterSca
|
||||
QString BlueToothMain::getDevName(QString deviceAddress)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1061,9 +1068,9 @@ QString BlueToothMain::getDevName(QStrin
|
||||
bool BlueToothMain::getDevPairStatus(QString deviceAddress)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1074,9 +1081,9 @@ bool BlueToothMain::getDevPairStatus(QSt
|
||||
bool BlueToothMain::getDevConnectStatus(QString deviceAddress)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1087,25 +1094,25 @@ bool BlueToothMain::getDevConnectStatus(
|
||||
|
||||
bluetoothdevice::DEVICE_TYPE BlueToothMain::getDeviceType(QString deviceAddress , QString devType)
|
||||
{
|
||||
- //qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
+ qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
QString dev_type_str = devType ;
|
||||
if (dev_type_str.isEmpty())
|
||||
dev_type_str = getDevType(deviceAddress);
|
||||
|
||||
- //qDebug() << Q_FUNC_INFO << "Type:" << dev_type_str << __LINE__;
|
||||
+ qDebug() << Q_FUNC_INFO << "Type:" << dev_type_str << __LINE__;
|
||||
QByteArray enum_str_to_char = dev_type_str.toLatin1();
|
||||
const char * enum_char = enum_str_to_char.data();
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<bluetoothdevice::DEVICE_TYPE>();
|
||||
- //qDebug() << Q_FUNC_INFO << "enum index:" << metaEnum.keysToValue(enum_char);
|
||||
+ qDebug() << Q_FUNC_INFO << "enum index:" << metaEnum.keysToValue(enum_char);
|
||||
|
||||
return (metaEnum.keysToValue(enum_char) == -1 ? bluetoothdevice::DEVICE_TYPE::uncategorized : bluetoothdevice::DEVICE_TYPE(metaEnum.keysToValue(enum_char)));
|
||||
}
|
||||
QString BlueToothMain::getDevType(QString deviceAddress)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.setTimeout(20);
|
||||
@@ -1119,9 +1126,9 @@ void BlueToothMain::clearAllUnPairedDevi
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- QDBusInterface iface("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusInterface iface(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
iface.call(QDBus::NoBlock, "clearAllUnPairedDevicelist");
|
||||
@@ -1138,9 +1145,9 @@ void BlueToothMain::setTrayVisible(bool
|
||||
void BlueToothMain::setBluetoothBlock(bool value)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setBluetoothBlock");
|
||||
m << value;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<bool>() <<__LINE__;
|
||||
@@ -1150,9 +1157,9 @@ void BlueToothMain::setBluetoothBlock(bo
|
||||
void BlueToothMain::setDefaultAdapterName(QString adapterName)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setDefaultAdapterName");//setBluetoothName
|
||||
m << adapterName;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
@@ -1164,9 +1171,9 @@ void BlueToothMain::setDefaultAdapterNam
|
||||
void BlueToothMain::setDefaultAdapterPower(bool value)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setDefaultAdapterPower");
|
||||
m << value;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<bool>() <<__LINE__;
|
||||
@@ -1177,9 +1184,9 @@ void BlueToothMain::setDefaultAdapterPow
|
||||
void BlueToothMain::setDefaultAdapterDiscoverable(bool value)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setDefaultAdapterDiscoverable");
|
||||
m << value;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<bool>() <<__LINE__;
|
||||
@@ -1190,9 +1197,9 @@ void BlueToothMain::setDefaultAdapterDis
|
||||
void BlueToothMain::setDefaultAdapterScanOn(bool value)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setDefaultAdapterScanOn");
|
||||
m << value;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<bool>() <<__LINE__;
|
||||
@@ -1205,9 +1212,9 @@ void BlueToothMain::receiveConnectsignal
|
||||
//停止扫描,连接完成或连接超时后继续开启扫描
|
||||
setDefaultAdapterScanOn(false);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devConnect");
|
||||
m << address;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
@@ -1218,9 +1225,9 @@ void BlueToothMain::receiveConnectsignal
|
||||
void BlueToothMain::receiveDisConnectSignal(QString address)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devDisconnect");
|
||||
m << address;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
@@ -1231,9 +1238,9 @@ void BlueToothMain::receiveDisConnectSig
|
||||
void BlueToothMain::receiveRemoveSignal(QString address)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"devRemove");
|
||||
m << address;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
@@ -1246,34 +1253,15 @@ void BlueToothMain::receiveRemoveSignal(
|
||||
void BlueToothMain::receiveSendFileSignal(QString address)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << address;
|
||||
-/*
|
||||
- QDBusMessage m = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
- "setSendTransferDeviceMesg");
|
||||
-// QList<QVariant> arg;
|
||||
-// arg.append(address);
|
||||
- // m.setArguments(arg);
|
||||
-// qDebug() << QDBusConnection::sessionBus().send(m);
|
||||
- qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
-*/
|
||||
- QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
- "/com/ukui/bluetooth",
|
||||
- "com.ukui.bluetooth",
|
||||
+ QDBusMessage m = QDBusMessage::createMethodCall(SERVICE,
|
||||
+ PATH,
|
||||
+ INTERFACE,
|
||||
"setSendTransferDeviceMesg");
|
||||
m << address;
|
||||
qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
// 发送Message
|
||||
QDBusConnection::sessionBus().call(m, QDBus::NoBlock);
|
||||
|
||||
-
|
||||
-// QDBusMessage m = QDBusMessage::createMethodCall("com.ukui.bluetooth",
|
||||
-// "/com/ukui/bluetooth",
|
||||
-// "com.ukui.bluetooth",
|
||||
-// "sendTransferDeviceMesg");
|
||||
-// m << address;
|
||||
-// qDebug() << Q_FUNC_INFO << m.arguments().at(0).value<QString>() <<__LINE__;
|
||||
-// // 发送Message
|
||||
-// QDBusMessage response = QDBusConnection::sessionBus().call(m);
|
||||
}
|
||||
|
||||
void BlueToothMain::showBluetoothNormalMainWindow()
|
||||
@@ -1517,10 +1505,15 @@ void BlueToothMain::initMainWindowbottom
|
||||
{
|
||||
delayStartDiscover_timer->stop();
|
||||
setDefaultAdapterScanOn(true);
|
||||
- if (!m_current_adapter_power_swtich)
|
||||
+
|
||||
+ QTimer::singleShot(500,this,[=]
|
||||
{
|
||||
- delayStartDiscover_timer->start();
|
||||
- }
|
||||
+ if (!m_current_adapter_scan_status)
|
||||
+ {
|
||||
+ delayStartDiscover_timer->start();
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
});
|
||||
|
||||
title_layout->addWidget(label_1);
|
||||
@@ -1560,12 +1553,14 @@ void BlueToothMain::initMainWindowbottom
|
||||
|
||||
frame_bottom->setLayout(bottom_layout);
|
||||
}
|
||||
+
|
||||
void BlueToothMain::stopAllTimer()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
if (delayStartDiscover_timer && delayStartDiscover_timer->isActive())
|
||||
delayStartDiscover_timer->stop();
|
||||
}
|
||||
+
|
||||
void BlueToothMain::showBluetoothErrorMainWindow()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
@@ -1605,6 +1600,10 @@ void BlueToothMain::showBluetoothErrorMa
|
||||
void BlueToothMain::refreshUIWhenAdapterChanged()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ if("normalWidget" != this->centralWidget()->objectName())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
// =============清空我的设备和蓝牙发现设备栏布局下的所有设备item=================
|
||||
cleanPairDevices();
|
||||
@@ -1874,6 +1873,7 @@ void BlueToothMain::monitorSleepSignal()
|
||||
|
||||
void BlueToothMain::monitorSleepSlot(bool value)
|
||||
{
|
||||
+ //connectBluetoothServiceSignal();
|
||||
if (!value) {
|
||||
if (sleep_status)
|
||||
{
|
|
@ -0,0 +1,87 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 9cafd28..94b8bb9 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -773,7 +773,14 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::deviceAdded,this,[=](BluezQt::DevicePtr devPtr){
|
||||
// qInfo() << Q_FUNC_INFO << "deviceAdded:" << devPtr->address() << ";line = "<< __LINE__ ;
|
||||
- emit deviceScanResult(devPtr.data()->address(),devPtr.data()->name(),BluezQt::Device::typeToString(devPtr.data()->type()));
|
||||
+
|
||||
+ //设备类型正常,才发送信号
|
||||
+ if(devPtr->type() != BluezQt::Device::Type::Uncategorized)
|
||||
+ {
|
||||
+ emit deviceScanResult(devPtr.data()->address(),devPtr.data()->name(),
|
||||
+ BluezQt::Device::typeToString(devPtr.data()->type()));
|
||||
+ }
|
||||
+
|
||||
|
||||
//清空信号,防止重复连接
|
||||
devPtr->disconnect();
|
||||
@@ -835,7 +842,24 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(devPtr.data(),&BluezQt::Device::typeChanged,this,[=](BluezQt::Device::Type type){
|
||||
qDebug() << Q_FUNC_INFO << "typeChanged" << devPtr.data()->address();
|
||||
- emit devTypeChangedSignal(devPtr.data()->address(),BluezQt::Device::typeToString(devPtr.data()->type()));
|
||||
+
|
||||
+ //设备类型正常,才发送信号
|
||||
+ if(devPtr->type() != BluezQt::Device::Type::Uncategorized)
|
||||
+ {
|
||||
+ emit deviceScanResult(devPtr->address(),devPtr->name(),
|
||||
+ BluezQt::Device::typeToString(devPtr->type()));
|
||||
+
|
||||
+ QTimer::singleShot(500, this, [=]
|
||||
+ {
|
||||
+ emit devTypeChangedSignal(devPtr->address(),BluezQt::Device::typeToString(devPtr->type()));
|
||||
+ });
|
||||
+ }
|
||||
+ //无蓝牙设备类型,删除设备
|
||||
+ else
|
||||
+ {
|
||||
+ emit devRemoveSignal(devPtr->address());
|
||||
+ }
|
||||
+
|
||||
});
|
||||
|
||||
connect(devPtr.data(),&BluezQt::Device::nameChanged,this,[=](const QString &name){
|
||||
@@ -916,7 +940,23 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(dev.data(),&BluezQt::Device::typeChanged,this,[=](BluezQt::Device::Type type){
|
||||
qDebug() << Q_FUNC_INFO << "typeChanged" << dev.data()->address();
|
||||
- emit devTypeChangedSignal(dev.data()->address(),BluezQt::Device::typeToString(dev.data()->type()));
|
||||
+ //设备类型正常,才发送信号
|
||||
+ if(dev->type() != BluezQt::Device::Type::Uncategorized)
|
||||
+ {
|
||||
+ emit deviceScanResult(dev->address(),dev->name(),
|
||||
+ BluezQt::Device::typeToString(dev->type()));
|
||||
+
|
||||
+ QTimer::singleShot(500, this, [=]
|
||||
+ {
|
||||
+ emit devTypeChangedSignal(dev->address(),BluezQt::Device::typeToString(dev->type()));
|
||||
+ });
|
||||
+
|
||||
+ }
|
||||
+ //无蓝牙设备类型,删除设备
|
||||
+ else
|
||||
+ {
|
||||
+ emit devRemoveSignal(dev->address());
|
||||
+ }
|
||||
});
|
||||
|
||||
connect(dev.data(),&BluezQt::Device::nameChanged,this,[=](const QString &name){
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index d85d5ec..d3b22f2 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -2240,9 +2240,9 @@ void BlueToothMain::gSettingsChanged(const QString &key)
|
||||
isblack = false;
|
||||
|
||||
if (isblack)
|
||||
- errorWidgetIcon->setPixmap(ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("bluetooth-error").pixmap(56,56),"white"));
|
||||
+ errorWidgetIcon->setPixmap(ImageUtil::drawSymbolicColoredPixmap(QIcon::fromTheme("bluetooth-disabled-symbolic").pixmap(54,88),"white"));
|
||||
else
|
||||
- errorWidgetIcon->setPixmap(QIcon::fromTheme("bluetooth-error").pixmap(56,56));
|
||||
+ errorWidgetIcon->setPixmap(QIcon::fromTheme("bluetooth-disabled-symbolic").pixmap(54,88));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/ukcc-bluetooth/deviceinfoitem.cpp b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
index 29eb44d..46df2f9 100644
|
||||
--- a/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
+++ b/ukcc-bluetooth/deviceinfoitem.cpp
|
||||
@@ -609,7 +609,7 @@ QPixmap DeviceInfoItem::getDevTypeIcon()
|
||||
iconName = "phone-symbolic";
|
||||
break;
|
||||
case bluetoothdevice::DEVICE_TYPE::computer:
|
||||
- iconName = "computer-symbolic";
|
||||
+ iconName = "video-display-symbolic";
|
||||
break;
|
||||
case bluetoothdevice::DEVICE_TYPE::headset:
|
||||
iconName = "audio-headset-symbolic";
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 051c296..7cb92e5 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -63,7 +63,7 @@ bool QDevItem::isHuaWei() {
|
||||
void QDevItem::initMap() {
|
||||
typeMap = new QMap<QString, QIcon>();
|
||||
typeMap->insert(QString("phone"), QIcon::fromTheme("phone-symbolic"));
|
||||
- typeMap->insert(QString("computer"), QIcon::fromTheme("computer-symbolic"));
|
||||
+ typeMap->insert(QString("computer"), QIcon::fromTheme("video-display-symbolic"));
|
||||
typeMap->insert(QString("headset"), QIcon::fromTheme("audio-headset-symbolic"));
|
||||
typeMap->insert(QString("headphones"), QIcon::fromTheme("audio-headphones-symbolic"));
|
||||
typeMap->insert(QString("audiovideo"), QIcon::fromTheme("audio-speakers-symbolic"));
|
|
@ -0,0 +1,35 @@
|
|||
diff --git a/debian/ukui-bluetooth.install b/debian/ukui-bluetooth.install
|
||||
index ffb99d1..b1731a2 100644
|
||||
--- a/debian/ukui-bluetooth.install
|
||||
+++ b/debian/ukui-bluetooth.install
|
||||
@@ -1,4 +1,5 @@
|
||||
ukui-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
+data/ukui-bluetooth-tray.desktop /etc/xdg/autostart/
|
||||
data/ukui-bluetooth.desktop /etc/xdg/autostart/
|
||||
ukcc-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
ukcc-bluetooth/translations/*.ts /usr/share/ukui-bluetooth/translations/
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 6dc15a3..afcf30a 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -107,10 +107,10 @@ void Daemon::sendFile(QString addr,QString filename)
|
||||
registerObexAgent();
|
||||
|
||||
if (isAddress(addr)) {
|
||||
- selected_file = QUrl(filename).path();
|
||||
+ selected_file = filename;
|
||||
qInfo() << Q_FUNC_INFO << QString("Send file : %1").arg(selected_file);
|
||||
if(!selected_file.isNull()){
|
||||
- fileTransferSessionCreator(addr,selected_file);
|
||||
+ fileTransferSessionCreator(addr, selected_file);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -341,6 +341,7 @@ void Daemon::initBluezManager()
|
||||
}
|
||||
|
||||
void Daemon::continueSendFiles(QString filename) {
|
||||
+ qDebug() << Q_FUNC_INFO << filename << __LINE__;
|
||||
BluezQt::PendingCall *transfer = opp->sendFile(filename);
|
||||
qDebug() << Q_FUNC_INFO << transfer->error() << transfer->errorText();
|
||||
connect(transfer,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *call){
|
|
@ -0,0 +1,33 @@
|
|||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 1a3b161..1993eb3 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -79,6 +79,7 @@ void BluetoothDbus::adapterAddSignalSLot(QString address) {
|
||||
|
||||
void BluetoothDbus::defaultAdapterChangedSLot(QString value) {
|
||||
qDebug() << Q_FUNC_INFO << __LINE__ << value;
|
||||
+ getDefaultAdapterPower();
|
||||
getDefaultAdapterPairedDevices();
|
||||
emit AdapterChangedSignal(value);
|
||||
}
|
||||
@@ -391,6 +392,8 @@ void BluetoothDbus::replyFileReceiving(bool v) {
|
||||
|
||||
void BluetoothDbus::getDefaultAdapterPairedDevices() {
|
||||
qDebug() << "get Default Adapter Paired Devices";
|
||||
+ pairedList.clear();
|
||||
+ pairedDevice.clear();
|
||||
QDBusMessage m = QDBusMessage::createMethodCall(SYSTEMD_SERVICE,
|
||||
SYSTEMD_PATH,
|
||||
SYSTEMD_INTERFACE,
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 6d0768d..01811fa 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -382,6 +382,7 @@ void TrayWidget::connectUISignalAndSlot()
|
||||
});
|
||||
connect(_SessionDBus,&BluetoothDbus::AdapterChangedSignal,this,[=](QString address){
|
||||
Q_UNUSED(address)
|
||||
+ _MBtn->setChecked(_SessionDBus->isPowered());
|
||||
updatePairedDev();
|
||||
});
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
diff --git a/ukui-bluetooth/component/bluetoothsettinglabel.cpp b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
index 33ac0a3..d5387c9 100644
|
||||
--- a/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
+++ b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
@@ -3,9 +3,7 @@
|
||||
BluetoothSettingLabel::BluetoothSettingLabel(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
_MStatus = Normal;
|
||||
- this->setText(tr("Bluetooth Settings"));
|
||||
this->setFixedSize(420,50);
|
||||
- this->setStyleSheet("text-align:left");
|
||||
this->setAutoFillBackground(true);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 27f069f..117379a 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -190,19 +190,21 @@ void TrayWidget::GSettingsChanges(const QString &key)
|
||||
if(key == "styleName"){
|
||||
QPalette palette;
|
||||
QPalette pl;
|
||||
+ QPalette _pl;
|
||||
getTransparency();
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
- _MLabel->setStyleSheet("color:black;");
|
||||
+ _pl.setColor(QPalette::WindowText,Qt::black);
|
||||
palette.setColor(QPalette::Background,QColor(255,255,255,0));
|
||||
pl.setColor(QPalette::WindowText, QColor(0,0,0,20));
|
||||
}else{
|
||||
- _MLabel->setStyleSheet("color:white;");
|
||||
QColor col(QPalette::Base);
|
||||
col.setAlpha(tran);
|
||||
+ _pl.setColor(QPalette::WindowText,Qt::white);
|
||||
palette.setColor(QPalette::Background, col);
|
||||
pl.setColor(QPalette::WindowText, QColor(255,255,255,50));
|
||||
}
|
||||
this->setPalette(palette);
|
||||
+ _MLabel->setPalette(_pl);
|
||||
lineFrame->setPalette(pl);
|
||||
lineFrame2->setPalette(pl);
|
||||
this->update();
|
||||
@@ -240,12 +242,14 @@ void TrayWidget::InitMemberVariables()
|
||||
_MStackedWidget->setCurrentIndex(0);
|
||||
|
||||
_MLabel->resize(60,32);
|
||||
- _MLabel->setText(tr("Bluetooth"));
|
||||
+ QPalette _pl;
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
- _MLabel->setStyleSheet("color:black;");
|
||||
+ _pl.setColor(QPalette::WindowText, Qt::black);
|
||||
}else{
|
||||
- _MLabel->setStyleSheet("color:white;");
|
||||
+ _pl.setColor(QPalette::WindowText, Qt::white);
|
||||
}
|
||||
+ _MLabel->setPalette(_pl);
|
||||
+ _MLabel->setText(tr("Bluetooth"));
|
||||
|
||||
_MMainLayout->setMargin(0);
|
||||
_MMainLayout->setContentsMargins(0,0,0,0);
|
|
@ -0,0 +1,88 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 92b02e3..eb99fb2 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -24,7 +24,6 @@ QDevItem::QDevItem(QString address, QStringList deviceinfo, bool connected, QWid
|
||||
tran=transparency_gsettings->get(TRANSPARENCY_KEY).toDouble()*255;
|
||||
}
|
||||
|
||||
- this->setToolTip(_Name);
|
||||
this->setFixedSize(404,50);
|
||||
this->setObjectName(address);
|
||||
_MStatus = Status::Nomal;
|
||||
@@ -280,10 +279,25 @@ void QDevItem::DrawText(QPainter &painter)
|
||||
fontSize = 15;
|
||||
if (fontSize < 10)
|
||||
fontSize = 10;
|
||||
- if (_Name.size() > FontTable[fontSize - 10]) {
|
||||
- nName.remove(FontTable[fontSize - 10], _Name.size() - FontTable[fontSize - 10]);
|
||||
- nName.append("...");
|
||||
+ float shownum = 0;
|
||||
+ for (int i = 0; i < _Name.size(); i++) {
|
||||
+ QChar ch = _Name.at(i);
|
||||
+ ushort uNum = ch.unicode();
|
||||
+ if ((uNum >= 0x4E00 && uNum <= 0x9FA5))
|
||||
+ shownum += 1.7;
|
||||
+ else if (ch == 'm' || ch == 'M')
|
||||
+ shownum += 1.5;
|
||||
+ else
|
||||
+ shownum += 1;
|
||||
+ if (shownum + 1.5 >= FontTable[fontSize - 10]) {
|
||||
+ nName.remove(i, _Name.size() - i);
|
||||
+ nName.append("...");
|
||||
+ this->setToolTip(_Name);
|
||||
+ break;
|
||||
+ }
|
||||
+ qDebug() << "======================" << shownum << i;
|
||||
}
|
||||
+
|
||||
painter.drawText(62,12,260,28,Qt::AlignLeft, nName);
|
||||
painter.restore();
|
||||
}
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index c26d063..c5d3b4d 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
int FontTable[6] = {32, 30, 26, 24, 23, 22};
|
||||
|
||||
QDevItem(QString address, QStringList deviceinfo, bool connected, QWidget *parent = nullptr);
|
||||
- QDevItem(QWidget *parent);
|
||||
~QDevItem();
|
||||
const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color);
|
||||
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 6fce211..8126abb 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -290,9 +290,9 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
if (dev_widget->get_seleter_dev_name().size() > 30) {
|
||||
Name.remove(30, dev_widget->get_seleter_dev_name().size() - 30);
|
||||
Name.append("...");
|
||||
+ tip_text->setToolTip(dev_widget->get_seleter_dev_name());
|
||||
}
|
||||
tip_text->setText(tr("Transferring to \"")+Name+"\"");
|
||||
- tip_text->setToolTip(dev_widget->get_seleter_dev_name());
|
||||
tip_text->update();
|
||||
|
||||
ok_btn->setVisible(false);
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index c02e4b4..c240edf 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -188,6 +188,7 @@ void PinCodeWidget::updateUIInfo(const QString &name, const QString &pin)
|
||||
if (name.size() > 30) {
|
||||
Name.remove(30, name.size() - 30);
|
||||
Name.append("...");
|
||||
+ tip_label->setToolTip(name);
|
||||
}
|
||||
if(show_flag)
|
||||
tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
@@ -195,7 +196,6 @@ void PinCodeWidget::updateUIInfo(const QString &name, const QString &pin)
|
||||
tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(Name);
|
||||
tip_label->setText(tip_text);
|
||||
tip_label->update();
|
||||
- tip_label->setToolTip(name);
|
||||
|
||||
if (!this->isActiveWindow())
|
||||
this->setHidden(false);
|
|
@ -0,0 +1,211 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 1f2666d..ad1ce02 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -24,6 +24,7 @@ QDevItem::QDevItem(QString address, QStringList deviceinfo, bool connected, QWid
|
||||
tran=transparency_gsettings->get(TRANSPARENCY_KEY).toDouble()*255;
|
||||
}
|
||||
|
||||
+ this->setToolTip(_Name);
|
||||
this->setFixedSize(404,50);
|
||||
this->setObjectName(address);
|
||||
_MStatus = Status::Nomal;
|
||||
@@ -267,12 +268,19 @@ void QDevItem::DrawStatusIcon(QPainter &painter)
|
||||
*************************************************/
|
||||
void QDevItem::DrawText(QPainter &painter)
|
||||
{
|
||||
+ QString nName;
|
||||
+ nName = _Name;
|
||||
painter.save();
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
painter.setPen(QColor(Qt::black));
|
||||
else
|
||||
painter.setPen(QColor(Qt::white));
|
||||
- painter.drawText(62,12,260,28,Qt::AlignLeft, _Name);
|
||||
+ int fontSize = StyleSettings->get("system-font-size").toInt();
|
||||
+ if (_Name.size() > FontTable[fontSize - 10]) {
|
||||
+ nName.remove(FontTable[fontSize - 10], _Name.size() - FontTable[fontSize - 10]);
|
||||
+ nName.append("...");
|
||||
+ }
|
||||
+ painter.drawText(62,12,260,28,Qt::AlignLeft, nName);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index 9b16211..c26d063 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
};
|
||||
Q_ENUM(PixmapColor)
|
||||
|
||||
+ int FontTable[6] = {32, 30, 26, 24, 23, 22};
|
||||
+
|
||||
QDevItem(QString address, QStringList deviceinfo, bool connected, QWidget *parent = nullptr);
|
||||
QDevItem(QWidget *parent);
|
||||
~QDevItem();
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 6e6c1a9..6fce211 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -77,7 +77,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
font-weight: 500;\
|
||||
line-height: 24px;\
|
||||
opacity: 1;}");
|
||||
- tip_text->setGeometry(32,52,400,28);
|
||||
+ tip_text->setGeometry(32,52,440,28);
|
||||
tip_text->setVisible(false);
|
||||
|
||||
initFileInfo();
|
||||
@@ -121,7 +121,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
- transNum->setGeometry(459,177,22,20);
|
||||
+ transNum->setGeometry(459,168,22,20);
|
||||
transNum->setVisible(false);
|
||||
transNum->setStyleSheet("QLabel{\
|
||||
width: 22px;\
|
||||
@@ -136,9 +136,9 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
m_progressbar = new QProgressBar(this);
|
||||
m_progressbar->setOrientation(Qt::Horizontal);
|
||||
if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,184,406,8);
|
||||
+ m_progressbar->setGeometry(32,175,406,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,184,454,8);
|
||||
+ m_progressbar->setGeometry(32,175,454,8);
|
||||
m_progressbar->setTextVisible(false);
|
||||
m_progressbar->setVisible(false);
|
||||
|
||||
@@ -284,7 +284,15 @@ void BluetoothFileTransferWidget::Get_fie_type(int i)
|
||||
void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
{
|
||||
this->setFixedSize(520,276);
|
||||
- tip_text->setText(tr("Transferring to \"")+dev_widget->get_seleter_dev_name()+"\"");
|
||||
+
|
||||
+
|
||||
+ QString Name = dev_widget->get_seleter_dev_name();
|
||||
+ if (dev_widget->get_seleter_dev_name().size() > 30) {
|
||||
+ Name.remove(30, dev_widget->get_seleter_dev_name().size() - 30);
|
||||
+ Name.append("...");
|
||||
+ }
|
||||
+ tip_text->setText(tr("Transferring to \"")+Name+"\"");
|
||||
+ tip_text->setToolTip(dev_widget->get_seleter_dev_name());
|
||||
tip_text->update();
|
||||
|
||||
ok_btn->setVisible(false);
|
||||
@@ -295,9 +303,9 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
Tiptop->setVisible(false);
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
||||
- target_icon->setGeometry(32,108,64,64);
|
||||
- target_name->setGeometry(112,115,300,20);
|
||||
- target_size->setGeometry(112,140,60,30);
|
||||
+ target_icon->setGeometry(32,95,64,64);
|
||||
+ target_name->setGeometry(112,102,300,20);
|
||||
+ target_size->setGeometry(112,127,68,30);
|
||||
|
||||
main_animation_group = new QParallelAnimationGroup(this);
|
||||
|
||||
diff --git a/ukui-bluetooth/fileSend/deviceselectitem.cpp b/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
index 925e620..8562a8a 100644
|
||||
--- a/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
@@ -28,6 +28,7 @@ DeviceSelectItem::DeviceSelectItem(QString name, QString address, QIcon icon, QW
|
||||
this->update();
|
||||
});
|
||||
}
|
||||
+ this->setToolTip(MName);
|
||||
}
|
||||
|
||||
DeviceSelectItem::~DeviceSelectItem(){
|
||||
@@ -189,5 +190,12 @@ void DeviceSelectItem::paintEvent(QPaintEvent *) {
|
||||
painter.setPen(QColor(Qt::white));
|
||||
style()->drawItemPixmap(&painter, QRect(8, 13, 24, 24), Qt::AlignCenter, loadSvg(MIcon.pixmap(24,24), PixmapColor::WHITE));
|
||||
}
|
||||
- painter.drawText(40,13,280,28,Qt::AlignLeft, MName);
|
||||
+ QString nName;
|
||||
+ nName = MName;
|
||||
+ int fontSize = StyleSettings->get("system-font-size").toInt();
|
||||
+ if (MName.size() > FontTable[fontSize - 10]) {
|
||||
+ nName.remove(FontTable[fontSize - 10], MName.size() - FontTable[fontSize - 10]);
|
||||
+ nName.append("...");
|
||||
+ }
|
||||
+ painter.drawText(40,13,380,28,Qt::AlignLeft, nName);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/fileSend/deviceselectitem.h b/ukui-bluetooth/fileSend/deviceselectitem.h
|
||||
index 548784a..cc396be 100644
|
||||
--- a/ukui-bluetooth/fileSend/deviceselectitem.h
|
||||
+++ b/ukui-bluetooth/fileSend/deviceselectitem.h
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
BLUE,
|
||||
};
|
||||
Q_ENUM(PixmapColor)
|
||||
+ int FontTable[6] = {48, 44, 42, 40, 34, 32};
|
||||
private:
|
||||
QIcon MIcon;
|
||||
QString MName;
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index e2ae452..54a1303 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -51,13 +51,18 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
|
||||
//QString top_text = tr("Bluetooth Connect Request From \'")+dev_name+tr("\'.");
|
||||
QString tip_text;
|
||||
+ QString Name = dev_name;
|
||||
+ if (dev_name.size() > 30) {
|
||||
+ Name.remove(30, dev_name.size() - 30);
|
||||
+ Name.append("...");
|
||||
+ }
|
||||
if(show_flag) {
|
||||
if (is_Intel)
|
||||
tip_text = tr("If you want to pair with this device, please make sure the numbers below are the same with the devices.");
|
||||
else
|
||||
- tip_text = tr("If \'")+dev_name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
+ tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
} else
|
||||
- tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(dev_name);
|
||||
+ tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(Name);
|
||||
//top_label = new QLabel(top_text,this);
|
||||
//top_label->setStyleSheet("QLabel{\
|
||||
// font-size: 18px;\
|
||||
@@ -73,6 +78,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
font-weight: 400;\
|
||||
line-height: 24px;}");
|
||||
tip_label->setWordWrap(true);
|
||||
+ tip_label->setToolTip(dev_name);
|
||||
|
||||
PIN_label = new QLabel(PINCode,this);
|
||||
PIN_label->setStyleSheet("QLabel{\
|
||||
@@ -121,7 +127,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
} else {
|
||||
this->setFixedSize(520,202);
|
||||
PIN_label->setGeometry(32,75,207,36);
|
||||
- tip_label->setGeometry(32,40,430,20);
|
||||
+ tip_label->setGeometry(32,40,430,40);
|
||||
//top_label->setGeometry(32,56,456,50);
|
||||
accept_btn->setGeometry(392,143,96,36);
|
||||
refuse_btn->setGeometry(280,143,96,36);
|
||||
@@ -175,12 +181,18 @@ void PinCodeWidget::updateUIInfo(const QString &name, const QString &pin)
|
||||
PIN_label->update();
|
||||
|
||||
QString tip_text;
|
||||
+ QString Name = name;
|
||||
+ if (name.size() > 30) {
|
||||
+ Name.remove(30, name.size() - 30);
|
||||
+ Name.append("...");
|
||||
+ }
|
||||
if(show_flag)
|
||||
- tip_text = tr("Please make sure the PIN code displayed on \'")+dev_name+tr("\' matches the number below. Please press \'Connect\'.");
|
||||
+ tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
else
|
||||
- tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(dev_name);
|
||||
+ tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(Name);
|
||||
tip_label->setText(tip_text);
|
||||
tip_label->update();
|
||||
+ tip_label->setToolTip(name);
|
||||
|
||||
if (!this->isActiveWindow())
|
||||
this->setHidden(false);
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index adc2c9c..89d9655 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -268,7 +268,7 @@ void QDevItem::DrawStatusIcon(QPainter &painter)
|
||||
painter.setPen(QColor(Qt::black));
|
||||
batteryPixmap = getDevTypeIcon();
|
||||
} else {
|
||||
- if (StyleSettings->get("icon-theme-name").toString() == "ukui-classical")
|
||||
+ if (StyleSettings->get("icon-theme-name").toString() == "ukui-icon-theme-classical")
|
||||
batteryPixmap = getDevTypeIcon();
|
||||
else {
|
||||
painter.setPen(QColor(Qt::white));
|
|
@ -0,0 +1,29 @@
|
|||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 3b280fe..6d0768d 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -89,8 +89,9 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
connectUISignalAndSlot();
|
||||
layoutAddAllPairedDev();
|
||||
if (_Intel) {
|
||||
- QDesktopWidget *deskdop = QApplication::desktop();
|
||||
- move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
+ QRect availableGeometry = QApplication::screens().at(0)->geometry();
|
||||
+ qDebug() << availableGeometry.x() << availableGeometry.y();
|
||||
+ move((availableGeometry.x() + (availableGeometry.width() - width())/2), (availableGeometry.y() + (availableGeometry.height() - height())/2));
|
||||
}
|
||||
emit trayIconStatusChanged(_SessionDBus->isPowered());
|
||||
_MBtn->setChecked(_SessionDBus->isPowered());
|
||||
@@ -522,8 +523,10 @@ void TrayWidget::showUI()
|
||||
this->setFixedHeight(((_MBtn->isChecked()) && (count != 0) ? selfHeight : 102));
|
||||
setWidgetPosition();
|
||||
} else {
|
||||
- QDesktopWidget *deskdop = QApplication::desktop();
|
||||
- move((deskdop->width() - width())/2, (deskdop->height() - height())/2);
|
||||
+ QApplication::desktop()->update();
|
||||
+ QRect availableGeometry = QApplication::screens().at(0)->geometry();
|
||||
+ qDebug() << availableGeometry.x() << availableGeometry.y();
|
||||
+ move((availableGeometry.x() + (availableGeometry.width() - width())/2), (availableGeometry.y() + (availableGeometry.height() - height())/2));
|
||||
}
|
||||
showNormal();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
Index: upstream/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
===================================================================
|
||||
--- upstream.orig/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ upstream/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -104,7 +104,7 @@ BluetoothFileTransferWidget::BluetoothFi
|
||||
fileName = fontMetrics.elidedText("\""
|
||||
+selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1)
|
||||
+"\"", Qt::ElideMiddle, 280);
|
||||
- fileName.append(tr(" and ")+QString::number(fileNums - 1)+tr(" files more"));
|
||||
+ fileName.append(tr(" and ")+QString::number(fileNums)+tr(" files more"));
|
||||
}else
|
||||
fileName = fontMetrics.elidedText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1), Qt::ElideMiddle, 280);
|
||||
target_name = new QLabel(fileName,this);
|
||||
@@ -291,7 +291,7 @@ void BluetoothFileTransferWidget::Initia
|
||||
cancel_btn->setVisible(true);
|
||||
cancel_btn->setGeometry(376, 205, 112, 56);
|
||||
m_progressbar->setVisible(true);
|
||||
- transNum->setVisible(fileNums - 1);
|
||||
+ transNum->setVisible(fileNums);
|
||||
Tiptop->setVisible(false);
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
||||
@@ -341,7 +341,7 @@ void BluetoothFileTransferWidget::get_tr
|
||||
+selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1)
|
||||
+"\""
|
||||
+tr(" and ")
|
||||
- +QString::number(selectedFiles.size() - 1)
|
||||
+ +QString::number(selectedFiles.size())
|
||||
+tr(" files more"));
|
||||
}
|
||||
else
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 4cbde9f..9e78915 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -205,6 +205,7 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
m_progressbar->setGeometry(24,155,372,8);
|
||||
else
|
||||
m_progressbar->setGeometry(24,155,420,8);
|
||||
+ this->activateWindow();
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initFileInfo() {
|
|
@ -0,0 +1,59 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 84ac4c6..5d94f9b 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -156,10 +156,10 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
ok_btn->setGeometry(392,560,100,36);
|
||||
dev_widget->setGeometry(32,175,456,356);
|
||||
Tiptop->setGeometry(32,144,100,20);
|
||||
- target_size->setGeometry(112,88,70,30);
|
||||
+ target_size->setGeometry(112,88,88,30);
|
||||
tip_text->setGeometry(32,52,452,56);
|
||||
target_icon->setGeometry(32,56,64,64);
|
||||
- target_name->setGeometry(112,63,400,24);
|
||||
+ target_name->setGeometry(112,63,400,30);
|
||||
transNum->setGeometry(459,168,52,20);
|
||||
if (fileNums > 1)
|
||||
m_progressbar->setGeometry(32,185,406,8);
|
||||
@@ -185,8 +185,8 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
this->setFixedSize(478,530);
|
||||
cancel_btn->setFixedSize(112,56);
|
||||
ok_btn->setFixedSize(112,56);
|
||||
- target_name->setFixedHeight(23);
|
||||
- target_size->setFixedWidth(68);
|
||||
+ target_name->setFixedHeight(30);
|
||||
+ target_size->setFixedWidth(88);
|
||||
dev_widget->resize(430,296);
|
||||
|
||||
ok_btn->setGeometry(342,450,112,56);
|
||||
@@ -195,10 +195,10 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
tranfer_status_icon->setGeometry(32,35,22,22);
|
||||
dev_widget->setGeometry(24,139,430,296);
|
||||
Tiptop->setGeometry(32,111,100,20);
|
||||
- target_size->setGeometry(104,60,70,30);
|
||||
+ target_size->setGeometry(104,60,88,30);
|
||||
tip_text->setGeometry(24,24,430,56);
|
||||
target_icon->setGeometry(24,24,64,64);
|
||||
- target_name->setGeometry(104,28,400,24);
|
||||
+ target_name->setGeometry(104,28,400,30);
|
||||
transNum->setGeometry(410,148,52,20);
|
||||
if (fileNums > 1)
|
||||
m_progressbar->setGeometry(24,155,372,8);
|
||||
@@ -302,13 +302,13 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
if (is_Intel) {
|
||||
cancel_btn->setGeometry(342, 200, 112, 56);
|
||||
target_icon->setGeometry(24,67,64,64);
|
||||
- target_name->setGeometry(104,71,400,20);
|
||||
- target_size->setGeometry(104,103,68,30);
|
||||
+ target_name->setGeometry(104,71,400,30);
|
||||
+ target_size->setGeometry(104,103,88,30);
|
||||
} else {
|
||||
cancel_btn->setGeometry(376, 213, 100, 36);
|
||||
target_icon->setGeometry(32,105,64,64);
|
||||
- target_name->setGeometry(112,112,400,20);
|
||||
- target_size->setGeometry(112,137,68,30);
|
||||
+ target_name->setGeometry(112,112,400,30);
|
||||
+ target_size->setGeometry(112,137,88,30);
|
||||
}
|
||||
|
||||
main_animation_group = new QParallelAnimationGroup(this);
|
|
@ -0,0 +1,472 @@
|
|||
diff --git a/debian/ukui-bluetooth.install b/debian/ukui-bluetooth.install
|
||||
index ffb99d1..b1731a2 100644
|
||||
--- a/debian/ukui-bluetooth.install
|
||||
+++ b/debian/ukui-bluetooth.install
|
||||
@@ -1,4 +1,5 @@
|
||||
ukui-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
+data/ukui-bluetooth-tray.desktop /etc/xdg/autostart/
|
||||
data/ukui-bluetooth.desktop /etc/xdg/autostart/
|
||||
ukcc-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
ukcc-bluetooth/translations/*.ts /usr/share/ukui-bluetooth/translations/
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 22fdc0e..e4d0c0a 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -64,10 +64,12 @@ void QDevItem::SendMessage(bool connected)
|
||||
}
|
||||
|
||||
void QDevItem::connectedChangedSlot(bool connected) {
|
||||
+ qDebug() << Q_FUNC_INFO << connected;
|
||||
if (_iconTimer->isActive())
|
||||
_iconTimer->stop();
|
||||
if (_Connected == connected)
|
||||
return;
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
_Connected = connected;
|
||||
_clicked = false;
|
||||
update();
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 13c0afb..da0aafc 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -68,11 +68,11 @@ void BluetoothDbus::adapterRemoveSignalSLot(QString address) {
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << __LINE__ << _response1.arguments().takeFirst().toStringList();
|
||||
}
|
||||
- emit adapterRemoveSignal(address);
|
||||
}
|
||||
|
||||
void BluetoothDbus::adapterAddSignalSLot(QString address) {
|
||||
qDebug() << Q_FUNC_INFO << __LINE__ << address;
|
||||
+ getDefaultAdapterPairedDevices();
|
||||
emit showTrayIcon(true);
|
||||
emit adapterAddSignal(address);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index a207d61..dfd12ca 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -27,7 +27,7 @@ MainProgram::MainProgram(bool intel, QObject *parent) :
|
||||
connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired) {
|
||||
Q_UNUSED(_name);
|
||||
Q_UNUSED(paired);
|
||||
- UI->updatePairedDev();
|
||||
+ UI->layoutAddOnePairedDev(_name, paired);
|
||||
});
|
||||
connect(_sessionDbus, &BluetoothDbus::devNameChangedSignal, this, [=]() {
|
||||
UI->updatePairedDev();
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 3bfe09d..55e1b04 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -28,6 +28,8 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
});
|
||||
connect(_SessionDBus, &BluetoothDbus::showTrayIcon, this, [=](bool show) {
|
||||
trayicon->SetAdapterFlag(show);
|
||||
+ if (!show)
|
||||
+ this->setVisible(show);
|
||||
});
|
||||
setProperty("useSystemStyleBlur", true);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
@@ -85,7 +87,7 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
pairedList = _SessionDBus->getPairedDevicesList();
|
||||
InitMemberVariables();
|
||||
connectUISignalAndSlot();
|
||||
- layoutAddPairedDev();
|
||||
+ layoutAddAllPairedDev();
|
||||
if (_Intel) {
|
||||
QDesktopWidget *deskdop = QApplication::desktop();
|
||||
move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
@@ -365,6 +367,7 @@ void TrayWidget::InitErrorWidget()
|
||||
void TrayWidget::connectUISignalAndSlot()
|
||||
{
|
||||
connect(_SessionDBus,&BluetoothDbus::devRemoveSignal,this,&TrayWidget::removePairedDevUIByAddress);
|
||||
+ connect(_SessionDBus,&BluetoothDbus::adapterAddSignal,this,&TrayWidget::updatePairedDev);
|
||||
connect(_SessionDBus,&BluetoothDbus::powerChangedSignal,this,[=](bool value){
|
||||
qDebug() << Q_FUNC_INFO << value <<__LINE__;
|
||||
if (!_Intel)
|
||||
@@ -373,6 +376,8 @@ void TrayWidget::connectUISignalAndSlot()
|
||||
_MBtn->setChecked(value);
|
||||
_config.gsetting->set("switch",QVariant::fromValue(value));
|
||||
emit trayIconStatusChanged(value);
|
||||
+ _SessionDBus->getDefaultAdapterPairedDevices();
|
||||
+ updatePairedDev();
|
||||
});
|
||||
connect(_SessionDBus,&BluetoothDbus::AdapterChangedSignal,this,[=](QString address){
|
||||
Q_UNUSED(address)
|
||||
@@ -380,16 +385,28 @@ void TrayWidget::connectUISignalAndSlot()
|
||||
});
|
||||
}
|
||||
|
||||
+void TrayWidget::SendMessage(QString name, bool connected)
|
||||
+{
|
||||
+ QString text;
|
||||
+ if (connected) {
|
||||
+ text = QString(tr("The connection with the Bluetooth device “%1” is successful!").arg(name));
|
||||
+
|
||||
+ } else {
|
||||
+ text = QString(tr("Bluetooth device “%1” disconnected!").arg(name));
|
||||
+ }
|
||||
+ Config::SendNotifyMessage(text);
|
||||
+}
|
||||
+
|
||||
/************************************************
|
||||
* @brief 已配对的设备添加到布局中显示
|
||||
* @param null
|
||||
* @return null
|
||||
*************************************************/
|
||||
-void TrayWidget::layoutAddPairedDev()
|
||||
+void TrayWidget::layoutAddAllPairedDev()
|
||||
{
|
||||
bool isNull = true;
|
||||
int count = 0;
|
||||
- qDebug() << Q_FUNC_INFO << pairedDevices.size() << __LINE__;
|
||||
+ qDebug() << Q_FUNC_INFO << pairedDevices.size() << __LINE__ << pairedDevices;
|
||||
if (!_PairedWidget->findChildren<QDevItem *>().size()) {
|
||||
for (auto item : pairedList) {
|
||||
QString name = pairedDevices.value(item).at(0);
|
||||
@@ -428,11 +445,18 @@ void TrayWidget::layoutAddPairedDev()
|
||||
}
|
||||
}
|
||||
|
||||
+void TrayWidget::layoutAddOnePairedDev(QString name, bool paired)
|
||||
+{
|
||||
+ updatePairedDev();
|
||||
+ if (paired)
|
||||
+ SendMessage(name, paired);
|
||||
+}
|
||||
+
|
||||
void TrayWidget::updatePairedDev() {
|
||||
pairedDevices = _SessionDBus->getPairedDevices();
|
||||
pairedList = _SessionDBus->getPairedDevicesList();
|
||||
clearPairedWidget();
|
||||
- layoutAddPairedDev();
|
||||
+ layoutAddAllPairedDev();
|
||||
}
|
||||
|
||||
/************************************************
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.h b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
index 3de9ae7..6a0da66 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.h
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
void connectUISignalAndSlot();
|
||||
void setBluetoothOpen(bool v);
|
||||
void updatePairedDev();
|
||||
+ void layoutAddOnePairedDev(QString name, bool paired);
|
||||
void setWidgetPosition();
|
||||
|
||||
public slots:
|
||||
@@ -50,13 +51,14 @@ public slots:
|
||||
private slots:
|
||||
void openBluetoothSlot(bool);
|
||||
void removePairedDevUIByAddress(QString address);
|
||||
- void layoutAddPairedDev();
|
||||
+ void layoutAddAllPairedDev();
|
||||
|
||||
private:
|
||||
void InitNomalWidget();
|
||||
void InitErrorWidget();
|
||||
void clearPairedWidget();
|
||||
void getTransparency();
|
||||
+ void SendMessage(QString name, bool connected);
|
||||
|
||||
TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent = nullptr);
|
||||
static TrayWidget* _MSelf;
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm
|
||||
index 5c2dd0a..6987182 100644
|
||||
Binary files a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm and b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
index 482ff61..3269ed2 100644
|
||||
--- a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
+++ b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
@@ -5,60 +5,60 @@
|
||||
<name>BluetoothFileTransferWidget</name>
|
||||
<message>
|
||||
<location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="32"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="184"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="147"/>
|
||||
<source>Bluetooth file transfer</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="47"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="336"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="280"/>
|
||||
<source>Transferring to "</source>
|
||||
<translation>发送文件至 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="80"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="438"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="477"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="70"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="382"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="421"/>
|
||||
<source> and </source>
|
||||
<translation> 等 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="80"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="440"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="479"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="70"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="384"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="423"/>
|
||||
<source> files more</source>
|
||||
<translation> 个文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="113"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="87"/>
|
||||
<source>Select Device</source>
|
||||
<translation>选择设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="126"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="509"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="577"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="93"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="453"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="515"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="139"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="106"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="154"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="121"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
<translation>文件发送失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="512"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="529"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="456"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="470"/>
|
||||
<source>File Transmition Succeed!</source>
|
||||
<translation>文件发送成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="537"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="478"/>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
@@ -102,71 +102,71 @@
|
||||
<translation>蓝牙文件传输</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="177"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="173"/>
|
||||
<source>Bluetooth File</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="78"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="391"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="428"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="77"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="79"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="263"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="387"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="462"/>
|
||||
<source>File from "</source>
|
||||
<translation>文件来自 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="77"/>
|
||||
<source>", waiting for receive...</source>
|
||||
<translation>",等待接收...</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="78"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="79"/>
|
||||
<source>", waiting for receive.</source>
|
||||
<translation>",等待接收。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="123"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="119"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="129"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="125"/>
|
||||
<source>Accept</source>
|
||||
<translation>接收</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="140"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="136"/>
|
||||
<source>View</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="263"/>
|
||||
<source>", is receiving... (has recieved </source>
|
||||
<translation>",正在接收… (已接收 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="263"/>
|
||||
<source> files)</source>
|
||||
<translation> 个文件)</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="391"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="387"/>
|
||||
<source>", is receiving...</source>
|
||||
<translation>",正在接收…</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="409"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="444"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="428"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="462"/>
|
||||
<source>", received failed !</source>
|
||||
<translation>",接收失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="435"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="469"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
<translation>文件传输失败!</translation>
|
||||
</message>
|
||||
@@ -201,61 +201,63 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="47"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="180"/>
|
||||
<source>' is the same as this PIN. Please press 'Connect'</source>
|
||||
<translation>”上的数字与下面相同,请点击“连接”</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="49"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="197"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="182"/>
|
||||
<source>If '</source>
|
||||
<translation>如果 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="78"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="77"/>
|
||||
<source>Refuse</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="116"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="105"/>
|
||||
<source>Bluetooth Connections</source>
|
||||
<translation>蓝牙连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="158"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="173"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="140"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="155"/>
|
||||
<source>Connect Failed!</source>
|
||||
<translation>连接失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="49"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="197"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="182"/>
|
||||
<source>' the PIN on is the same as this PIN. Please press 'Connect'.</source>
|
||||
<translation>" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="47"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="180"/>
|
||||
<source>If the PIN on '</source>
|
||||
<translation>如“</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="51"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="199"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="184"/>
|
||||
<source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair:</source>
|
||||
<translation>请在蓝牙设备 "%1" 上输入相同PIN,并按"Enter"确认:</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="85"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="84"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="76"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="75"/>
|
||||
<source>Connect</source>
|
||||
<translation>连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="157"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="172"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="139"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="154"/>
|
||||
<source>Pair</source>
|
||||
<translation>配对</translation>
|
||||
</message>
|
||||
@@ -263,12 +265,12 @@
|
||||
<context>
|
||||
<name>QDevItem</name>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="78"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="58"/>
|
||||
<source>The connection with the Bluetooth device “%1” is successful!</source>
|
||||
<translation>与蓝牙设备“%1”连接成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="81"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="61"/>
|
||||
<source>Bluetooth device “%1” disconnected!</source>
|
||||
<translation>蓝牙设备“%1”失去连接!</translation>
|
||||
</message>
|
||||
@@ -297,19 +299,29 @@
|
||||
<context>
|
||||
<name>TrayWidget</name>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="78"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="85"/>
|
||||
<source>bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="258"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="264"/>
|
||||
<source>Bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="309"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="315"/>
|
||||
<source>My Device</source>
|
||||
<translation>我的设备</translation>
|
||||
</message>
|
||||
+ <message>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="392"/>
|
||||
+ <source>The connection with the Bluetooth device “%1” is successful!</source>
|
||||
+ <translation>与蓝牙设备“%1”连接成功!</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="395"/>
|
||||
+ <source>Bluetooth device “%1” disconnected!</source>
|
||||
+ <translation>蓝牙设备“%1”失去连接!</translation>
|
||||
+ </message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 43aaefa..1bda657 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -98,9 +98,8 @@ void BluetoothDbus::devNameChangedSignalSLot(QString address, QString name) {
|
||||
updateList.append(name);
|
||||
updateList.append(pairedDevice.value(address).at(1));
|
||||
updateList.append(pairedDevice.value(address).at(2));
|
||||
- QMap<QString, QStringList>::iterator pos = pairedDevice.find(address);
|
||||
pairedDevice.remove(address);
|
||||
- pairedDevice.insert(pos, address, updateList);
|
||||
+ pairedDevice.insert(address, updateList);
|
||||
emit devNameChangedSignal();
|
||||
}
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
diff --git a/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm b/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm
|
||||
index feff98a..6bcd41f 100644
|
||||
Binary files a/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm and b/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index af9532e..2f6138f 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -416,3 +416,7 @@ const QPixmap QDevItem::loadSvg(const QPixmap &source, const PixmapColor &cgColo
|
||||
}
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
||||
+
|
||||
+bool QDevItem::isConnected() {
|
||||
+ return _Connected;
|
||||
+}
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index a7156d8..74d29a5 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color);
|
||||
|
||||
void InitMemberVariables();
|
||||
+ bool isConnected();
|
||||
|
||||
signals:
|
||||
void devConnect(bool);
|
||||
diff --git a/ukui-bluetooth/config/config.cpp b/ukui-bluetooth/config/config.cpp
|
||||
index 6630a99..43f8945 100644
|
||||
--- a/ukui-bluetooth/config/config.cpp
|
||||
+++ b/ukui-bluetooth/config/config.cpp
|
||||
@@ -33,6 +33,19 @@ void Config::SendNotifyMessage(QString message)
|
||||
qDebug() << Q_FUNC_INFO << msg.errorMessage();
|
||||
}
|
||||
|
||||
+bool Config::isHUAWEI() {
|
||||
+ QProcess p;
|
||||
+ p.start("bash", QStringList() <<"-c" << "cat /proc/cpuinfo | grep Hardware");
|
||||
+ p.waitForFinished();
|
||||
+ QString strResult = p.readAllStandardOutput().toLower();
|
||||
+ if(strResult.length() == 0)
|
||||
+ return false;
|
||||
+ if(strResult.indexOf("huawei") != -1 || strResult.indexOf("pangu") != -1 ||
|
||||
+ strResult.indexOf("kirin") != -1)
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
void Config::OpenBluetoothSettings()
|
||||
{
|
||||
QProcess *process = new QProcess();
|
||||
diff --git a/ukui-bluetooth/config/config.h b/ukui-bluetooth/config/config.h
|
||||
index 3e495f9..43cfbc9 100644
|
||||
--- a/ukui-bluetooth/config/config.h
|
||||
+++ b/ukui-bluetooth/config/config.h
|
||||
@@ -20,10 +20,12 @@ public:
|
||||
|
||||
static void SendNotifyMessage(QString);
|
||||
static void OpenBluetoothSettings();
|
||||
+ static bool isHUAWEI();
|
||||
private:
|
||||
QString setting_name;
|
||||
QGSettings *gsetting = nullptr;
|
||||
friend class MainProgram;
|
||||
friend class TrayWidget;
|
||||
+ bool is_Huawei = false;
|
||||
};
|
||||
#endif // CONFIG_H
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 01811fa..7030107 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -505,6 +505,8 @@ void TrayWidget::removePairedDevUIByAddress(QString address)
|
||||
qDebug() << Q_FUNC_INFO << address << __LINE__;
|
||||
QDevItem *item = _PairedWidget->findChild<QDevItem *>(address);
|
||||
if (item) {
|
||||
+ if(item->isConnected())
|
||||
+ SendMessage(pairedDevices.value(address).at(0), false);
|
||||
_PairedLayout->removeWidget(item);
|
||||
item->setParent(NULL);
|
||||
delete item;
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index fbc79ef..23f3af3 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "pincodewidget.h"
|
||||
#include "config/xatom-helper.h"
|
||||
+#include "config/config.h"
|
||||
|
||||
PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
: dev_name(name),
|
||||
@@ -7,6 +8,10 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
show_flag(flag)
|
||||
{
|
||||
is_Intel = QFile::exists("/etc/apt/ota_version");
|
||||
+
|
||||
+ if (Config::isHUAWEI())
|
||||
+ scale = QGSettings("org.ukui.SettingsDaemon.plugins.xsettings").get("scaling-factor").toDouble();
|
||||
+
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
settings = new QGSettings("org.ukui.style");
|
||||
connect(settings,&QGSettings::changed,this,&PinCodeWidget::GSettingsChanges);
|
||||
@@ -62,11 +67,11 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
|
||||
QFont ft_14, ft_16, ft_20, ft_24, ft_40;
|
||||
int ft_size = settings->get("system-font-size").toInt() - 11;
|
||||
- ft_14.setPixelSize(14 + ft_size);
|
||||
- ft_16.setPixelSize(16 + ft_size);
|
||||
- ft_20.setPixelSize(20 + ft_size);
|
||||
- ft_24.setPixelSize(24 + ft_size);
|
||||
- ft_40.setPixelSize(40 + ft_size);
|
||||
+ ft_14.setPixelSize((14 + ft_size) * scale);
|
||||
+ ft_16.setPixelSize((16 + ft_size) * scale);
|
||||
+ ft_20.setPixelSize((20 + ft_size) * scale);
|
||||
+ ft_24.setPixelSize((24 + ft_size) * scale);
|
||||
+ ft_40.setPixelSize((40 + ft_size) * scale);
|
||||
tip_label = new QLabel(tip_text,this);
|
||||
tip_label->setFont(ft_14);
|
||||
tip_label->setWordWrap(true);
|
||||
@@ -100,10 +105,10 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
accept_btn->setGeometry(374,159,112,56);
|
||||
refuse_btn->setGeometry(246,159,112,56);
|
||||
} else {
|
||||
- this->setFixedSize(520,212);
|
||||
+ this->setFixedSize(520 * scale ,212 * scale);
|
||||
title_icon = new QLabel(this);
|
||||
- title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
- title_icon->resize(22,22);
|
||||
+ title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22 * scale,22 * scale));
|
||||
+ title_icon->resize(22 * scale,22 * scale);
|
||||
|
||||
title_text = new QLabel(tr("Bluetooth Connections"),this);
|
||||
title_text->setFont(ft_14);
|
||||
@@ -117,14 +122,14 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
// close_btn->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
|
||||
close_btn->setFlat(true);
|
||||
connect(close_btn,&QPushButton::clicked,this,&PinCodeWidget::onClick_close_btn);
|
||||
- close_btn->setGeometry(480,8,30,30);
|
||||
-
|
||||
- title_icon->setGeometry(8, 8, 22, 22);
|
||||
- title_text->setGeometry(38, 9, 160, 20);
|
||||
- PIN_label->setGeometry(25,98,207,36);
|
||||
- tip_label->setGeometry(25,56,437,44);
|
||||
- accept_btn->setGeometry(388,152,108,36);
|
||||
- refuse_btn->setGeometry(264,152,108,36);
|
||||
+
|
||||
+ close_btn->setGeometry(480 * scale,8 * scale,30 * scale,30 * scale);
|
||||
+ title_icon->setGeometry(8 * scale, 8 * scale, 22 * scale, 22 * scale);
|
||||
+ title_text->setGeometry(38 * scale, 9 * scale, 160 * scale, 20 * scale);
|
||||
+ PIN_label->setGeometry(25 * scale,98 * scale,207 * scale,36 * scale);
|
||||
+ tip_label->setGeometry(25 * scale,56 * scale,437 * scale,44 * scale);
|
||||
+ accept_btn->setGeometry(388 * scale,152 * scale,108 * scale,36 * scale);
|
||||
+ refuse_btn->setGeometry(264 * scale,152 * scale,108 * scale,36 * scale);
|
||||
}
|
||||
QList<QScreen *> list = QGuiApplication::screens();
|
||||
this->move(list.at(0)->size().width()/2-this->width()/2,list.at(0)->size().height()/2-this->height()/2);
|
||||
@@ -140,13 +145,13 @@ void PinCodeWidget::pairFailureShow()
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
if (is_Intel) {
|
||||
warn_icon = new QLabel(this);
|
||||
- warn_icon->setFixedSize(64,64);
|
||||
+ warn_icon->setFixedSize(64 * scale,64 * scale);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
warn_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/connection-failed.svg"));
|
||||
- warn_icon->setGeometry(223,42,64,64);
|
||||
+ warn_icon->setGeometry(223 * scale,42 * scale,64 * scale,64 * scale);
|
||||
warn_icon->setVisible(true);
|
||||
tip_label->setText(QString(tr("Bluetooth Connect Failed")));
|
||||
- tip_label->setGeometry(210,108,190,28);
|
||||
+ tip_label->setGeometry(210 * scale,108 * scale,190 * scale,28 * scale);
|
||||
tip_label->setStyleSheet("QLabel{\
|
||||
font-family: NotoSansCJKsc;\
|
||||
font-size: 16px;\
|
||||
@@ -156,7 +161,7 @@ void PinCodeWidget::pairFailureShow()
|
||||
PIN_label->setVisible(false);
|
||||
accept_btn->setVisible(false);
|
||||
refuse_btn->setText(tr("Close"));
|
||||
- refuse_btn->setGeometry(374,159,112,56);
|
||||
+ refuse_btn->setGeometry(374 * scale,159 * scale,112 * scale,56 * scale);
|
||||
return;
|
||||
}
|
||||
QMessageBox msgBox;
|
||||
@@ -239,10 +244,10 @@ void PinCodeWidget::GSettingsChanges(const QString &key)
|
||||
int size = settings->get("system-font-size").toInt() - 11;
|
||||
qDebug() << Q_FUNC_INFO << size;
|
||||
QFont ft, ft1;
|
||||
- ft.setPixelSize(14 + size);
|
||||
+ ft.setPixelSize((14 + size) * scale);
|
||||
tip_label->setFont(ft);
|
||||
title_text->setFont(ft);
|
||||
- ft1.setPixelSize(24 + size);
|
||||
+ ft1.setPixelSize((24 + size) * scale);
|
||||
PIN_label->setFont(ft1);
|
||||
}
|
||||
this->setPalette(palette);
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.h b/ukui-bluetooth/pin/pincodewidget.h
|
||||
index 2524df0..5587f24 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.h
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <QScreen>
|
||||
#include <QPainter>
|
||||
#include <QFile>
|
||||
+#include <QProcess>
|
||||
|
||||
#define TRANSPARENCY_SETTINGS "org.ukui.control-center.personalise"
|
||||
#define TRANSPARENCY_KEY "transparency"
|
||||
@@ -64,7 +65,8 @@ private:
|
||||
QString dev_name;
|
||||
QString PINCode;
|
||||
bool show_flag;
|
||||
- bool is_Intel;
|
||||
+ bool is_Intel = false;
|
||||
+ double scale = 1.0;
|
||||
};
|
||||
|
||||
#endif // PINCODEWIDGET_H
|
|
@ -0,0 +1,76 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index ad1ce02..92b02e3 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -276,6 +276,10 @@ void QDevItem::DrawText(QPainter &painter)
|
||||
else
|
||||
painter.setPen(QColor(Qt::white));
|
||||
int fontSize = StyleSettings->get("system-font-size").toInt();
|
||||
+ if (fontSize > 15)
|
||||
+ fontSize = 15;
|
||||
+ if (fontSize < 10)
|
||||
+ fontSize = 10;
|
||||
if (_Name.size() > FontTable[fontSize - 10]) {
|
||||
nName.remove(FontTable[fontSize - 10], _Name.size() - FontTable[fontSize - 10]);
|
||||
nName.append("...");
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index a6fb8a2..b83fa7d 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -5,8 +5,7 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
target_name(devname),
|
||||
target_source(filename),
|
||||
root_address(root),
|
||||
- target_size(size),
|
||||
- target_type(filename.split(".").length()-1)
|
||||
+ target_size(size)
|
||||
{
|
||||
// 添加窗管协议
|
||||
MotifWmHints hints;
|
||||
@@ -82,6 +81,8 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
}else if (target_source.contains(".mp4", Qt::CaseInsensitive)
|
||||
|| target_source.contains(".mkv", Qt::CaseInsensitive))
|
||||
fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ if (target_source.contains(".txt", Qt::CaseInsensitive))
|
||||
+ fileicon = QIcon::fromTheme("text-plain");
|
||||
if (fileicon.isNull())
|
||||
fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
if (fileicon.isNull())
|
||||
@@ -90,7 +91,7 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
}
|
||||
if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme("text");
|
||||
+ fileicon = QIcon::fromTheme("text-plain");
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
file_source->setGeometry(32,52,460,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
@@ -346,6 +347,7 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
str.split("/").at(0) == "inode"){
|
||||
if (QIcon::hasThemeIcon(str.split("/").join("-"))) {
|
||||
fileicon = QIcon::fromTheme(str.split("/").join("-"));
|
||||
+ qDebug() << str.split("/").join("-");
|
||||
} else {
|
||||
if (fileicon.isNull())
|
||||
fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
@@ -354,7 +356,7 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
if (fileicon.isNull())
|
||||
fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme("text");
|
||||
+ fileicon = QIcon::fromTheme("text-plain");
|
||||
}
|
||||
}else
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
index cf066d3..f2dfe43 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
@@ -91,7 +91,6 @@ private:
|
||||
QString target_source;
|
||||
QString root_address;
|
||||
QString file_path;
|
||||
- QString target_type;
|
||||
quint64 target_size;
|
||||
QTimer *receiveTimer;
|
||||
int fileNums = 0;
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 1a225cb..9388d01 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -291,7 +291,7 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
cancel_btn->setVisible(true);
|
||||
cancel_btn->setGeometry(376, 205, 112, 56);
|
||||
m_progressbar->setVisible(true);
|
||||
- transNum->setVisible(fileNums);
|
||||
+ transNum->setVisible(fileNums - 1);
|
||||
Tiptop->setVisible(false);
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
|
@ -0,0 +1,233 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 62235fc..f64edf0 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -84,7 +84,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
ft1.setPixelSize(18);
|
||||
file_source->setFont(ft1);
|
||||
file_source->setWordWrap(true);
|
||||
- file_source->setWordWrap(true);
|
||||
|
||||
file_icon = new QLabel(this);
|
||||
file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
@@ -96,7 +95,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
file_name->setToolTip(target_source);
|
||||
file_name->setFont(ft);
|
||||
file_name->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
|
||||
- file_name->setWordWrap(true);
|
||||
|
||||
int unitcount = 0; //将单位B转化为对应的KB、MB等单位
|
||||
double calc_size = target_size;
|
||||
@@ -172,9 +170,6 @@ void FileReceivingPopupWidget::initLayout() {
|
||||
|
||||
window_Title = new QLabel(tr("Bluetooth File"),this);
|
||||
window_Title->setFixedSize(100,20);
|
||||
- QFont ft;
|
||||
- ft.setPixelSize(14);
|
||||
- window_Title->setFont(ft);
|
||||
connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->rejected();
|
||||
this->close();
|
||||
@@ -186,12 +181,27 @@ void FileReceivingPopupWidget::initLayout() {
|
||||
view_btn->setGeometry(390,215,120,36);
|
||||
file_source->setGeometry(32,52,460,54);
|
||||
file_icon->setGeometry(32,104,64,64);
|
||||
- file_name->setGeometry(112,111,293,20);
|
||||
+ file_name->setGeometry(112,111,293,28);
|
||||
file_size->setGeometry(112,136,293,20);
|
||||
transfer_progress->setGeometry(32,184,454,8);
|
||||
cancel_btn->setGeometry(278,215,96,36);
|
||||
accept_btn->setGeometry(390,215,96,36);
|
||||
warn_icon->setGeometry(32,54,22,22);
|
||||
+
|
||||
+ int size = StyleSettings->get("system-font-size").toInt() - 11;
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(18 + size);
|
||||
+ file_source->setFont(ft);
|
||||
+ QFontMetrics fontMetrics(file_source->font());
|
||||
+ QString fileName = fontMetrics.elidedText(target_source, Qt::ElideMiddle, 280);
|
||||
+ QString fileSource = fontMetrics.elidedText(QString(tr("File from \"")+target_name+tr("\", waiting for receive...")), Qt::ElideMiddle, file_source->width());
|
||||
+ file_source->setText(fileSource);
|
||||
+ file_source->setToolTip(target_name);
|
||||
+ file_name->setText(fileName);
|
||||
+ ft.setPixelSize(14 + size);
|
||||
+ file_name->setFont(ft);
|
||||
+ file_size->setFont(ft);
|
||||
+ window_Title->setFont(ft);
|
||||
}
|
||||
|
||||
void FileReceivingPopupWidget::initIntelLayout() {
|
||||
@@ -459,9 +469,11 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
file_name->setVisible(false);
|
||||
file_size->setVisible(false);
|
||||
|
||||
- file_source->setText(tr("File from \"")+target_name+tr("\", received failed !"));
|
||||
+ QFontMetrics fontMetrics(file_source->font());
|
||||
+ QString fileSource = fontMetrics.elidedText(QString(tr("File from \"")+target_name+tr("\", received failed !")), Qt::ElideMiddle, file_source->width());
|
||||
+ file_source->setText(fileSource);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
- file_source->setGeometry(62,52,430,54);
|
||||
+ file_source->setGeometry(62,52,430,60);
|
||||
warn_icon->setVisible(true);
|
||||
if (isIntel) {
|
||||
warn_icon->setFixedSize(64,64);
|
||||
@@ -509,6 +521,18 @@ void FileReceivingPopupWidget::GSettingsChanges(const QString &key)
|
||||
QFont ft;
|
||||
ft.setPixelSize(18 + size);
|
||||
file_source->setFont(ft);
|
||||
+ QFontMetrics fontMetrics(file_source->font());
|
||||
+ QString fileName = fontMetrics.elidedText(target_source, Qt::ElideMiddle, 280);
|
||||
+ QString fileSource;
|
||||
+ if (!cancel_btn->isVisible()) {
|
||||
+ fileSource = fontMetrics.elidedText(QString(tr("File from \"")+target_name+tr("\", received failed !")), Qt::ElideMiddle, file_source->width());
|
||||
+ file_source->setAlignment(Qt::AlignTop);
|
||||
+ file_source->setGeometry(62,52,430,60);
|
||||
+ } else
|
||||
+ fileSource = fontMetrics.elidedText(QString(tr("File from \"")+target_name+tr("\", waiting for receive...")), Qt::ElideMiddle, file_source->width());
|
||||
+ file_source->setText(fileSource);
|
||||
+ file_source->setToolTip(target_name);
|
||||
+ file_name->setText(fileName);
|
||||
ft.setPixelSize(14 + size);
|
||||
file_name->setFont(ft);
|
||||
file_size->setFont(ft);
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 9e78915..fa09930 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -45,11 +45,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
|
||||
tip_text = new QLabel(tr("Transferring to \"")+dev_name+"\"",this);
|
||||
- QFont ft_18, ft_14;
|
||||
- ft_14.setPixelSize(14);
|
||||
- ft_18.setPixelSize(18);
|
||||
|
||||
- tip_text->setFont(ft_18);
|
||||
tip_text->setWordWrap(true);
|
||||
tip_text->setVisible(false);
|
||||
|
||||
@@ -59,7 +55,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
target_icon->setPixmap(file_icon.at(0).pixmap(64,64));
|
||||
|
||||
target_size = new QLabel(file_size.at(0),this);
|
||||
- target_size->setFont(ft_14);
|
||||
|
||||
QFontMetrics fontMetrics(target_size->font());
|
||||
QString fileName;
|
||||
@@ -71,13 +66,11 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
}else
|
||||
fileName = fontMetrics.elidedText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1), Qt::ElideMiddle, 280);
|
||||
target_name = new QLabel(fileName,this);
|
||||
- target_name->setFont(ft_14);
|
||||
target_name->setWordWrap(true);
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
transNum->setVisible(false);
|
||||
- transNum->setFont(ft_14);
|
||||
|
||||
m_progressbar = new QProgressBar(this);
|
||||
m_progressbar->setOrientation(Qt::Horizontal);
|
||||
@@ -86,7 +79,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
Tiptop = new QLabel(tr("Select Device"),this);
|
||||
Tiptop->setFixedSize(100,20);
|
||||
- Tiptop->setFont(ft_14);
|
||||
|
||||
dev_widget = new DeviceSeleterWidget(devicelist, this,dev_address);
|
||||
|
||||
@@ -120,7 +112,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
tranfer_status_text = new QLabel(this);
|
||||
tranfer_status_text->setText(tr("File Transmission Failed !"));
|
||||
tranfer_status_text->setVisible(false);
|
||||
- tranfer_status_text->setFont(ft_18);
|
||||
|
||||
if (is_Intel)
|
||||
initIntelLayout();
|
||||
@@ -136,16 +127,12 @@ BluetoothFileTransferWidget::~BluetoothFileTransferWidget()
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initLayout() {
|
||||
- QFont ft_14;
|
||||
- ft_14.setPixelSize(14);
|
||||
-
|
||||
this->setFixedSize(520,620);
|
||||
title_icon = new QLabel(this);
|
||||
title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
title_icon->resize(22,22);
|
||||
|
||||
title_text = new QLabel(tr("Bluetooth file transfer"),this);
|
||||
- title_text->setFont(ft_14);
|
||||
|
||||
close_btn = new QPushButton(this);
|
||||
close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
@@ -157,6 +144,8 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
emit close_the_pre_session();
|
||||
this->close();
|
||||
});
|
||||
+
|
||||
+ //布局
|
||||
dev_widget->resize(456,356);
|
||||
title_icon->setGeometry(8,8,22,22);
|
||||
title_text->setGeometry(36,8,200,20);
|
||||
@@ -176,6 +165,19 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
m_progressbar->setGeometry(32,185,406,8);
|
||||
else
|
||||
m_progressbar->setGeometry(32,185,454,8);
|
||||
+
|
||||
+ //字体
|
||||
+ int size = GSettings->get("system-font-size").toInt() - 11;
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(14+size);
|
||||
+ title_text->setFont(ft);
|
||||
+ target_size->setFont(ft);
|
||||
+ target_name->setFont(ft);
|
||||
+ transNum->setFont(ft);
|
||||
+ Tiptop->setFont(ft);
|
||||
+ ft.setPixelSize(18+size);
|
||||
+ tip_text->setFont(ft);
|
||||
+ tranfer_status_text->setFont(ft);
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
@@ -190,6 +192,7 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
target_size->setFixedWidth(68);
|
||||
target_size->setFont(ft_14);
|
||||
dev_widget->resize(430,296);
|
||||
+
|
||||
ok_btn->setGeometry(342,450,112,56);
|
||||
cancel_btn->setGeometry(214,450,112,56);
|
||||
tranfer_status_text->setGeometry(62,33,376,27);
|
||||
@@ -205,6 +208,19 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
m_progressbar->setGeometry(24,155,372,8);
|
||||
else
|
||||
m_progressbar->setGeometry(24,155,420,8);
|
||||
+
|
||||
+ int size = GSettings->get("system-font-size").toInt() - 11;
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(14+size);
|
||||
+ title_text->setFont(ft);
|
||||
+ target_size->setFont(ft);
|
||||
+ target_name->setFont(ft);
|
||||
+ transNum->setFont(ft);
|
||||
+ Tiptop->setFont(ft);
|
||||
+ ft.setPixelSize(18+size);
|
||||
+ tip_text->setFont(ft);
|
||||
+ tranfer_status_text->setFont(ft);
|
||||
+
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index 6fa5890..4c6c2f1 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -117,7 +117,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
close_btn->setGeometry(480,8,30,30);
|
||||
title_icon->setGeometry(8, 8, 22, 22);
|
||||
title_text->setGeometry(38, 9, 160, 20);
|
||||
- PIN_label->setGeometry(25,90,207,36);
|
||||
+ PIN_label->setGeometry(25,98,207,36);
|
||||
tip_label->setGeometry(25,56,437,44);
|
||||
accept_btn->setGeometry(388,152,108,36);
|
||||
refuse_btn->setGeometry(264,152,108,36);
|
|
@ -0,0 +1,17 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index c36eb55..f17ad13 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -118,10 +118,11 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
line-height: 24px;\
|
||||
opacity: 1;\
|
||||
}");
|
||||
+ target_name->setWordWrap(true);
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
- transNum->setGeometry(459,168,30,20);
|
||||
+ transNum->setGeometry(459,168,52,20);
|
||||
transNum->setVisible(false);
|
||||
transNum->setStyleSheet("QLabel{\
|
||||
width: 22px;\
|
|
@ -0,0 +1,70 @@
|
|||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 09f7277..aea8198 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -85,13 +85,15 @@ void BluetoothDbus::defaultAdapterChangedSLot(QString value) {
|
||||
void BluetoothDbus::devPairSignalSLot(QString address, bool paired) {
|
||||
qDebug() << "devPairSignalSLot" << address << paired;
|
||||
if (paired && !pairedDevice.contains(address)) {
|
||||
- pairedList.append(address);
|
||||
+ if (!pairedList.contains(address))
|
||||
+ pairedList.append(address);
|
||||
addNewPairedDevice(address);
|
||||
emit devPairSignal(pairedDevice.value(address).at(0),paired);
|
||||
}
|
||||
if (!paired && pairedDevice.contains(address)) {
|
||||
QString name = pairedDevice.value(address).at(0);
|
||||
- pairedList.removeAll(address);
|
||||
+ if (!pairedList.contains(address))
|
||||
+ pairedList.removeAll(address);
|
||||
pairedDevice.remove(address);
|
||||
emit devPairSignal(name, paired);
|
||||
}
|
||||
@@ -146,6 +148,8 @@ void BluetoothDbus::devBatteryChangedSignalSLot(QString address, QString battery
|
||||
|
||||
void BluetoothDbus::devRemoveSignalSLot(QString address) {
|
||||
qDebug() << "devRemoveSignalSLot" << address;
|
||||
+ if (pairedList.contains(address))
|
||||
+ pairedList.removeAll(address);
|
||||
if (pairedDevice.keys().contains(address))
|
||||
pairedDevice.remove(address);
|
||||
emit devRemoveSignal(address);
|
||||
@@ -396,7 +400,8 @@ void BluetoothDbus::getDefaultAdapterPairedDevices() {
|
||||
QStringList ret = response.arguments().takeFirst().toStringList();
|
||||
qDebug() << ret;
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
- pairedList.append(ret.at(i));
|
||||
+ if (!pairedList.contains(ret.at(i)))
|
||||
+ pairedList.append(ret.at(i));
|
||||
addNewPairedDevice(ret.at(i));
|
||||
}
|
||||
qDebug() << "init paired devices over : " << pairedDevice;
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index bc5ae12..3333629 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -423,6 +423,7 @@ void TrayWidget::layoutAddPairedDev()
|
||||
_MSelf->setFixedHeight((isNull ? 102 : selfHeight));
|
||||
}
|
||||
update();
|
||||
+ setWidgetPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,10 +484,16 @@ void TrayWidget::removePairedDevUIByAddress(QString address)
|
||||
item = nullptr;
|
||||
}
|
||||
pairedDevices.remove(address);
|
||||
+ updatePairedDev();
|
||||
}
|
||||
|
||||
void TrayWidget::showUI()
|
||||
{
|
||||
+ int count = pairedList.size();
|
||||
+ selfHeight =160 + count * 54;
|
||||
+ if (count >= 7)
|
||||
+ selfHeight = 515;
|
||||
+ this->setFixedHeight((_MBtn->isChecked() && count != 0 ? selfHeight : 102));
|
||||
if (!_Intel)
|
||||
setWidgetPosition();
|
||||
else {
|
|
@ -0,0 +1,63 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 1ec5122..62235fc 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -72,6 +72,7 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
}
|
||||
}else
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
+
|
||||
if (isIntel)
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive..."),this);
|
||||
else
|
||||
@@ -203,12 +204,12 @@ void FileReceivingPopupWidget::initIntelLayout() {
|
||||
|
||||
accept_btn->setGeometry(342,200,112,56);
|
||||
cancel_btn->setGeometry(214,200,112,56);
|
||||
- file_name->setGeometry(104,71,293,23);
|
||||
- file_size->setGeometry(104,103,293,23);
|
||||
+ file_name->setGeometry(104,75,293,23);
|
||||
+ file_size->setGeometry(104,107,293,23);
|
||||
view_btn->setGeometry(342,200,120,36);
|
||||
- file_source->setGeometry(24,24,460,54);
|
||||
- file_icon->setGeometry(24,67,64,64);
|
||||
- transfer_progress->setGeometry(24,155,430,8);
|
||||
+ file_source->setGeometry(24,24,430,54);
|
||||
+ file_icon->setGeometry(24,71,64,64);
|
||||
+ transfer_progress->setGeometry(24,159,430,8);
|
||||
warn_icon->setGeometry(32,34,22,22);
|
||||
}
|
||||
|
||||
@@ -458,7 +459,6 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
file_name->setVisible(false);
|
||||
file_size->setVisible(false);
|
||||
|
||||
-
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", received failed !"));
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
file_source->setGeometry(62,52,430,54);
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 9b155c6..4cbde9f 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -170,7 +170,7 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
target_size->setGeometry(112,88,70,30);
|
||||
tip_text->setGeometry(32,52,452,56);
|
||||
target_icon->setGeometry(32,56,64,64);
|
||||
- target_name->setGeometry(112,63,400,20);
|
||||
+ target_name->setGeometry(112,63,400,24);
|
||||
transNum->setGeometry(459,168,52,20);
|
||||
if (fileNums > 1)
|
||||
m_progressbar->setGeometry(32,185,406,8);
|
||||
@@ -197,9 +197,9 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
dev_widget->setGeometry(24,139,430,296);
|
||||
Tiptop->setGeometry(32,111,100,20);
|
||||
target_size->setGeometry(104,60,70,30);
|
||||
- tip_text->setGeometry(32,32,452,56);
|
||||
+ tip_text->setGeometry(24,24,430,56);
|
||||
target_icon->setGeometry(24,24,64,64);
|
||||
- target_name->setGeometry(104,28,400,20);
|
||||
+ target_name->setGeometry(104,28,400,24);
|
||||
transNum->setGeometry(410,148,52,20);
|
||||
if (fileNums > 1)
|
||||
m_progressbar->setGeometry(24,155,372,8);
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 8126abb..1db6210 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -77,7 +77,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
font-weight: 500;\
|
||||
line-height: 24px;\
|
||||
opacity: 1;}");
|
||||
- tip_text->setGeometry(32,52,440,28);
|
||||
+ tip_text->setGeometry(32,52,452,28);
|
||||
tip_text->setVisible(false);
|
||||
|
||||
initFileInfo();
|
||||
@@ -121,7 +121,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
- transNum->setGeometry(459,168,22,20);
|
||||
+ transNum->setGeometry(459,168,30,20);
|
||||
transNum->setVisible(false);
|
||||
transNum->setStyleSheet("QLabel{\
|
||||
width: 22px;\
|
|
@ -0,0 +1,63 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 760c671..79a27b2 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -394,7 +394,7 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
|
||||
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", received failed !"));
|
||||
- file_source->setGeometry(62,52,500,54);
|
||||
+ file_source->setGeometry(62,52,430,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
warn_icon->setVisible(true);
|
||||
if (isIntel) {
|
||||
@@ -402,19 +402,23 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
warn_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
warn_icon->setGeometry(220,86,64,64);
|
||||
file_source->setText(tr("File Transmission Failed !"));
|
||||
- file_source->setFixedWidth(500);
|
||||
+ file_source->setFixedWidth(505);
|
||||
file_source->setStyleSheet("QLabel{\
|
||||
font-family: NotoSansCJKsc;\
|
||||
font-size: 16px;\
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #FB5050;}");
|
||||
- file_source->setGeometry(12,150,500,24);
|
||||
+ file_source->setGeometry(12,150,505,24);
|
||||
file_source->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+void FileReceivingPopupWidget::cancelReceivingFiles() {
|
||||
+ file_transfer_completed(QString("Error"));
|
||||
+}
|
||||
+
|
||||
void FileReceivingPopupWidget::GSettings_value_chanage(const QString &key)
|
||||
{
|
||||
if(key == "file-save-path"){
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
index c2d8626..4153af1 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
@@ -55,6 +55,7 @@ public slots:
|
||||
void OnClickedAcceptBtn();
|
||||
void update_transfer_progress_bar(quint64);
|
||||
void file_transfer_completed(QString status);
|
||||
+ void cancelReceivingFiles();
|
||||
void GSettings_value_chanage(const QString &key);
|
||||
void GSettingsChanges(const QString &key);
|
||||
void transferCompelete();
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index 493f1e4..7849c17 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -80,6 +80,7 @@ void MainProgram::receiveFileSlot(QString devname, QString filename, QString typ
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
connect(receiving_widget, &FileReceivingPopupWidget::clearOldSession, _sessionDbus, &BluetoothDbus::clearOldSession);
|
||||
connect(_sessionDbus, &BluetoothDbus::fileReceiveMore, receiving_widget, &FileReceivingPopupWidget::updateUI);
|
||||
+ connect(_sessionDbus, &BluetoothDbus::obexAgentCanceledSignal, receiving_widget, &FileReceivingPopupWidget::cancelReceivingFiles);
|
||||
|
||||
connect(receiving_widget,&FileReceivingPopupWidget::accepted,this,[=]{
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 55e1b04..f1e5af9 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -514,14 +514,14 @@ void TrayWidget::removePairedDevUIByAddress(QString address)
|
||||
|
||||
void TrayWidget::showUI()
|
||||
{
|
||||
- int count = pairedList.size();
|
||||
- selfHeight =160 + count * 54;
|
||||
- if (count >= 7)
|
||||
- selfHeight = 515;
|
||||
- this->setFixedHeight((_MBtn->isChecked() && count != 0 ? selfHeight : 102));
|
||||
- if (!_Intel)
|
||||
+ if (!_Intel) {
|
||||
+ int count = pairedList.size();
|
||||
+ selfHeight =160 + count * 54;
|
||||
+ if (count >= 7)
|
||||
+ selfHeight = 515;
|
||||
+ this->setFixedHeight(((_MBtn->isChecked()) && (count != 0) ? selfHeight : 102));
|
||||
setWidgetPosition();
|
||||
- else {
|
||||
+ } else {
|
||||
QDesktopWidget *deskdop = QApplication::desktop();
|
||||
move((deskdop->width() - width())/2, (deskdop->height() - height())/2);
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index b87e4e5..79e8727 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -261,10 +261,13 @@ void MainProgram::displayPasskeySlot(QString name, QString passkey)
|
||||
}
|
||||
|
||||
Keypincodewidget = new PinCodeWidget(name,passkey,false);
|
||||
+ connect(Keypincodewidget, &PinCodeWidget::msgShowedOver, this, [=] {
|
||||
+ Keypincodewidget->deleteLater();
|
||||
+ Keypincodewidget = nullptr;
|
||||
+ });
|
||||
|
||||
connect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, this, [=]() {
|
||||
Keypincodewidget->pairFailureShow();
|
||||
- Keypincodewidget = nullptr;
|
||||
disconnect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, nullptr, nullptr);
|
||||
});
|
||||
connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired){
|
||||
@@ -276,7 +279,6 @@ void MainProgram::displayPasskeySlot(QString name, QString passkey)
|
||||
QTimer::singleShot(1000,this,[=]{
|
||||
if (!_sessionDbus->isConnected(name)) {
|
||||
Keypincodewidget->pairFailureShow();
|
||||
- Keypincodewidget = nullptr;
|
||||
}
|
||||
});
|
||||
disconnect(_sessionDbus, &BluetoothDbus::devPairSignal, nullptr, nullptr);
|
||||
@@ -291,38 +293,34 @@ void MainProgram::requestConfirmationSlot(QString name, QString passkey)
|
||||
qDebug() << Q_FUNC_INFO << name << passkey;
|
||||
|
||||
if(pincodewidget != nullptr){
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
m_Passkey = passkey;
|
||||
pincodewidget = new PinCodeWidget(name,passkey);
|
||||
+ connect(pincodewidget, &PinCodeWidget::msgShowedOver, this, [=] {
|
||||
+ if (pincodewidget != nullptr) {
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ pincodewidget->deleteLater();
|
||||
+ pincodewidget = nullptr;
|
||||
+ }
|
||||
+ });
|
||||
connect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, this, [=]() {
|
||||
if (pincodewidget != nullptr) {
|
||||
+ if (pincodewidget->canceled)
|
||||
+ return;
|
||||
+ pincodewidget->canceled = true;
|
||||
pincodewidget->pairFailureShow();
|
||||
pincodewidget = nullptr;
|
||||
}
|
||||
- disconnect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, nullptr, nullptr);
|
||||
});
|
||||
+
|
||||
connect(pincodewidget,&PinCodeWidget::accepted,this,[=]{
|
||||
_sessionDbus->replyRequestConfirmation(true);
|
||||
- disconnect(pincodewidget,&PinCodeWidget::accepted, nullptr, nullptr);
|
||||
});
|
||||
|
||||
connect(pincodewidget,&PinCodeWidget::rejected,this,[=]{
|
||||
_sessionDbus->replyRequestConfirmation(false);
|
||||
- disconnect(pincodewidget,&PinCodeWidget::rejected, nullptr, nullptr);
|
||||
- });
|
||||
-
|
||||
- connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired){
|
||||
- if (name != _name)
|
||||
- return;
|
||||
- if (!paired) {
|
||||
- _sessionDbus->replyRequestConfirmation(false);
|
||||
- if (pincodewidget != nullptr) {
|
||||
- pincodewidget->close();
|
||||
- pincodewidget = nullptr;
|
||||
- }
|
||||
- }
|
||||
- disconnect(_sessionDbus, &BluetoothDbus::devPairSignal, nullptr, nullptr);
|
||||
});
|
||||
connect(pincodewidget, &PinCodeWidget::destroyed, this, [=] {
|
||||
pincodewidget = nullptr;
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.cpp b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
index 197e6cb..903b8c4 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
@@ -10,7 +10,8 @@ TrayIcon::TrayIcon(QWidget *parent)
|
||||
|
||||
bluetooth_tray_icon = new QSystemTrayIcon(this);
|
||||
tray_Menu = new QMenu(this);
|
||||
- QAction *settins_action = new QAction(QIcon::fromTheme("ukui-settings-symbolic"),tr("Set Bluetooth Item"),tray_Menu);
|
||||
+ QAction *settins_action = new QAction(tr("Set Bluetooth Item"),tray_Menu);
|
||||
+ settins_action->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) );
|
||||
tray_Menu->addAction(settins_action);
|
||||
connect(tray_Menu, &QMenu::triggered, this, [=]{
|
||||
emit openBluetoothSettings();
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index c240edf..b7d7a85 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -151,10 +151,8 @@ void PinCodeWidget::Connection_timed_out()
|
||||
msgBox.setText(tr("Connection error !!!"));
|
||||
int ret = msgBox.exec();
|
||||
if(ret){
|
||||
- if (show_flag)
|
||||
- this->close();
|
||||
- else
|
||||
- this->setHidden(true);
|
||||
+ this->setHidden(true);
|
||||
+ emit msgShowedOver();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,10 +167,8 @@ void PinCodeWidget::pairFailureShow()
|
||||
int ret = msgBox.exec();
|
||||
if(ret){
|
||||
qDebug() << Q_FUNC_INFO << this << __LINE__;
|
||||
- if (show_flag)
|
||||
- this->close();
|
||||
- else
|
||||
- this->setHidden(true);
|
||||
+ this->setHidden(true);
|
||||
+ emit msgShowedOver();
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.h b/ukui-bluetooth/pin/pincodewidget.h
|
||||
index ce49ec9..4efd8e4 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.h
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.h
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
void Connection_timed_out();
|
||||
void pairFailureShow();
|
||||
void updateUIInfo(const QString &name,const QString &pin);
|
||||
+ bool canceled = false;
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
@@ -42,6 +43,7 @@ private slots:
|
||||
signals:
|
||||
void accepted();
|
||||
void rejected();
|
||||
+ void msgShowedOver();
|
||||
private:
|
||||
QGSettings *settings = nullptr;
|
||||
QGSettings *transparency_gsettings = nullptr;
|
|
@ -0,0 +1,307 @@
|
|||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index 67fc32b..c02e4b4 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -127,10 +127,10 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
line-height: 24px;}");
|
||||
} else {
|
||||
this->setFixedSize(520,212);
|
||||
- title_icon->setGeometry(8, 8, 20, 22);
|
||||
- title_text->setGeometry(36, 9, 56, 20);
|
||||
- PIN_label->setGeometry(25,84,207,36);
|
||||
- tip_label->setGeometry(25,56,437,20);
|
||||
+ title_icon->setGeometry(8, 8, 22, 22);
|
||||
+ title_text->setGeometry(38, 9, 160, 20);
|
||||
+ PIN_label->setGeometry(25,90,207,36);
|
||||
+ tip_label->setGeometry(25,56,437,40);
|
||||
//top_label->setGeometry(32,56,456,50);
|
||||
accept_btn->setGeometry(392,152,96,36);
|
||||
refuse_btn->setGeometry(288,152,96,36);
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm
|
||||
index 321e1d3..63e204c 100644
|
||||
Binary files a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm and b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
index 5d5556c..9188a0c 100644
|
||||
--- a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
+++ b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
@@ -5,58 +5,60 @@
|
||||
<name>BluetoothFileTransferWidget</name>
|
||||
<message>
|
||||
<location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="28"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="45"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="48"/>
|
||||
<source>Bluetooth file transfer</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="68"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="280"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="71"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="294"/>
|
||||
<source>Transferring to "</source>
|
||||
<translation>发送文件至 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="104"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="381"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="107"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="384"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="411"/>
|
||||
<source> and </source>
|
||||
<translation> 等 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="104"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="383"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="107"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="386"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="413"/>
|
||||
<source> files more</source>
|
||||
<translation> 个文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="142"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="145"/>
|
||||
<source>Select Device</source>
|
||||
<translation>选择设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="158"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="346"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="431"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="161"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="442"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="505"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="172"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="175"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="190"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="193"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
<translation>文件发送失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="350"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="362"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="446"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="458"/>
|
||||
<source>File Transmition Succeed!</source>
|
||||
<translation>文件发送成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="370"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="466"/>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
@@ -101,65 +103,65 @@
|
||||
<translation>蓝牙文件传输</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="65"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="64"/>
|
||||
<source>Bluetooth File</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="184"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="306"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="339"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="95"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="204"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="325"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="398"/>
|
||||
<source>File from "</source>
|
||||
<translation>文件来自 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="95"/>
|
||||
<source>", waiting for receive.</source>
|
||||
<translation>",等待接收。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="123"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="142"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="130"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="149"/>
|
||||
<source>Accept</source>
|
||||
<translation>接收</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="143"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="162"/>
|
||||
<source>View</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="184"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="204"/>
|
||||
<source>", is receiving... (has recieved </source>
|
||||
<translation>",正在接收… (已接收 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="184"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="204"/>
|
||||
<source> files)</source>
|
||||
<translation> 个文件)</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="306"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="325"/>
|
||||
<source>", is receiving...</source>
|
||||
<translation>",正在接收…</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="322"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="381"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="339"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="398"/>
|
||||
<source>", received failed !</source>
|
||||
<translation>",接收失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="347"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="406"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
<translation>文件发送失败!</translation>
|
||||
</message>
|
||||
@@ -192,10 +194,6 @@
|
||||
<source>Bluetooth pairing</source>
|
||||
<translation>蓝牙设备配对</translation>
|
||||
</message>
|
||||
- <message>
|
||||
- <source>Bluetooth Connections</source>
|
||||
- <translation type="vanished">蓝牙连接</translation>
|
||||
- </message>
|
||||
<message>
|
||||
<source>Bluetooth Connect Request From '</source>
|
||||
<translation type="vanished">蓝牙连接请求来自 "</translation>
|
||||
@@ -205,55 +203,60 @@
|
||||
<translation type="vanished">"。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="56"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="62"/>
|
||||
<source>If you want to pair with this device, please make sure the numbers below are the same with the devices.</source>
|
||||
<translation>若要连接此设备,请确认下面的数字与该设备上的一致。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="179"/>
|
||||
<source>Please make sure the PIN code displayed on '</source>
|
||||
- <translation>如果 "</translation>
|
||||
+ <translation type="vanished">如果 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="179"/>
|
||||
<source>' matches the number below. Please press 'Connect'.</source>
|
||||
- <translation>" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
+ <translation type="vanished">" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="60"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="181"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="66"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="195"/>
|
||||
<source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !</source>
|
||||
<translation>请在蓝牙设备 "%1" 上输入下列PIN码,并按连接进行匹配!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="58"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="64"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="193"/>
|
||||
<source>If '</source>
|
||||
<translation>如果 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="58"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="42"/>
|
||||
+ <source>Bluetooth Connections</source>
|
||||
+ <translation>蓝牙连接</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="64"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="193"/>
|
||||
<source>' the PIN on is the same as this PIN. Please press 'Connect'.</source>
|
||||
<translation>" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="84"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="91"/>
|
||||
<source>Connect</source>
|
||||
<translation>连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="86"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="93"/>
|
||||
<source>Refush</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="141"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="158"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="150"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="167"/>
|
||||
<source>Pair</source>
|
||||
<translation>配对</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="142"/>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="159"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="151"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="168"/>
|
||||
<source>Connection error !!!</source>
|
||||
<translation>连接失败 !!!</translation>
|
||||
</message>
|
||||
@@ -261,12 +264,12 @@
|
||||
<context>
|
||||
<name>QDevItem</name>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="45"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="46"/>
|
||||
<source>The connection with the Bluetooth device “%1” is successful!</source>
|
||||
<translation>与蓝牙设备“%1”连接成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../component/qdevitem.cpp" line="48"/>
|
||||
+ <location filename="../component/qdevitem.cpp" line="49"/>
|
||||
<source>Bluetooth device “%1” disconnected!</source>
|
||||
<translation>蓝牙设备“%1”失去连接!</translation>
|
||||
</message>
|
||||
@@ -290,17 +293,17 @@
|
||||
<context>
|
||||
<name>TrayWidget</name>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="50"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="57"/>
|
||||
<source>bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="212"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="226"/>
|
||||
<source>Bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="268"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="282"/>
|
||||
<source>My Device</source>
|
||||
<translation>我的设备</translation>
|
||||
</message>
|
|
@ -0,0 +1,39 @@
|
|||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 117379a..25d72c8 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -14,13 +14,14 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
// hints.flags = MWM_HINTS_DECORATIONS;
|
||||
// hints.decorations = MWM_DECOR_ALL;
|
||||
// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
-
|
||||
- trayicon = new TrayIcon();
|
||||
- connect(this, &TrayWidget::trayIconStatusChanged, trayicon, &TrayIcon::SetTrayIcon);
|
||||
- connect(trayicon, &TrayIcon::showTayWidget, this, &TrayWidget::showUI);
|
||||
- connect(trayicon, &TrayIcon::openBluetoothSettings, this, [=]{
|
||||
- _SessionDBus->openBluetoothSettings();
|
||||
- });
|
||||
+ if (!_Intel) {
|
||||
+ trayicon = new TrayIcon();
|
||||
+ connect(this, &TrayWidget::trayIconStatusChanged, trayicon, &TrayIcon::SetTrayIcon);
|
||||
+ connect(trayicon, &TrayIcon::showTayWidget, this, &TrayWidget::showUI);
|
||||
+ connect(trayicon, &TrayIcon::openBluetoothSettings, this, [=]{
|
||||
+ _SessionDBus->openBluetoothSettings();
|
||||
+ });
|
||||
+ }
|
||||
connect(QApplication::desktop(), &QDesktopWidget::resized, this, [=] {
|
||||
setWidgetPosition();
|
||||
});
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index c7a1605..7945bba 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -115,6 +115,8 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
|
||||
if (is_Intel) {
|
||||
this->setFixedSize(510, 287);
|
||||
+ title_icon->setGeometry(16,12,24,24);
|
||||
+ title_text->setGeometry(48,12,100,24);
|
||||
//top_label->setGeometry(24,60,456,50);
|
||||
tip_label->setGeometry(24,72,450,40);
|
||||
tip_label->setStyleSheet("QLabel{\
|
|
@ -0,0 +1,52 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 998611e..8dd0a27 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -388,7 +388,46 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
if (receiveTimer->isActive()) {
|
||||
receiveTimer->stop();
|
||||
} else
|
||||
- file_source->setText(tr("File from \"")+target_name+tr("\", is receiving..."));
|
||||
+ file_source->setText(tr("File from \"")+target_name+tr("\", is receiving..."));QString filePathName = QDir::homePath()+"/.cache/obexd/"+target_source;
|
||||
+ GError *error;
|
||||
+ qDebug() << Q_FUNC_INFO << filePathName;
|
||||
+ GFile *file = g_file_new_for_path(filePathName.toStdString().c_str());
|
||||
+ GFileInfo *file_info = g_file_query_info(file,"*",G_FILE_QUERY_INFO_NONE,NULL,&error);
|
||||
+ qDebug() << Q_FUNC_INFO << g_file_info_get_size(file_info) << g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+
|
||||
+ QString str = g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ QIcon fileicon;
|
||||
+ if (str.split("/").at(0) == "image"){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ if (fileicon.isNull()) {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else if (str.split("/").at(0) == "video")
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ else if (str.split("/").at(0) == "audio" ||
|
||||
+ str.split("/").at(0) == "application" ||
|
||||
+ str.split("/").at(0) == "text" ||
|
||||
+ str.split("/").at(0) == "inode"){
|
||||
+ if (QIcon::hasThemeIcon(str.split("/").join("-"))) {
|
||||
+ fileicon = QIcon::fromTheme(str.split("/").join("-"));
|
||||
+ } else {
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
+ this->update();
|
||||
+
|
||||
cancel_btn->disconnect();
|
||||
cancel_btn->connect(cancel_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->cancel();
|
|
@ -0,0 +1,56 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index a6dbc56..a6fb8a2 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -73,19 +73,22 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
this->close();
|
||||
});
|
||||
QIcon fileicon;
|
||||
- if (target_source.contains(".jpg", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".png", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".svg", Qt::CaseInsensitive)){
|
||||
- fileicon = QIcon::fromTheme("image");
|
||||
- }else if (target_source.contains(".mp4", Qt::CaseInsensitive)
|
||||
- || target_source.contains(".mkv", Qt::CaseInsensitive))
|
||||
- fileicon = QIcon::fromTheme("video-x-generic");
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
- if (fileicon.isNull())
|
||||
- fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (target_source.contains("."))
|
||||
+ {
|
||||
+ if (target_source.contains(".jpg", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".png", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".svg", Qt::CaseInsensitive)){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ }else if (target_source.contains(".mp4", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".mkv", Qt::CaseInsensitive))
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ }
|
||||
if (fileicon.isNull())
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
@@ -181,6 +184,7 @@ FileReceivingPopupWidget::~FileReceivingPopupWidget()
|
||||
}
|
||||
|
||||
void FileReceivingPopupWidget::updateUI(QString name, quint64 size, QString type) {
|
||||
+ fileNums += 1;
|
||||
qDebug() << Q_FUNC_INFO << name << size << type;
|
||||
move_file();
|
||||
QFontMetrics fontMetrics(file_source->font());
|
||||
@@ -314,7 +318,6 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO <<status ;
|
||||
if(status == QString("Active")){
|
||||
- fileNums += 1;
|
||||
if (receiveTimer->isActive()) {
|
||||
receiveTimer->stop();
|
||||
} else
|
|
@ -0,0 +1,52 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index e4d0c0a..af9532e 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -65,13 +65,14 @@ void QDevItem::SendMessage(bool connected)
|
||||
|
||||
void QDevItem::connectedChangedSlot(bool connected) {
|
||||
qDebug() << Q_FUNC_INFO << connected;
|
||||
- if (_iconTimer->isActive())
|
||||
+ if (_clicked) {
|
||||
_iconTimer->stop();
|
||||
+ _clicked = false;
|
||||
+ }
|
||||
if (_Connected == connected)
|
||||
return;
|
||||
- qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
_Connected = connected;
|
||||
- _clicked = false;
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
update();
|
||||
SendMessage(connected);
|
||||
}
|
||||
@@ -362,10 +363,12 @@ void QDevItem::MouseClickedFunc()
|
||||
_iconTimer->start(110);
|
||||
|
||||
//以下这个只执行一次的定时器,用来设置点击后加载动画的持续时间
|
||||
- QTimer::singleShot(3000,this,[=]{
|
||||
- _iconTimer->stop();
|
||||
- _clicked = false;
|
||||
- update();
|
||||
+ QTimer::singleShot(7000,this,[=]{
|
||||
+ if (_clicked) {
|
||||
+ _iconTimer->stop();
|
||||
+ _clicked = false;
|
||||
+ update();
|
||||
+ }
|
||||
});
|
||||
}
|
||||
}
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index f1e5af9..3b280fe 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -412,7 +412,7 @@ void TrayWidget::layoutAddAllPairedDev()
|
||||
QString name = pairedDevices.value(item).at(0);
|
||||
_SessionDBus->getDevConnectStatus(item);
|
||||
QDevItem *dev = new QDevItem(item, pairedDevices.value(item), _SessionDBus->isConnected(name), _PairedWidget);
|
||||
- connect(_SessionDBus, &BluetoothDbus::devConnectStatusSignal, this, [=](QString address, bool connected) {
|
||||
+ connect(_SessionDBus, &BluetoothDbus::devConnectStatusSignal, dev, [=](QString address, bool connected) {
|
||||
qDebug() << " +++ compare " << address << item;
|
||||
if (address != item)
|
||||
return;
|
|
@ -0,0 +1,105 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index fe5767d..a6dbc56 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -5,7 +5,8 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
target_name(devname),
|
||||
target_source(filename),
|
||||
root_address(root),
|
||||
- target_size(size)
|
||||
+ target_size(size),
|
||||
+ target_type(filename.split(".").length()-1)
|
||||
{
|
||||
// 添加窗管协议
|
||||
MotifWmHints hints;
|
||||
@@ -71,7 +72,22 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
emit this->rejected();
|
||||
this->close();
|
||||
});
|
||||
-
|
||||
+ QIcon fileicon;
|
||||
+ if (target_source.contains(".jpg", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".png", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".svg", Qt::CaseInsensitive)){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ }else if (target_source.contains(".mp4", Qt::CaseInsensitive)
|
||||
+ || target_source.contains(".mkv", Qt::CaseInsensitive))
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
file_source->setGeometry(32,52,460,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
@@ -87,7 +103,7 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
file_source->setWordWrap(true);
|
||||
|
||||
file_icon = new QLabel(this);
|
||||
- file_icon->setPixmap(QIcon::fromTheme("ukui-folder-documents-symbolic").pixmap(64,64));
|
||||
+ file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
file_icon->setAlignment(Qt::AlignCenter);
|
||||
file_icon->setGeometry(32,104,64,64);
|
||||
|
||||
@@ -303,6 +319,45 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
receiveTimer->stop();
|
||||
} else
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", is receiving..."));
|
||||
+ QString filePathName = QDir::homePath()+"/.cache/obexd/"+target_source;
|
||||
+ GError *error;
|
||||
+ qDebug() << Q_FUNC_INFO << filePathName;
|
||||
+ GFile *file = g_file_new_for_path(filePathName.toStdString().c_str());
|
||||
+ GFileInfo *file_info = g_file_query_info(file,"*",G_FILE_QUERY_INFO_NONE,NULL,&error);
|
||||
+ qDebug() << Q_FUNC_INFO << g_file_info_get_size(file_info) << g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+
|
||||
+ QString str = g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ QIcon fileicon;
|
||||
+ if (str.split("/").at(0) == "image"){
|
||||
+ fileicon = QIcon::fromTheme("image");
|
||||
+ if (fileicon.isNull()) {
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else if (str.split("/").at(0) == "video")
|
||||
+ fileicon = QIcon::fromTheme("video-x-generic");
|
||||
+ else if (str.split("/").at(0) == "audio" ||
|
||||
+ str.split("/").at(0) == "application" ||
|
||||
+ str.split("/").at(0) == "text" ||
|
||||
+ str.split("/").at(0) == "inode"){
|
||||
+ if (QIcon::hasThemeIcon(str.split("/").join("-"))) {
|
||||
+ fileicon = QIcon::fromTheme(str.split("/").join("-"));
|
||||
+ } else {
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme(QString("application-wps-office.")+target_source.split(".").at(1));
|
||||
+ if (fileicon.isNull())
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ }
|
||||
+ }else
|
||||
+ fileicon = QIcon::fromTheme("text");
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
+ this->update();
|
||||
cancel_btn->disconnect();
|
||||
cancel_btn->connect(cancel_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->cancel();
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
index f2dfe43..cf066d3 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
@@ -91,6 +91,7 @@ private:
|
||||
QString target_source;
|
||||
QString root_address;
|
||||
QString file_path;
|
||||
+ QString target_type;
|
||||
quint64 target_size;
|
||||
QTimer *receiveTimer;
|
||||
int fileNums = 0;
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 9dcb9ea..16b52fe 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -380,7 +380,12 @@ void Daemon::continueSendFiles(QString filename) {
|
||||
QDBusConnection::sessionBus().send(statusChanged);
|
||||
});
|
||||
}else{
|
||||
-// transfer_widget->tranfer_error();
|
||||
+ QDBusMessage statusChanged = QDBusMessage::createSignal("/com/ukui/bluetooth",
|
||||
+ "com.ukui.bluetooth",
|
||||
+ "statusChanged");
|
||||
+ statusChanged << QString("Error");
|
||||
+
|
||||
+ QDBusConnection::sessionBus().send(statusChanged);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index dcb1262..a71d2e3 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -108,7 +108,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
}else
|
||||
fileName = fontMetrics.elidedText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1), Qt::ElideMiddle, 280);
|
||||
target_name = new QLabel(fileName,this);
|
||||
- target_name->setGeometry(112,63,300,20);
|
||||
+ target_name->setGeometry(112,63,400,20);
|
||||
target_name->setStyleSheet("QLabel{\
|
||||
width: 300px;\
|
||||
height: 20px;\
|
||||
@@ -321,7 +321,7 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
||||
target_icon->setGeometry(32,95,64,64);
|
||||
- target_name->setGeometry(112,102,300,20);
|
||||
+ target_name->setGeometry(112,102,400,20);
|
||||
target_size->setGeometry(112,127,68,30);
|
||||
|
||||
main_animation_group = new QParallelAnimationGroup(this);
|
|
@ -0,0 +1,113 @@
|
|||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index f17ad13..abf51e9 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -288,13 +288,28 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
this->setFixedSize(520,276);
|
||||
|
||||
|
||||
- QString Name = dev_widget->get_seleter_dev_name();
|
||||
- if (dev_widget->get_seleter_dev_name().size() > 30) {
|
||||
- Name.remove(30, dev_widget->get_seleter_dev_name().size() - 30);
|
||||
- Name.append("...");
|
||||
- tip_text->setToolTip(dev_widget->get_seleter_dev_name());
|
||||
+
|
||||
+ QString nName;
|
||||
+ nName = dev_widget->get_seleter_dev_name();
|
||||
+ float shownum = 0;
|
||||
+ for (int i = 0; i < dev_widget->get_seleter_dev_name().size(); i++) {
|
||||
+ QChar ch = dev_widget->get_seleter_dev_name().at(i);
|
||||
+ ushort uNum = ch.unicode();
|
||||
+ if ((uNum >= 0x4E00 && uNum <= 0x9FA5))
|
||||
+ shownum += 1.7;
|
||||
+ else if (ch == 'm' || ch == 'M')
|
||||
+ shownum += 1.5;
|
||||
+ else
|
||||
+ shownum += 1;
|
||||
+ if (shownum + 1.5 >= 30) {
|
||||
+ nName.remove(i, dev_widget->get_seleter_dev_name().size() - i);
|
||||
+ nName.append("...");
|
||||
+ tip_text->setToolTip(dev_widget->get_seleter_dev_name());
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
- tip_text->setText(tr("Transferring to \"")+Name+"\"");
|
||||
+
|
||||
+ tip_text->setText(tr("Transferring to \"")+nName+"\"");
|
||||
tip_text->update();
|
||||
|
||||
ok_btn->setVisible(false);
|
||||
diff --git a/ukui-bluetooth/fileSend/deviceselectitem.cpp b/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
index 8562a8a..90323a8 100644
|
||||
--- a/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/deviceselectitem.cpp
|
||||
@@ -193,9 +193,26 @@ void DeviceSelectItem::paintEvent(QPaintEvent *) {
|
||||
QString nName;
|
||||
nName = MName;
|
||||
int fontSize = StyleSettings->get("system-font-size").toInt();
|
||||
- if (MName.size() > FontTable[fontSize - 10]) {
|
||||
- nName.remove(FontTable[fontSize - 10], MName.size() - FontTable[fontSize - 10]);
|
||||
- nName.append("...");
|
||||
+ if (fontSize > 15)
|
||||
+ fontSize = 15;
|
||||
+ if (fontSize < 10)
|
||||
+ fontSize = 10;
|
||||
+ float shownum = 0;
|
||||
+ for (int i = 0; i < MName.size(); i++) {
|
||||
+ QChar ch = MName.at(i);
|
||||
+ ushort uNum = ch.unicode();
|
||||
+ if ((uNum >= 0x4E00 && uNum <= 0x9FA5))
|
||||
+ shownum += 1.7;
|
||||
+ else if (ch == 'm' || ch == 'M')
|
||||
+ shownum += 1.5;
|
||||
+ else
|
||||
+ shownum += 1;
|
||||
+ if (shownum + 1.5 >= FontTable[fontSize - 10]) {
|
||||
+ nName.remove(i, MName.size() - i);
|
||||
+ nName.append("...");
|
||||
+ this->setToolTip(MName);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
painter.drawText(40,13,380,28,Qt::AlignLeft, nName);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index b7d7a85..7045ff9 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -58,10 +58,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
Name.append("...");
|
||||
}
|
||||
if(show_flag) {
|
||||
- if (is_Intel)
|
||||
- tip_text = tr("If you want to pair with this device, please make sure the numbers below are the same with the devices.");
|
||||
- else
|
||||
- tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
+ tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
} else
|
||||
tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !")).arg(Name);
|
||||
//top_label = new QLabel(top_text,this);
|
||||
@@ -114,12 +111,18 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
close_btn->setGeometry(480,8,30,30);
|
||||
|
||||
if (is_Intel) {
|
||||
- this->setFixedSize(520, 328);
|
||||
+ this->setFixedSize(510, 287);
|
||||
//top_label->setGeometry(24,60,456,50);
|
||||
- tip_label->setGeometry(24,118,450,40);
|
||||
- PIN_label->setGeometry(24,163,462,47);
|
||||
- accept_btn->setGeometry(373,248,112,56);
|
||||
- refuse_btn->setGeometry(246,248,112,56);
|
||||
+ tip_label->setGeometry(24,72,450,40);
|
||||
+ tip_label->setStyleSheet("QLabel{\
|
||||
+ font-size: 16px;\
|
||||
+ font-family: Noto Sans CJK SC;\
|
||||
+ font-weight: 400;\
|
||||
+ line-height: 24px;}");
|
||||
+ PIN_label->setGeometry(24,136,462,47);
|
||||
+ accept_btn->setGeometry(373,207,112,56);
|
||||
+ refuse_btn->setGeometry(246,207,112,56);
|
||||
+ close_btn->setGeometry(470, 8, 30, 30);
|
||||
PIN_label->setStyleSheet("QLabel{\
|
||||
font-size: 40px;\
|
||||
font-family: Noto Sans CJK SC;\
|
|
@ -0,0 +1,141 @@
|
|||
diff --git a/ukui-bluetooth/component/bluetoothsettinglabel.cpp b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
index a46fafb..cb27087 100644
|
||||
--- a/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
+++ b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
@@ -4,8 +4,6 @@ BluetoothSettingLabel::BluetoothSettingLabel(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
_MStatus = Normal;
|
||||
this->setFixedSize(420,50);
|
||||
- this->setAutoFillBackground(true);
|
||||
- this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
connect(StyleSettings,&QGSettings::changed,this,[=]{
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 149ea45..808e5d8 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -22,6 +22,8 @@ void BluetoothDbus::connectDBusSignals() {
|
||||
//适配器相关dbus
|
||||
CONNECT_DBUS_SIGNAL("defaultAdapterPowerChanged", defaultAdapterPowerChangedSLot(bool));
|
||||
CONNECT_DBUS_SIGNAL("defaultAdapterChanged", defaultAdapterChangedSLot(QString));
|
||||
+ CONNECT_DBUS_SIGNAL("adapterRemoveSignal", adapterRemoveSignalSLot(QString));
|
||||
+ CONNECT_DBUS_SIGNAL("adapterAddSignal", adapterAddSignalSLot(QString));
|
||||
|
||||
//连接移除相关dbus
|
||||
CONNECT_DBUS_SIGNAL("devConnectStatusSignal", devConnectStatusSignalSLot(QString, bool));
|
||||
@@ -53,7 +55,28 @@ void BluetoothDbus::defaultAdapterPowerChangedSLot(bool value) {
|
||||
emit powerChangedSignal(powered);
|
||||
}
|
||||
|
||||
+void BluetoothDbus::adapterRemoveSignalSLot(QString address) {
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << address;
|
||||
+ QDBusMessage _m = CREATE_METHOD_CALL("getAdapterDevAddressList");
|
||||
+ QDBusMessage _response1 = CALL_METHOD(_m);
|
||||
+ if (_response1.type() == QDBusMessage::ReplyMessage)
|
||||
+ {
|
||||
+ if (_response1.arguments().takeFirst().toStringList().size() == 0) {
|
||||
+ emit showTrayIcon(false);
|
||||
+ }
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << _response1.arguments().takeFirst().toStringList();
|
||||
+ }
|
||||
+ emit adapterRemoveSignal(address);
|
||||
+}
|
||||
+
|
||||
+void BluetoothDbus::adapterAddSignalSLot(QString address) {
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << address;
|
||||
+ emit showTrayIcon(true);
|
||||
+ emit adapterAddSignal(address);
|
||||
+}
|
||||
+
|
||||
void BluetoothDbus::defaultAdapterChangedSLot(QString value) {
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__ << value;
|
||||
getDefaultAdapterPairedDevices();
|
||||
emit AdapterChangedSignal(value);
|
||||
}
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.h b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
index 3cb9422..365052f 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -75,6 +75,9 @@ public:
|
||||
QMap<QString, QStringList> getPairedDevices();
|
||||
|
||||
signals:
|
||||
+ void showTrayIcon(bool);
|
||||
+ void adapterAddSignal(QString);
|
||||
+ void adapterRemoveSignal(QString);
|
||||
void powerChangedSignal(bool);
|
||||
void displayPasskeySignal(QString,QString);
|
||||
void receiveFilesSignal(QString,QString,QString,QString,quint64);
|
||||
@@ -102,6 +105,8 @@ private:
|
||||
QMap<QString, QString> connectedDevice;
|
||||
|
||||
private slots:
|
||||
+ void adapterAddSignalSLot(QString address);
|
||||
+ void adapterRemoveSignalSLot(QString address);
|
||||
void defaultAdapterPowerChangedSLot(bool value);
|
||||
void defaultAdapterChangedSLot(QString value);
|
||||
void devPairSignalSLot(QString address, bool paired);
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.cpp b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
index 903b8c4..413b6b2 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
@@ -77,8 +77,16 @@ void TrayIcon::GSettings_value_chanage(const QString &key)
|
||||
qDebug() << Q_FUNC_INFO << key;
|
||||
if(key != "trayShow")
|
||||
return;
|
||||
+ if (!hasAdapter)
|
||||
+ return;
|
||||
if(bluetooth_tray_icon->isVisible() != settings->get(key).toBool()){
|
||||
bluetooth_tray_icon->setVisible(settings->get(key).toBool());
|
||||
}
|
||||
}
|
||||
|
||||
+void TrayIcon::SetAdapterFlag(bool set) {
|
||||
+ hasAdapter = set;
|
||||
+ if (!settings->get("trayShow").toBool() && set)
|
||||
+ return;
|
||||
+ bluetooth_tray_icon->setVisible(set);
|
||||
+}
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.h b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
index 5f14729..9a64da5 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.h
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
TrayIcon(QWidget *parent = nullptr);
|
||||
~TrayIcon();
|
||||
void InitTrayWidget();
|
||||
+ void SetAdapterFlag(bool set);
|
||||
|
||||
signals:
|
||||
void showTayWidget();
|
||||
@@ -43,5 +44,6 @@ private:
|
||||
QMenu *tray_Menu = nullptr;
|
||||
QGSettings *StyleSettings = nullptr;
|
||||
QGSettings *settings = nullptr;
|
||||
+ bool hasAdapter = true;
|
||||
} ;
|
||||
#endif // TRAYICON_H
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 25d72c8..cf56849 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -21,6 +21,9 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
connect(trayicon, &TrayIcon::openBluetoothSettings, this, [=]{
|
||||
_SessionDBus->openBluetoothSettings();
|
||||
});
|
||||
+ connect(_SessionDBus, &BluetoothDbus::showTrayIcon, this, [=](bool show) {
|
||||
+ trayicon->SetAdapterFlag(show);
|
||||
+ });
|
||||
}
|
||||
connect(QApplication::desktop(), &QDesktopWidget::resized, this, [=] {
|
||||
setWidgetPosition();
|
||||
@@ -146,6 +149,8 @@ void TrayWidget::setWidgetPosition()
|
||||
"/panel/position",
|
||||
"org.ukui.panel",
|
||||
QDBusConnection::sessionBus());
|
||||
+ if (!iface.isValid())
|
||||
+ return;
|
||||
QDBusReply<QVariantList> reply=iface.call("GetPrimaryScreenGeometry");
|
||||
//reply获取的参数共5个,分别是 主屏可用区域的起点x坐标,主屏可用区域的起点y坐标,主屏可用区域的宽度,主屏可用区域高度,任务栏位置
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index da0aafc..1a3b161 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -89,14 +89,14 @@ void BluetoothDbus::devPairSignalSLot(QString address, bool paired) {
|
||||
if (!pairedList.contains(address))
|
||||
pairedList.append(address);
|
||||
addNewPairedDevice(address);
|
||||
- emit devPairSignal(pairedDevice.value(address).at(0),paired);
|
||||
+ emit sessionDevPairSignal(pairedDevice.value(address).at(0),paired);
|
||||
}
|
||||
if (!paired && pairedDevice.contains(address)) {
|
||||
QString name = pairedDevice.value(address).at(0);
|
||||
if (pairedList.contains(address))
|
||||
pairedList.removeAll(address);
|
||||
pairedDevice.remove(address);
|
||||
- emit devPairSignal(name, paired);
|
||||
+ emit sessionDevPairSignal(name, paired);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ void BluetoothDbus::getDevConnectStatus(QString address) {
|
||||
&& connectedDevice.values().contains(address)
|
||||
&& pairedDevice.keys().contains(address))
|
||||
connectedDevice.remove(pairedDevice.value(address).at(0));
|
||||
- qDebug() << "init connect status : " << connected << address;
|
||||
+ qDebug() << "init connect status : " << connected << address << pairedDevice;
|
||||
} else {
|
||||
qDebug() << " init connect status method called failed!";
|
||||
}
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.h b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
index ba93476..0e40b1b 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -91,7 +91,7 @@ signals:
|
||||
void devRemoveSignal(QString);
|
||||
void devNameChangedSignal();
|
||||
void devBatteryChangedSignal();
|
||||
- void devPairSignal(QString, bool);
|
||||
+ void sessionDevPairSignal(QString, bool);
|
||||
void sendTransferFilesMesgSignal(QStringList);
|
||||
void sendTransferDeviceMesgSignal(QString);
|
||||
void AdapterChangedSignal(QString);
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index f64edf0..245ab47 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -150,6 +150,7 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
this->move(QPoint(desktop.right()-this->width(),desktop.bottom()-this->height()));
|
||||
|
||||
window_pop_up_animation();
|
||||
+ this->activateWindow();
|
||||
}
|
||||
|
||||
FileReceivingPopupWidget::~FileReceivingPopupWidget()
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index dfd12ca..1fa303e 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -24,7 +24,7 @@ MainProgram::MainProgram(bool intel, QObject *parent) :
|
||||
});
|
||||
connect(_sessionDbus, &BluetoothDbus::displayPasskeySignal, this, &MainProgram::displayPasskeySlot);
|
||||
connect(_sessionDbus, &BluetoothDbus::requestConfirmationSignal, this, &MainProgram::requestConfirmationSlot);
|
||||
- connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired) {
|
||||
+ connect(_sessionDbus, &BluetoothDbus::sessionDevPairSignal, this, [=](QString _name, bool paired) {
|
||||
Q_UNUSED(_name);
|
||||
Q_UNUSED(paired);
|
||||
UI->layoutAddOnePairedDev(_name, paired);
|
||||
@@ -278,14 +278,13 @@ void MainProgram::displayPasskeySlot(QString name, QString passkey)
|
||||
});
|
||||
|
||||
disconnect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, nullptr, nullptr);
|
||||
- disconnect(_sessionDbus, &BluetoothDbus::devPairSignal, nullptr, nullptr);
|
||||
|
||||
connect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, this, [=]() {
|
||||
if(nullptr != Keypincodewidget)
|
||||
Keypincodewidget->pairFailureShow();
|
||||
disconnect(_sessionDbus, &BluetoothDbus::pairAgentCanceledSignal, nullptr, nullptr);
|
||||
});
|
||||
- connect(_sessionDbus, &BluetoothDbus::devPairSignal, this, [=](QString _name, bool paired){
|
||||
+ connect(_sessionDbus, &BluetoothDbus::sessionDevPairSignal, this, [=](QString _name, bool paired){
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
if (name != _name || nullptr == Keypincodewidget)
|
||||
return;
|
||||
@@ -294,7 +293,6 @@ void MainProgram::displayPasskeySlot(QString name, QString passkey)
|
||||
Keypincodewidget->setHidden(true);
|
||||
emit Keypincodewidget->msgShowedOver();
|
||||
}
|
||||
- disconnect(_sessionDbus, &BluetoothDbus::devPairSignal, nullptr, nullptr);
|
||||
});
|
||||
//保持在最前
|
||||
Keypincodewidget->show();
|
|
@ -0,0 +1,885 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index b0a50d1..d229165 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -8,10 +8,14 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
root_address(root),
|
||||
target_size(size)
|
||||
{
|
||||
+ isIntel = QFile::exists("/etc/apt/ota_version");
|
||||
// 添加窗管协议
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
- hints.functions = MWM_FUNC_ALL;
|
||||
+ if (isIntel)
|
||||
+ hints.functions = MWM_FUNC_CLOSE;
|
||||
+ else
|
||||
+ hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
@@ -19,7 +23,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
connect(StyleSettings,&QGSettings::changed,this,&FileReceivingPopupWidget::GSettingsChanges);
|
||||
}
|
||||
- this->setFixedSize(520,276);
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("Bluetooth file transfer"));
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -42,35 +45,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
file_path = QDir::homePath();
|
||||
}
|
||||
|
||||
- QDesktopWidget *desktop_widget = QApplication::desktop();
|
||||
- desktop = desktop_widget->availableGeometry();
|
||||
- qDebug() << Q_FUNC_INFO << this->width() << this->height();
|
||||
- qDebug() << Q_FUNC_INFO <<desktop <<desktop.right() << desktop.bottom() << desktop.right()-this->width() << desktop.bottom()-this->height();
|
||||
- this->move(QPoint(desktop.right()-this->width(),desktop.bottom()-this->height()));
|
||||
-
|
||||
- window_pop_up_animation();
|
||||
-
|
||||
- close_btn = new QPushButton(this);
|
||||
- close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
- close_btn->setGeometry(480,4,30,30);
|
||||
- close_btn->setProperty("isWindowButton", 0x2);
|
||||
- close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
- close_btn->setFlat(true);
|
||||
-
|
||||
- icon_label = new QLabel(this);
|
||||
- icon_label->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
- icon_label->setGeometry(8,8,22,22);
|
||||
-
|
||||
- window_Title = new QLabel(tr("Bluetooth File"),this);
|
||||
- window_Title->setFixedSize(100,20);
|
||||
- QFont ft;
|
||||
- ft.setPixelSize(14);
|
||||
- window_Title->setFont(ft);
|
||||
- window_Title->setGeometry(36, 9, 100, 20);
|
||||
- connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- emit this->rejected();
|
||||
- this->close();
|
||||
- });
|
||||
QIcon fileicon;
|
||||
if (target_type.split("/").at(0) == "image"){
|
||||
fileicon = QIcon::fromTheme("image");
|
||||
@@ -99,8 +73,9 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
}else
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
- file_source->setGeometry(32,52,460,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(14);
|
||||
QFont ft1;
|
||||
ft1.setPixelSize(18);
|
||||
file_source->setFont(ft1);
|
||||
@@ -115,13 +90,11 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
file_icon = new QLabel(this);
|
||||
file_icon->setPixmap(fileicon.pixmap(64,64));
|
||||
file_icon->setAlignment(Qt::AlignCenter);
|
||||
- file_icon->setGeometry(32,104,64,64);
|
||||
|
||||
QFontMetrics fontMetrics(file_source->font());
|
||||
QString fileName = fontMetrics.elidedText(target_source, Qt::ElideMiddle, 280);
|
||||
file_name = new QLabel(fileName,this);
|
||||
file_name->setToolTip(target_source);
|
||||
- file_name->setGeometry(112,111,293,20);
|
||||
file_name->setFont(ft);
|
||||
file_name->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
|
||||
file_name->setWordWrap(true);
|
||||
@@ -134,26 +107,23 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
}
|
||||
|
||||
file_size = new QLabel(QString::asprintf("%.2f", calc_size) + unitString[unitcount],this);
|
||||
- file_size->setGeometry(112,136,293,20);
|
||||
+
|
||||
file_size->setFont(ft);
|
||||
file_size->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
|
||||
file_size->setWordWrap(true);
|
||||
|
||||
transfer_progress = new QProgressBar(this);
|
||||
- transfer_progress->setGeometry(32,184,454,8);
|
||||
transfer_progress->setFixedHeight(8);
|
||||
transfer_progress->setTextVisible(false);
|
||||
transfer_progress->setVisible(false);
|
||||
|
||||
cancel_btn = new QPushButton(tr("Cancel"),this);
|
||||
- cancel_btn->setGeometry(278,215,96,36);
|
||||
connect(cancel_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->rejected();
|
||||
this->close();
|
||||
});
|
||||
|
||||
accept_btn = new QPushButton(tr("Accept"),this);
|
||||
- accept_btn->setGeometry(390,215,96,36);
|
||||
connect(accept_btn,&QPushButton::clicked,this,[=]{
|
||||
OnClickedAcceptBtn();
|
||||
});
|
||||
@@ -162,27 +132,27 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
warn_icon->setPixmap(QIcon::fromTheme("kylin-dialog-warning").pixmap(22,22));
|
||||
if (warn_icon->pixmap()->isNull())
|
||||
warn_icon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(22,22));
|
||||
- warn_icon->setGeometry(32,54,22,22);
|
||||
warn_icon->setVisible(false);
|
||||
|
||||
view_btn = new QPushButton(tr("View"),this);
|
||||
- view_btn->setGeometry(390,215,120,36);
|
||||
view_btn->setVisible(false);
|
||||
|
||||
receivedFiles.clear();
|
||||
receiveTimer = new QTimer(this);
|
||||
connect(receiveTimer,SIGNAL(timeout()), this, SLOT(transferCompelete()));
|
||||
|
||||
- isIntel = QFile::exists("/etc/apt/ota_version");
|
||||
- if (isIntel) {
|
||||
- accept_btn->setGeometry(390,205,112,56);
|
||||
- cancel_btn->setGeometry(262,205,112,56);
|
||||
- file_name->setGeometry(112,111,293,23);
|
||||
- file_size->setGeometry(112,136,293,23);
|
||||
- ft.setPixelSize(16);
|
||||
- file_size->setFont(ft);
|
||||
- file_name->setFont(ft);
|
||||
- }
|
||||
+ if (isIntel)
|
||||
+ initIntelLayout();
|
||||
+ else
|
||||
+ initLayout();
|
||||
+
|
||||
+ QDesktopWidget *desktop_widget = QApplication::desktop();
|
||||
+ desktop = desktop_widget->availableGeometry();
|
||||
+ qDebug() << Q_FUNC_INFO << this->width() << this->height();
|
||||
+ qDebug() << Q_FUNC_INFO <<desktop <<desktop.right() << desktop.bottom() << desktop.right()-this->width() << desktop.bottom()-this->height();
|
||||
+ this->move(QPoint(desktop.right()-this->width(),desktop.bottom()-this->height()));
|
||||
+
|
||||
+ window_pop_up_animation();
|
||||
}
|
||||
|
||||
FileReceivingPopupWidget::~FileReceivingPopupWidget()
|
||||
@@ -190,6 +160,60 @@ FileReceivingPopupWidget::~FileReceivingPopupWidget()
|
||||
delete settings;
|
||||
}
|
||||
|
||||
+void FileReceivingPopupWidget::initLayout() {
|
||||
+ this->setFixedSize(520,276);
|
||||
+ close_btn = new QPushButton(this);
|
||||
+ close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
+ close_btn->setProperty("isWindowButton", 0x2);
|
||||
+ close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
+ close_btn->setFlat(true);
|
||||
+
|
||||
+ icon_label = new QLabel(this);
|
||||
+ icon_label->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
+
|
||||
+ window_Title = new QLabel(tr("Bluetooth File"),this);
|
||||
+ window_Title->setFixedSize(100,20);
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(14);
|
||||
+ window_Title->setFont(ft);
|
||||
+ connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
+ emit this->rejected();
|
||||
+ this->close();
|
||||
+ });
|
||||
+
|
||||
+ close_btn->setGeometry(480,4,30,30);
|
||||
+ icon_label->setGeometry(8,8,22,22);
|
||||
+ window_Title->setGeometry(36, 9, 100, 20);
|
||||
+ view_btn->setGeometry(390,215,120,36);
|
||||
+ file_source->setGeometry(32,52,460,54);
|
||||
+ file_icon->setGeometry(32,104,64,64);
|
||||
+ file_name->setGeometry(112,111,293,20);
|
||||
+ file_size->setGeometry(112,136,293,20);
|
||||
+ transfer_progress->setGeometry(32,184,454,8);
|
||||
+ cancel_btn->setGeometry(278,215,96,36);
|
||||
+ accept_btn->setGeometry(390,215,96,36);
|
||||
+ warn_icon->setGeometry(32,54,22,22);
|
||||
+}
|
||||
+
|
||||
+void FileReceivingPopupWidget::initIntelLayout() {
|
||||
+ this->setWindowFlags(Qt::Dialog);
|
||||
+ this->setFixedSize(520,256);
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(16);
|
||||
+ file_size->setFont(ft);
|
||||
+ file_name->setFont(ft);
|
||||
+
|
||||
+ accept_btn->setGeometry(390,185,112,56);
|
||||
+ cancel_btn->setGeometry(262,185,112,56);
|
||||
+ file_name->setGeometry(112,91,293,23);
|
||||
+ file_size->setGeometry(112,116,293,23);
|
||||
+ view_btn->setGeometry(390,195,120,36);
|
||||
+ file_source->setGeometry(32,32,460,54);
|
||||
+ file_icon->setGeometry(32,84,64,64);
|
||||
+ transfer_progress->setGeometry(32,164,454,8);
|
||||
+ warn_icon->setGeometry(32,34,22,22);
|
||||
+}
|
||||
+
|
||||
void FileReceivingPopupWidget::updateUI(QString name, quint64 size, QString type) {
|
||||
fileNums += 1;
|
||||
qDebug() << Q_FUNC_INFO << name << size << type;
|
||||
@@ -325,10 +349,12 @@ void FileReceivingPopupWidget::update_transfer_progress_bar(quint64 value)
|
||||
}
|
||||
|
||||
void FileReceivingPopupWidget::transferCompelete() {
|
||||
- close_btn->disconnect();
|
||||
- close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- this->close();
|
||||
- });
|
||||
+ if (!isIntel) {
|
||||
+ close_btn->disconnect();
|
||||
+ close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
+ this->close();
|
||||
+ });
|
||||
+ }
|
||||
cancel_btn->setVisible(false);
|
||||
|
||||
bool x = move_file();
|
||||
@@ -365,11 +391,13 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
emit this->cancel();
|
||||
isCanceled = true;
|
||||
});
|
||||
- close_btn->disconnect();
|
||||
- close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- emit this->cancel();
|
||||
- isCanceled = true;
|
||||
- });
|
||||
+ if (!isIntel) {
|
||||
+ close_btn->disconnect();
|
||||
+ close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
+ emit this->cancel();
|
||||
+ isCanceled = true;
|
||||
+ });
|
||||
+ }
|
||||
}else if(status == QString("Complete")){
|
||||
receiveTimer->start(2000);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__ ;
|
||||
@@ -380,10 +408,12 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
accept_btn->connect(accept_btn,&QPushButton::clicked,this,[=]{
|
||||
this->close();
|
||||
});
|
||||
- close_btn->disconnect();
|
||||
- close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- this->close();
|
||||
- });
|
||||
+ if (!isIntel) {
|
||||
+ close_btn->disconnect();
|
||||
+ close_btn->connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
+ this->close();
|
||||
+ });
|
||||
+ }
|
||||
cancel_btn->setVisible(false);
|
||||
view_btn->setVisible(false);
|
||||
transfer_progress->setVisible(false);
|
||||
@@ -393,13 +423,13 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
|
||||
|
||||
file_source->setText(tr("File from \"")+target_name+tr("\", received failed !"));
|
||||
- file_source->setGeometry(62,52,430,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
+ file_source->setGeometry(62,52,430,54);
|
||||
warn_icon->setVisible(true);
|
||||
if (isIntel) {
|
||||
warn_icon->setFixedSize(64,64);
|
||||
warn_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
- warn_icon->setGeometry(220,86,64,64);
|
||||
+ warn_icon->setGeometry(220,66,64,64);
|
||||
file_source->setText(tr("File Transmission Failed !"));
|
||||
file_source->setFixedWidth(505);
|
||||
file_source->setStyleSheet("QLabel{\
|
||||
@@ -408,7 +438,7 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #FB5050;}");
|
||||
- file_source->setGeometry(12,150,505,24);
|
||||
+ file_source->setGeometry(12,130,505,24);
|
||||
file_source->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
this->activateWindow();
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
index 4153af1..b1fe108 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.h
|
||||
@@ -66,7 +66,7 @@ signals:
|
||||
void clearOldSession();
|
||||
private:
|
||||
bool isCanceled = false;
|
||||
- bool isIntel;
|
||||
+ bool isIntel = false;
|
||||
QGSettings *StyleSettings = nullptr;
|
||||
QGSettings *settings = nullptr;
|
||||
QGSettings *transparency_gsettings = nullptr;
|
||||
@@ -98,6 +98,9 @@ private:
|
||||
int fileNums = 0;
|
||||
QList<QString> receivedFiles;
|
||||
|
||||
+ void initLayout();
|
||||
+ void initIntelLayout();
|
||||
+
|
||||
};
|
||||
|
||||
#endif // FILERECEIVINGPOPUPWIDGET_H
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 282c544..68ccfc0 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -10,6 +10,8 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
isShow = true;
|
||||
send_state = _SEND_NONE;
|
||||
|
||||
+ is_Intel = QFile::exists("/etc/apt/ota_version");
|
||||
+
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
GSettings = new QGSettings("org.ukui.style");
|
||||
connect(GSettings,&QGSettings::changed,this,&BluetoothFileTransferWidget::GSettingsChanges);
|
||||
@@ -18,12 +20,14 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
//窗管协议
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
- hints.functions = MWM_FUNC_ALL;
|
||||
+ if (is_Intel)
|
||||
+ hints.functions = MWM_FUNC_CLOSE;
|
||||
+ else
|
||||
+ hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
- this->setFixedSize(520,620);
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("Bluetooth file transfer"));
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -40,34 +44,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
QDesktopWidget *deskdop = QApplication::desktop();
|
||||
move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
|
||||
- title_icon = new QLabel(this);
|
||||
- title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
- title_icon->resize(22,22);
|
||||
- title_icon->setGeometry(8,8,22,22);
|
||||
-
|
||||
- title_text = new QLabel(tr("Bluetooth file transfer"),this);
|
||||
- title_text->setGeometry(36,8,200,20);
|
||||
- title_text->setStyleSheet("QLabel{\
|
||||
- width: 200px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
-
|
||||
- close_btn = new QPushButton(this);
|
||||
- close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
- close_btn->setProperty("isWindowButton", 0x2);
|
||||
- close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
- close_btn->setFlat(true);
|
||||
- close_btn->setFixedSize(30,30);
|
||||
- close_btn->setGeometry(484,4,30,30);
|
||||
- connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
- emit close_the_pre_session();
|
||||
- this->close();
|
||||
- });
|
||||
-
|
||||
tip_text = new QLabel(tr("Transferring to \"")+dev_name+"\"",this);
|
||||
tip_text->setStyleSheet("QLabel{\
|
||||
width: 214px;\
|
||||
@@ -77,14 +53,12 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
font-weight: 500;\
|
||||
line-height: 24px;\
|
||||
opacity: 1;}");
|
||||
- tip_text->setGeometry(32,52,452,28);
|
||||
tip_text->setVisible(false);
|
||||
|
||||
initFileInfo();
|
||||
|
||||
target_icon = new QLabel(this);
|
||||
target_icon->setPixmap(file_icon.at(0).pixmap(64,64));
|
||||
- target_icon->setGeometry(32,56,64,64);
|
||||
|
||||
target_size = new QLabel(file_size.at(0),this);
|
||||
target_size->setStyleSheet("QLabel{\
|
||||
@@ -96,7 +70,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
color: #818181;\
|
||||
opacity: 1;\
|
||||
}");
|
||||
- target_size->setGeometry(112,88,70,30);
|
||||
|
||||
QFontMetrics fontMetrics(target_size->font());
|
||||
QString fileName;
|
||||
@@ -108,7 +81,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
}else
|
||||
fileName = fontMetrics.elidedText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1), Qt::ElideMiddle, 280);
|
||||
target_name = new QLabel(fileName,this);
|
||||
- target_name->setGeometry(112,63,400,20);
|
||||
target_name->setStyleSheet("QLabel{\
|
||||
width: 300px;\
|
||||
height: 20px;\
|
||||
@@ -122,7 +94,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
- transNum->setGeometry(459,168,52,20);
|
||||
transNum->setVisible(false);
|
||||
transNum->setStyleSheet("QLabel{\
|
||||
width: 22px;\
|
||||
@@ -136,10 +107,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
m_progressbar = new QProgressBar(this);
|
||||
m_progressbar->setOrientation(Qt::Horizontal);
|
||||
- if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,175,406,8);
|
||||
- else
|
||||
- m_progressbar->setGeometry(32,175,454,8);
|
||||
m_progressbar->setTextVisible(false);
|
||||
m_progressbar->setVisible(false);
|
||||
|
||||
@@ -153,15 +120,12 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
font-weight: 400;\
|
||||
line-height: 24px;\
|
||||
opacity: 1;}");
|
||||
- Tiptop->setGeometry(32,144,100,20);
|
||||
|
||||
dev_widget = new DeviceSeleterWidget(devicelist, this,dev_address);
|
||||
dev_widget->resize(456,356);
|
||||
- dev_widget->setGeometry(32,175,456,356);
|
||||
|
||||
ok_btn = new QPushButton(tr("OK"),this);
|
||||
ok_btn->setFixedSize(100,36);
|
||||
- ok_btn->setGeometry(392,560,100,36);
|
||||
if(dev_widget->get_seleter_device().isNull()){
|
||||
ok_btn->setEnabled(false);
|
||||
}
|
||||
@@ -175,7 +139,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
cancel_btn = new QPushButton(tr("Cancel"),this);
|
||||
cancel_btn->setFixedSize(100,36);
|
||||
- cancel_btn->setGeometry(280,560,100,36);
|
||||
connect(cancel_btn,&QPushButton::clicked,this,[=]{
|
||||
emit this->close_the_pre_session();
|
||||
this->close();
|
||||
@@ -186,11 +149,9 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
if (tranfer_status_icon->pixmap()->isNull())
|
||||
tranfer_status_icon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(22,22));
|
||||
tranfer_status_icon->setFixedSize(22,22);
|
||||
- tranfer_status_icon->setGeometry(32,55,22,22);
|
||||
tranfer_status_icon->setVisible(false);
|
||||
|
||||
tranfer_status_text = new QLabel(this);
|
||||
- tranfer_status_text->setGeometry(62,53,376,27);
|
||||
tranfer_status_text->setText(tr("File Transmission Failed !"));
|
||||
tranfer_status_text->setVisible(false);
|
||||
tranfer_status_text->setStyleSheet("QLabel{\
|
||||
@@ -200,37 +161,13 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
font-family: Noto Sans CJK SC;\
|
||||
font-weight: 500;\
|
||||
line-height: 24px;\
|
||||
- opacity: 1;}\
|
||||
- ");
|
||||
+ opacity: 1;}");
|
||||
|
||||
+ if (is_Intel)
|
||||
+ initIntelLayout();
|
||||
+ else
|
||||
+ initLayout();
|
||||
|
||||
- is_Intel = QFile::exists("/etc/apt/ota_version");
|
||||
- if (is_Intel) {
|
||||
- cancel_btn->setFixedSize(112,56);
|
||||
- cancel_btn->setGeometry(240,545,112,56);
|
||||
- ok_btn->setFixedSize(112,56);
|
||||
- ok_btn->setGeometry(376,545,112,56);
|
||||
- target_name->setFixedHeight(23);
|
||||
- target_name->setStyleSheet("QLabel{\
|
||||
- width: 300px;\
|
||||
- height: 20px;\
|
||||
- font-size: 16px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;\
|
||||
- }");
|
||||
- target_size->setFixedWidth(68);
|
||||
- target_size->setStyleSheet("QLabel{\
|
||||
- width: 100px;\
|
||||
- height: 20px;\
|
||||
- font-size: 16px;\
|
||||
- font-family: NotoSansCJKsc-Regular;\
|
||||
- line-height: 24px;\
|
||||
- color: #818181;\
|
||||
- opacity: 1;\
|
||||
- }");
|
||||
- }
|
||||
init_m_progressbar_value(_filesize.at(0));
|
||||
}
|
||||
|
||||
@@ -239,6 +176,92 @@ BluetoothFileTransferWidget::~BluetoothFileTransferWidget()
|
||||
isShow = false;
|
||||
}
|
||||
|
||||
+void BluetoothFileTransferWidget::initLayout() {
|
||||
+ this->setFixedSize(520,620);
|
||||
+ title_icon = new QLabel(this);
|
||||
+ title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
+ title_icon->resize(22,22);
|
||||
+
|
||||
+ title_text = new QLabel(tr("Bluetooth file transfer"),this);
|
||||
+ title_text->setStyleSheet("QLabel{\
|
||||
+ width: 200px;\
|
||||
+ height: 20px;\
|
||||
+ font-size: 14px;\
|
||||
+ font-family: Noto Sans CJK SC;\
|
||||
+ font-weight: 400;\
|
||||
+ line-height: 24px;\
|
||||
+ opacity: 1;}");
|
||||
+
|
||||
+ close_btn = new QPushButton(this);
|
||||
+ close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
+ close_btn->setProperty("isWindowButton", 0x2);
|
||||
+ close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
+ close_btn->setFlat(true);
|
||||
+ close_btn->setFixedSize(30,30);
|
||||
+ connect(close_btn,&QPushButton::clicked,this,[=]{
|
||||
+ emit close_the_pre_session();
|
||||
+ this->close();
|
||||
+ });
|
||||
+ title_icon->setGeometry(8,8,22,22);
|
||||
+ title_text->setGeometry(36,8,200,20);
|
||||
+ close_btn->setGeometry(484,4,30,30);
|
||||
+ tranfer_status_text->setGeometry(62,53,376,27);
|
||||
+ tranfer_status_icon->setGeometry(32,55,22,22);
|
||||
+ cancel_btn->setGeometry(280,560,100,36);
|
||||
+ ok_btn->setGeometry(392,560,100,36);
|
||||
+ dev_widget->setGeometry(32,175,456,356);
|
||||
+ Tiptop->setGeometry(32,144,100,20);
|
||||
+ target_size->setGeometry(112,88,70,30);
|
||||
+ tip_text->setGeometry(32,52,452,28);
|
||||
+ target_icon->setGeometry(32,56,64,64);
|
||||
+ target_name->setGeometry(112,63,400,20);
|
||||
+ transNum->setGeometry(459,168,52,20);
|
||||
+ if (fileNums > 1)
|
||||
+ m_progressbar->setGeometry(32,175,406,8);
|
||||
+ else
|
||||
+ m_progressbar->setGeometry(32,175,454,8);
|
||||
+}
|
||||
+
|
||||
+void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
+ this->setWindowFlags(Qt::Dialog);
|
||||
+ this->setFixedSize(520,600);
|
||||
+ cancel_btn->setFixedSize(112,56);
|
||||
+ ok_btn->setFixedSize(112,56);
|
||||
+ target_name->setFixedHeight(23);
|
||||
+ target_name->setStyleSheet("QLabel{\
|
||||
+ width: 300px;\
|
||||
+ height: 20px;\
|
||||
+ font-size: 16px;\
|
||||
+ font-family: Noto Sans CJK SC;\
|
||||
+ font-weight: 400;\
|
||||
+ line-height: 24px;\
|
||||
+ opacity: 1;}");
|
||||
+ target_size->setFixedWidth(68);
|
||||
+ target_size->setStyleSheet("QLabel{\
|
||||
+ width: 100px;\
|
||||
+ height: 20px;\
|
||||
+ font-size: 16px;\
|
||||
+ font-family: NotoSansCJKsc-Regular;\
|
||||
+ line-height: 24px;\
|
||||
+ color: #818181;\
|
||||
+ opacity: 1;}");
|
||||
+ ok_btn->setGeometry(376,525,112,56);
|
||||
+ cancel_btn->setGeometry(240,525,112,56);
|
||||
+ tranfer_status_text->setGeometry(62,33,376,27);
|
||||
+ tranfer_status_icon->setGeometry(32,35,22,22);
|
||||
+ dev_widget->setGeometry(32,155,456,356);
|
||||
+ Tiptop->setGeometry(32,124,100,20);
|
||||
+ target_size->setGeometry(112,68,70,30);
|
||||
+ tip_text->setGeometry(32,32,452,28);
|
||||
+ target_icon->setGeometry(32,36,64,64);
|
||||
+ target_name->setGeometry(112,43,400,20);
|
||||
+ transNum->setGeometry(459,148,52,20);
|
||||
+ if (fileNums > 1)
|
||||
+ m_progressbar->setGeometry(32,155,406,8);
|
||||
+ else
|
||||
+ m_progressbar->setGeometry(32,155,454,8);
|
||||
+}
|
||||
+
|
||||
void BluetoothFileTransferWidget::initFileInfo() {
|
||||
for (int i = 0; i < fileNums; i++) {
|
||||
Get_fie_type(i);
|
||||
@@ -314,15 +337,22 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
|
||||
ok_btn->setVisible(false);
|
||||
cancel_btn->setVisible(true);
|
||||
- cancel_btn->setGeometry(376, 205, 112, 56);
|
||||
m_progressbar->setVisible(true);
|
||||
transNum->setVisible(fileNums - 1);
|
||||
Tiptop->setVisible(false);
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
||||
- target_icon->setGeometry(32,95,64,64);
|
||||
- target_name->setGeometry(112,102,400,20);
|
||||
- target_size->setGeometry(112,127,68,30);
|
||||
+ if (is_Intel) {
|
||||
+ cancel_btn->setGeometry(376, 185, 112, 56);
|
||||
+ target_icon->setGeometry(32,75,64,64);
|
||||
+ target_name->setGeometry(112,62,400,20);
|
||||
+ target_size->setGeometry(112,107,68,30);
|
||||
+ } else {
|
||||
+ cancel_btn->setGeometry(376, 213, 100, 36);
|
||||
+ target_icon->setGeometry(32,95,64,64);
|
||||
+ target_name->setGeometry(112,102,400,20);
|
||||
+ target_size->setGeometry(112,127,68,30);
|
||||
+ }
|
||||
|
||||
main_animation_group = new QParallelAnimationGroup(this);
|
||||
|
||||
@@ -407,10 +437,16 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
}
|
||||
int transfing = fileNums - selectedFiles.size() + 1;
|
||||
transNum->setText(QString::number(transfing)+"/"+QString::number(fileNums));
|
||||
- if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,175,406,8);
|
||||
+ if (is_Intel)
|
||||
+ if (fileNums > 1)
|
||||
+ m_progressbar->setGeometry(32,155,406,8);
|
||||
+ else
|
||||
+ m_progressbar->setGeometry(32,155,454,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,175,454,8);
|
||||
+ if (fileNums > 1)
|
||||
+ m_progressbar->setGeometry(32,175,406,8);
|
||||
+ else
|
||||
+ m_progressbar->setGeometry(32,175,454,8);
|
||||
transNum->setVisible(fileNums - 1);
|
||||
this->update();
|
||||
this->activateWindow();
|
||||
@@ -469,7 +505,6 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
cancel_btn->setText(tr("OK"));
|
||||
tranfer_status_icon->setFixedSize(64,64);
|
||||
tranfer_status_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-success.svg"));
|
||||
- tranfer_status_icon->setGeometry(220,86,64,64);
|
||||
tranfer_status_text->setText(tr("File Transmition Succeed!"));
|
||||
tranfer_status_text->setFixedWidth(500);
|
||||
tranfer_status_text->setStyleSheet("QLabel{\
|
||||
@@ -478,8 +513,14 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #0FCE75;}");
|
||||
- tranfer_status_text->setGeometry(12,150,500,24);
|
||||
tranfer_status_text->setAlignment(Qt::AlignCenter);
|
||||
+ if (is_Intel) {
|
||||
+ tranfer_status_icon->setGeometry(220,66,64,64);
|
||||
+ tranfer_status_text->setGeometry(12,130,500,24);
|
||||
+ } else {
|
||||
+ tranfer_status_icon->setGeometry(220,86,64,64);
|
||||
+ tranfer_status_text->setGeometry(12,150,500,24);
|
||||
+ }
|
||||
} else {
|
||||
tranfer_status_icon->setPixmap(QIcon::fromTheme("ukui-dialog-success").pixmap(22,22));
|
||||
tranfer_status_text->setText(tr("File Transmition Succeed!"));
|
||||
@@ -516,7 +557,7 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
if (is_Intel){
|
||||
tranfer_status_icon->setFixedSize(64,64);
|
||||
tranfer_status_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
- tranfer_status_icon->setGeometry(220,86,64,64);
|
||||
+ tranfer_status_icon->setGeometry(220,66,64,64);
|
||||
tranfer_status_text->setFixedWidth(500);
|
||||
tranfer_status_text->setStyleSheet("QLabel{\
|
||||
font-family: NotoSansCJKsc;\
|
||||
@@ -524,7 +565,7 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #FB5050;}");
|
||||
- tranfer_status_text->setGeometry(12,150,500,24);
|
||||
+ tranfer_status_text->setGeometry(12,130,500,24);
|
||||
tranfer_status_text->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
index 725be3b..846139e 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
@@ -135,7 +135,10 @@ private:
|
||||
QList<QString> filetype;
|
||||
QString dev_name;
|
||||
SEND_DATA_STATE send_state = _SEND_NONE;
|
||||
- bool is_Intel;
|
||||
+ bool is_Intel = false;
|
||||
+
|
||||
+ void initLayout();
|
||||
+ void initIntelLayout();
|
||||
};
|
||||
|
||||
#endif // BLUETOOTHFILETRANSFERWIDGET_H
|
||||
diff --git a/ukui-bluetooth/main/mainprogram.cpp b/ukui-bluetooth/main/mainprogram.cpp
|
||||
index a241484..a207d61 100644
|
||||
--- a/ukui-bluetooth/main/mainprogram.cpp
|
||||
+++ b/ukui-bluetooth/main/mainprogram.cpp
|
||||
@@ -35,6 +35,8 @@ MainProgram::MainProgram(bool intel, QObject *parent) :
|
||||
connect(_sessionDbus, &BluetoothDbus::devBatteryChangedSignal, this, [=]() {
|
||||
UI->updatePairedDev();
|
||||
});
|
||||
+ QStringList file;
|
||||
+ file.append(QString("file"));
|
||||
}
|
||||
|
||||
MainProgram::~MainProgram()
|
||||
@@ -181,8 +183,8 @@ void MainProgram::sendTransferDeviceMesgSlot(QString address)
|
||||
|
||||
if (BluetoothFileTransferWidget::isShow == false) {
|
||||
fileSendWidget = new BluetoothFileTransferWidget(selectedFiles,_sessionDbus->getPairedDevices(),address);
|
||||
+ connect(fileSendWidget,&BluetoothFileTransferWidget::destroyed, this,&MainProgram::closeSession);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::sender_dev_name,this,&MainProgram::sendFiles);
|
||||
- connect(fileSendWidget,&BluetoothFileTransferWidget::close_the_pre_session,this,&MainProgram::closeSession);
|
||||
connect(_sessionDbus,&BluetoothDbus::transferredChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::set_m_progressbar_value);
|
||||
connect(_sessionDbus,&BluetoothDbus::statusChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::get_transfer_status);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::continueSendFiles,_sessionDbus,&BluetoothDbus::continueSendFiles);
|
||||
@@ -200,7 +202,7 @@ void MainProgram::sendTransferDeviceMesgSlot(QString address)
|
||||
delete fileSendWidget;
|
||||
fileSendWidget = new BluetoothFileTransferWidget(selectedFiles,_sessionDbus->getPairedDevices(),address);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::sender_dev_name,this,&MainProgram::sendFiles);
|
||||
- connect(fileSendWidget,&BluetoothFileTransferWidget::close_the_pre_session,this,&MainProgram::closeSession);
|
||||
+ connect(fileSendWidget,&BluetoothFileTransferWidget::destroyed, this,&MainProgram::closeSession);
|
||||
connect(_sessionDbus,&BluetoothDbus::transferredChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::set_m_progressbar_value);
|
||||
connect(_sessionDbus,&BluetoothDbus::statusChangedSignal,fileSendWidget,&BluetoothFileTransferWidget::get_transfer_status);
|
||||
connect(fileSendWidget,&BluetoothFileTransferWidget::continueSendFiles,_sessionDbus,&BluetoothDbus::continueSendFiles);
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index 53d36ae..2b2b899 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -6,6 +6,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
PINCode(pin),
|
||||
show_flag(flag)
|
||||
{
|
||||
+ is_Intel = QFile::exists("/etc/apt/ota_version");
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")){
|
||||
settings = new QGSettings("org.ukui.style");
|
||||
connect(settings,&QGSettings::changed,this,&PinCodeWidget::GSettingsChanges);
|
||||
@@ -14,41 +15,25 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
//窗管协议
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
- hints.functions = MWM_FUNC_ALL;
|
||||
+ if (is_Intel)
|
||||
+ hints.functions = MWM_FUNC_CLOSE;
|
||||
+ else
|
||||
+ hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints);
|
||||
|
||||
- is_Intel = QFile::exists("/etc/apt/ota_version");
|
||||
QPalette palette;
|
||||
if(settings->get("style-name").toString() == "ukui-default" || settings->get("style-name").toString() == "ukui-light"){
|
||||
palette.setColor(QPalette::Background,QColor(255,255,255));
|
||||
}else{
|
||||
palette.setColor(QPalette::Background,QColor(0,0,0));
|
||||
}
|
||||
-// this->setWindowFlags(Qt::Dialog/*|Qt::FramelessWindowHint*/);
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("Bluetooth pairing"));
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
- QList<QScreen *> list = QGuiApplication::screens();
|
||||
- this->move(list.at(0)->size().width()/2-this->width()/2,list.at(0)->size().height()/2-this->height()/2);
|
||||
-
|
||||
this->setPalette(palette);
|
||||
this->setAutoFillBackground(true);
|
||||
- title_icon = new QLabel(this);
|
||||
- title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
- title_icon->resize(22,22);
|
||||
-
|
||||
- title_text = new QLabel(tr("Bluetooth Connections"),this);
|
||||
- title_text->setStyleSheet("QLabel{\
|
||||
- width: 200px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
- title_text->adjustSize();
|
||||
|
||||
//QString top_text = tr("Bluetooth Connect Request From \'")+dev_name+tr("\'.");
|
||||
QString tip_text;
|
||||
@@ -100,49 +85,60 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
refuse_btn->setVisible(false);
|
||||
}
|
||||
|
||||
- close_btn = new QPushButton(this);
|
||||
- QIcon icon = QIcon::fromTheme("window-close-symbolic");
|
||||
- close_btn->setIcon(icon);
|
||||
- close_btn->setProperty("isWindowButton", 0x2);
|
||||
- close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
-// close_btn->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
|
||||
- close_btn->setFlat(true);
|
||||
- connect(close_btn,&QPushButton::clicked,this,&PinCodeWidget::onClick_close_btn);
|
||||
-
|
||||
- //title_text->setGeometry(36,12,200,20);
|
||||
- //title_icon->setGeometry(8,12,22,22);
|
||||
- close_btn->setGeometry(480,8,30,30);
|
||||
-
|
||||
if (is_Intel) {
|
||||
- this->setFixedSize(510, 287);
|
||||
- title_icon->setGeometry(16,12,24,24);
|
||||
- title_text->setGeometry(48,12,100,24);
|
||||
- //top_label->setGeometry(24,60,456,50);
|
||||
- tip_label->setGeometry(24,72,450,40);
|
||||
+ this->setWindowFlags(Qt::Dialog);
|
||||
+ this->setFixedSize(510, 267);
|
||||
tip_label->setStyleSheet("QLabel{\
|
||||
font-size: 16px;\
|
||||
font-family: Noto Sans CJK SC;\
|
||||
font-weight: 400;\
|
||||
line-height: 24px;}");
|
||||
- PIN_label->setGeometry(24,136,462,47);
|
||||
- accept_btn->setGeometry(373,207,112,56);
|
||||
- refuse_btn->setGeometry(246,207,112,56);
|
||||
- close_btn->setGeometry(470, 8, 30, 30);
|
||||
+
|
||||
PIN_label->setStyleSheet("QLabel{\
|
||||
font-size: 40px;\
|
||||
font-family: Noto Sans CJK SC;\
|
||||
font-weight: 400;\
|
||||
line-height: 24px;}");
|
||||
+
|
||||
+ tip_label->setGeometry(24,52,450,40);
|
||||
+ PIN_label->setGeometry(24,116,462,47);
|
||||
+ accept_btn->setGeometry(373,187,112,56);
|
||||
+ refuse_btn->setGeometry(246,187,112,56);
|
||||
} else {
|
||||
this->setFixedSize(520,212);
|
||||
+ title_icon = new QLabel(this);
|
||||
+ title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
+ title_icon->resize(22,22);
|
||||
+
|
||||
+ title_text = new QLabel(tr("Bluetooth Connections"),this);
|
||||
+ title_text->setStyleSheet("QLabel{\
|
||||
+ width: 200px;\
|
||||
+ height: 20px;\
|
||||
+ font-size: 14px;\
|
||||
+ font-family: Noto Sans CJK SC;\
|
||||
+ font-weight: 400;\
|
||||
+ line-height: 24px;\
|
||||
+ opacity: 1;}");
|
||||
+ title_text->adjustSize();
|
||||
+
|
||||
+ close_btn = new QPushButton(this);
|
||||
+ QIcon icon = QIcon::fromTheme("window-close-symbolic");
|
||||
+ close_btn->setIcon(icon);
|
||||
+ close_btn->setProperty("isWindowButton", 0x2);
|
||||
+ close_btn->setProperty("useIconHighlightEffect", 0x8);
|
||||
+ // close_btn->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
|
||||
+ close_btn->setFlat(true);
|
||||
+ connect(close_btn,&QPushButton::clicked,this,&PinCodeWidget::onClick_close_btn);
|
||||
+ close_btn->setGeometry(480,8,30,30);
|
||||
title_icon->setGeometry(8, 8, 22, 22);
|
||||
title_text->setGeometry(38, 9, 160, 20);
|
||||
PIN_label->setGeometry(25,90,207,36);
|
||||
tip_label->setGeometry(25,56,437,40);
|
||||
- //top_label->setGeometry(32,56,456,50);
|
||||
accept_btn->setGeometry(362,152,116,36);
|
||||
refuse_btn->setGeometry(238,152,116,36);
|
||||
}
|
||||
+ QList<QScreen *> list = QGuiApplication::screens();
|
||||
+ this->move(list.at(0)->size().width()/2-this->width()/2,list.at(0)->size().height()/2-this->height()/2);
|
||||
}
|
||||
|
||||
PinCodeWidget::~PinCodeWidget()
|
|
@ -0,0 +1,71 @@
|
|||
diff --git a/ukui-bluetooth/component/bluetoothsettinglabel.cpp b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
index d5387c9..a46fafb 100644
|
||||
--- a/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
+++ b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
@@ -35,27 +35,22 @@ QColor BluetoothSettingLabel::getPainterBrushColor()
|
||||
switch (_MStatus) {
|
||||
case Status::Normal:
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
- color = QColor(255,255,255,0);
|
||||
+ color = QColor(0, 0, 0);
|
||||
else {
|
||||
- color = QColor(QPalette::Base);
|
||||
- color.setAlpha(0);
|
||||
+ color = QColor(255,255,255);
|
||||
}
|
||||
break;
|
||||
case Status::Hover:
|
||||
- color = QColor(217,217,217,tran);
|
||||
+ color = QColor("#2FB3E8");
|
||||
break;
|
||||
case Status::Click:
|
||||
- if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
- color = QColor(209, 209, 209,tran);
|
||||
- else
|
||||
- color = QColor(102, 102, 102, tran);
|
||||
+ color = QColor("#1699CF");
|
||||
break;
|
||||
default:
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
- color = QColor(255,255,255,0);
|
||||
+ color = QColor(0, 0, 0);
|
||||
else {
|
||||
- color = QColor(QPalette::Base);
|
||||
- color.setAlpha(0);
|
||||
+ color = QColor(255,255,255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -64,8 +59,8 @@ QColor BluetoothSettingLabel::getPainterBrushColor()
|
||||
|
||||
void BluetoothSettingLabel::enterEvent(QEvent *event) {
|
||||
Q_UNUSED(event);
|
||||
- //_MStatus = Hover;
|
||||
- _MStatus = Normal;
|
||||
+ _MStatus = Hover;
|
||||
+ setCursor(Qt::PointingHandCursor);
|
||||
this->update();
|
||||
}
|
||||
|
||||
@@ -93,14 +88,10 @@ void BluetoothSettingLabel::mouseReleaseEvent(QMouseEvent *ev) {
|
||||
void BluetoothSettingLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
- QPalette pl;
|
||||
- pl.setColor(QPalette::Background,getPainterBrushColor());
|
||||
- this->setPalette(pl);
|
||||
QPainter painter(this);
|
||||
painter.save();
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setPen(QColor(Qt::transparent));
|
||||
- painter.setBrush(getPainterBrushColor());
|
||||
painter.drawRoundedRect(this->rect(),12,12,Qt::AbsoluteSize);
|
||||
//painter.drawRect(this->rect());
|
||||
painter.restore();
|
||||
@@ -108,5 +99,6 @@ void BluetoothSettingLabel::paintEvent(QPaintEvent *event)
|
||||
painter.setPen(QColor(Qt::black));
|
||||
else
|
||||
painter.setPen(QColor(Qt::white));
|
||||
+ painter.setPen(getPainterBrushColor());
|
||||
painter.drawText(25,10,420,50,Qt::AlignLeft,tr("Bluetooth Settings"));
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
Index: upstream/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
===================================================================
|
||||
--- upstream.orig/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ upstream/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -93,7 +93,7 @@ BluetoothFileTransferWidget::BluetoothFi
|
||||
color: #818181;\
|
||||
opacity: 1;\
|
||||
}");
|
||||
- target_size->setGeometry(112,88,65,30);
|
||||
+ target_size->setGeometry(112,88,70,30);
|
||||
|
||||
QFontMetrics fontMetrics(target_size->font());
|
||||
QString fileName;
|
||||
@@ -239,19 +239,22 @@ void BluetoothFileTransferWidget::initFi
|
||||
for (int i = 0; i < fileNums; i++) {
|
||||
Get_fie_type(i);
|
||||
}
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::Get_fie_type(int i)
|
||||
{
|
||||
GError *error;
|
||||
qDebug() << Q_FUNC_INFO << selectedFiles.at(i);
|
||||
- GFile *file = g_file_new_for_path(selectedFiles.at(0).toStdString().c_str());
|
||||
+ GFile *file = g_file_new_for_path(selectedFiles.at(i).toStdString().c_str());
|
||||
GFileInfo *file_info = g_file_query_info(file,"*",G_FILE_QUERY_INFO_NONE,NULL,&error);
|
||||
qDebug() << Q_FUNC_INFO << g_file_info_get_size(file_info) << g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
file_size.push_back(g_format_size_full(g_file_info_get_size(file_info),G_FORMAT_SIZE_IEC_UNITS));
|
||||
_filesize.push_back(g_file_info_get_size(file_info));
|
||||
QString str = g_file_info_get_content_type(file_info);
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
QIcon fileicon;
|
||||
if (str.split("/").at(0) == "image"){
|
||||
fileicon = QIcon(selectedFiles.at(i));
|
||||
@@ -271,6 +274,7 @@ void BluetoothFileTransferWidget::Get_fi
|
||||
}
|
||||
}else
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
+ qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
file_icon.push_back(fileicon);
|
||||
}
|
||||
|
||||
@@ -326,6 +330,27 @@ void BluetoothFileTransferWidget::get_tr
|
||||
file_size.pop_front();
|
||||
file_icon.pop_front();
|
||||
_filesize.pop_front();
|
||||
+ if (selectedFiles.size() == 1)
|
||||
+ target_name->setText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1));
|
||||
+ else if(selectedFiles.size() > 1)
|
||||
+ {
|
||||
+ target_name->setText("\""
|
||||
+ +selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1)
|
||||
+ +"\""
|
||||
+ +tr(" and ")
|
||||
+ +QString::number(selectedFiles.size() - 1)
|
||||
+ +tr(" files more"));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ tranfer_error();
|
||||
+ this->send_state = _SEND_FAILURE ;
|
||||
+ }
|
||||
+ init_m_progressbar_value(_filesize.at(0));
|
||||
+ target_size->setText(file_size.at(0));
|
||||
+ target_icon->setPixmap(file_icon.at(0).pixmap(64,64));
|
||||
+ int transfing = fileNums - selectedFiles.size() + 1;
|
||||
+ transNum->setText(QString::number(transfing)+"/"+QString::number(fileNums));
|
||||
return;
|
||||
}
|
||||
selectedFiles.clear();
|
||||
@@ -371,28 +396,6 @@ void BluetoothFileTransferWidget::get_tr
|
||||
this->send_state = _SEND_COMPLETE ;
|
||||
}else if(status == QString("Active")){
|
||||
this->send_state = _SENDING ;
|
||||
- if (selectedFiles.size() == 1)
|
||||
- target_name->setText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1));
|
||||
- else if(selectedFiles.size() > 1)
|
||||
- {
|
||||
- target_name->setText("\""
|
||||
- +selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1)
|
||||
- +"\""
|
||||
- +tr(" and ")
|
||||
- +QString::number(selectedFiles.size() - 1)
|
||||
- +tr(" files more"));
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- tranfer_error();
|
||||
- this->send_state = _SEND_FAILURE ;
|
||||
- }
|
||||
-
|
||||
- init_m_progressbar_value(_filesize.at(0));
|
||||
- target_size->setText(file_size.at(0));
|
||||
- target_icon->setPixmap(file_icon.at(0).pixmap(64,64));
|
||||
- int transfing = fileNums - selectedFiles.size() + 1;
|
||||
- transNum->setText(QString::number(transfing)+"/"+QString::number(fileNums));
|
||||
}else if(status == QString("Error")){
|
||||
tranfer_error();
|
||||
this->send_state = _SEND_FAILURE ;
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 67b293e..63e059b 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -11,6 +11,7 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
|
||||
// 窗管适配
|
||||
if (_Intel) {
|
||||
+ setProperty("useStyleWindowManager", false);
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
|
@ -0,0 +1,104 @@
|
|||
diff --git a/service/config.cpp b/service/config.cpp
|
||||
index 272c4ad..dad350b 100644
|
||||
--- a/service/config.cpp
|
||||
+++ b/service/config.cpp
|
||||
@@ -57,7 +57,9 @@ void Config::LaunchUI()
|
||||
QProcess *process = new QProcess();
|
||||
QString cmd = UIExe;
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
- process->startDetached(cmd);
|
||||
+ QTimer::singleShot(700, process, [=]{
|
||||
+ process->startDetached(cmd);
|
||||
+ });
|
||||
}
|
||||
|
||||
QStringList Config::getDeviceConnectTimeList(QString path)
|
||||
diff --git a/service/config.h b/service/config.h
|
||||
index 40c2e54..387c8d4 100644
|
||||
--- a/service/config.h
|
||||
+++ b/service/config.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
+#include <QTimer>
|
||||
|
||||
class Config : public QObject
|
||||
{
|
||||
diff --git a/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm b/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm
|
||||
index feff98a..cbb66c0 100644
|
||||
Binary files a/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm and b/ukcc-bluetooth/translations/ukcc-bluetooth_bo_CN.qm differ
|
||||
diff --git a/ukcc-bluetooth/translations/ukcc-bluetooth_zh_CN.qm b/ukcc-bluetooth/translations/ukcc-bluetooth_zh_CN.qm
|
||||
index 79a3e04..b18d9fc 100644
|
||||
Binary files a/ukcc-bluetooth/translations/ukcc-bluetooth_zh_CN.qm and b/ukcc-bluetooth/translations/ukcc-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/component/bluetoothsettinglabel.cpp b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
index 44c6809..33ac0a3 100644
|
||||
--- a/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
+++ b/ukui-bluetooth/component/bluetoothsettinglabel.cpp
|
||||
@@ -110,5 +110,5 @@ void BluetoothSettingLabel::paintEvent(QPaintEvent *event)
|
||||
painter.setPen(QColor(Qt::black));
|
||||
else
|
||||
painter.setPen(QColor(Qt::white));
|
||||
- painter.drawText(25,12,420,50,Qt::AlignLeft,tr("Bluetooth Settings"));
|
||||
+ painter.drawText(25,10,420,50,Qt::AlignLeft,tr("Bluetooth Settings"));
|
||||
}
|
||||
diff --git a/ukui-bluetooth/main/main.cpp b/ukui-bluetooth/main/main.cpp
|
||||
index fce2f06..57d4a1f 100644
|
||||
--- a/ukui-bluetooth/main/main.cpp
|
||||
+++ b/ukui-bluetooth/main/main.cpp
|
||||
@@ -16,6 +16,12 @@ int main(int argc, char *argv[])
|
||||
QtSingleApplication app(argc, argv);
|
||||
// QApplication::setStyle(QStyleFactory::create("ukui-default"));
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
+ QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
+
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
+ QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
+#endif
|
||||
|
||||
if (app.isRunning()) {
|
||||
qDebug() << "ukui-bluetooth is Already running ! ! !";
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index e557ada..27f069f 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -21,6 +21,20 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
connect(trayicon, &TrayIcon::openBluetoothSettings, this, [=]{
|
||||
_SessionDBus->openBluetoothSettings();
|
||||
});
|
||||
+ connect(QApplication::desktop(), &QDesktopWidget::resized, this, [=] {
|
||||
+ setWidgetPosition();
|
||||
+ });
|
||||
+ connect(QApplication::desktop(), &QDesktopWidget::primaryScreenChanged, this, [=] {
|
||||
+ setWidgetPosition();
|
||||
+ });
|
||||
+
|
||||
+ QGSettings *setttt = new QGSettings(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit());
|
||||
+ connect(setttt,&QGSettings::changed, this, [=] (const QString &key) {
|
||||
+ if (key == "scalingFactor") {
|
||||
+ repaint();
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
setProperty("useSystemStyleBlur", true);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
||||
@@ -213,7 +227,7 @@ void TrayWidget::InitMemberVariables()
|
||||
connect(_MBtn, SIGNAL(checkedChanged(bool)), this, SLOT(openBluetoothSlot(bool)));
|
||||
|
||||
QHBoxLayout *topLayout = new QHBoxLayout();
|
||||
- topLayout->setContentsMargins(24,16,25,14);
|
||||
+ topLayout->setContentsMargins(24,16,25,12);
|
||||
topLayout->setSpacing(0);
|
||||
|
||||
InitErrorWidget();
|
||||
@@ -225,7 +239,7 @@ void TrayWidget::InitMemberVariables()
|
||||
_MStackedWidget->addWidget(_ErrorWidget);
|
||||
_MStackedWidget->setCurrentIndex(0);
|
||||
|
||||
- _MLabel->resize(60,28);
|
||||
+ _MLabel->resize(60,32);
|
||||
_MLabel->setText(tr("Bluetooth"));
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light"){
|
||||
_MLabel->setStyleSheet("color:black;");
|
|
@ -0,0 +1,86 @@
|
|||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 11bf561..0a61b51 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -87,7 +87,8 @@ void BluetoothDbus::devConnectStatusSignalSLot(QString address, bool connected)
|
||||
|
||||
void BluetoothDbus::devNameChangedSignalSLot(QString address, QString name) {
|
||||
qDebug() << "devNameChangedSignalSLot" << address << name;
|
||||
-
|
||||
+ if (!pairedDevice.contains(address))
|
||||
+ return;
|
||||
if (connectedDevice.values().contains(address)
|
||||
&& pairedDevice.keys().contains(address)) {
|
||||
connectedDevice.remove(pairedDevice.value(address).at(0));
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.cpp b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
index dc8f111..197e6cb 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.cpp
|
||||
@@ -12,6 +12,9 @@ TrayIcon::TrayIcon(QWidget *parent)
|
||||
tray_Menu = new QMenu(this);
|
||||
QAction *settins_action = new QAction(QIcon::fromTheme("ukui-settings-symbolic"),tr("Set Bluetooth Item"),tray_Menu);
|
||||
tray_Menu->addAction(settins_action);
|
||||
+ connect(tray_Menu, &QMenu::triggered, this, [=]{
|
||||
+ emit openBluetoothSettings();
|
||||
+ });
|
||||
|
||||
//Create taskbar tray icon and connect to signal slot
|
||||
//创建任务栏托盘图标,并连接信号槽
|
||||
diff --git a/ukui-bluetooth/mainwidget/trayicon.h b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
index 313f3bd..f384959 100644
|
||||
--- a/ukui-bluetooth/mainwidget/trayicon.h
|
||||
+++ b/ukui-bluetooth/mainwidget/trayicon.h
|
||||
@@ -18,6 +18,9 @@
|
||||
#include <QGSettings>
|
||||
#include <QDebug>
|
||||
#include <QWidgetAction>
|
||||
+#include <QPixmap>
|
||||
+#include <QIcon>
|
||||
+#include <QColor>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -26,12 +29,21 @@ class TrayIcon : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
+ enum PixmapColor {
|
||||
+ WHITE = 0,
|
||||
+ BLACK,
|
||||
+ GRAY,
|
||||
+ BLUE,
|
||||
+ };
|
||||
+ Q_ENUM(PixmapColor)
|
||||
+
|
||||
TrayIcon(QWidget *parent = nullptr);
|
||||
~TrayIcon();
|
||||
void InitTrayWidget();
|
||||
|
||||
signals:
|
||||
void showTayWidget();
|
||||
+ void openBluetoothSettings();
|
||||
|
||||
public slots:
|
||||
void GSettings_value_chanage(const QString &key);
|
||||
@@ -40,6 +52,7 @@ public slots:
|
||||
private:
|
||||
QSystemTrayIcon *bluetooth_tray_icon = nullptr;
|
||||
QMenu *tray_Menu = nullptr;
|
||||
+ QGSettings *StyleSettings = nullptr;
|
||||
QGSettings *settings = nullptr;
|
||||
} ;
|
||||
#endif // TRAYICON_H
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 0ee29f6..e557ada 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -18,6 +18,9 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
trayicon = new TrayIcon();
|
||||
connect(this, &TrayWidget::trayIconStatusChanged, trayicon, &TrayIcon::SetTrayIcon);
|
||||
connect(trayicon, &TrayIcon::showTayWidget, this, &TrayWidget::showUI);
|
||||
+ connect(trayicon, &TrayIcon::openBluetoothSettings, this, [=]{
|
||||
+ _SessionDBus->openBluetoothSettings();
|
||||
+ });
|
||||
setProperty("useSystemStyleBlur", true);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
|
|
@ -0,0 +1,238 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 7cb92e5..22fdc0e 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -10,11 +10,6 @@ QDevItem::QDevItem(QString address, QStringList deviceinfo, bool connected, QWid
|
||||
_MType(deviceinfo.at(1))
|
||||
{
|
||||
initMap();
|
||||
-
|
||||
- if (isHuaWei())
|
||||
- _Battery = QString("-1");
|
||||
- else
|
||||
- qDebug() << "This is Normal Machine in Normal Progress.";
|
||||
qDebug() << " get dev Battery : " << deviceinfo.at(0) << _Battery;
|
||||
|
||||
if(QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
@@ -45,21 +40,6 @@ QDevItem::~QDevItem()
|
||||
|
||||
}
|
||||
|
||||
-bool QDevItem::isHuaWei() {
|
||||
- QProcess p;
|
||||
- p.start("bash", QStringList() <<"-c" << "cat /proc/cpuinfo | grep Hardware");
|
||||
- p.waitForFinished();
|
||||
- QString strResult = p.readAllStandardOutput();
|
||||
-
|
||||
- QString str = strResult.toLower();
|
||||
- if(str.length() == 0)
|
||||
- return false;
|
||||
- if(str.indexOf("huawei") != -1 || str.indexOf("pangu") != -1 ||
|
||||
- str.indexOf("kirin") != -1)
|
||||
- return true;
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
void QDevItem::initMap() {
|
||||
typeMap = new QMap<QString, QIcon>();
|
||||
typeMap->insert(QString("phone"), QIcon::fromTheme("phone-symbolic"));
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index 642efde..a7156d8 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -58,7 +58,6 @@ private:
|
||||
QColor getPainterBrushColor();
|
||||
QColor getDevStatusColor();
|
||||
QPixmap getDevTypeIcon();
|
||||
- bool isHuaWei();
|
||||
void initMap();
|
||||
void DrawBackground(QPainter &);
|
||||
void DrawStatusIcon(QPainter &);
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.cpp b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
index 9c8f208..09f7277 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -4,6 +4,7 @@ BluetoothDbus::BluetoothDbus(QObject *parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
qDebug() << Q_FUNC_INFO << __LINE__;
|
||||
+ isHuaWeiFlag = isHuaWei();
|
||||
connectDBusSignals();
|
||||
getDefaultAdapterPower();
|
||||
getDefaultAdapterPairedDevices();
|
||||
@@ -84,11 +85,13 @@ void BluetoothDbus::defaultAdapterChangedSLot(QString value) {
|
||||
void BluetoothDbus::devPairSignalSLot(QString address, bool paired) {
|
||||
qDebug() << "devPairSignalSLot" << address << paired;
|
||||
if (paired && !pairedDevice.contains(address)) {
|
||||
+ pairedList.append(address);
|
||||
addNewPairedDevice(address);
|
||||
emit devPairSignal(pairedDevice.value(address).at(0),paired);
|
||||
}
|
||||
if (!paired && pairedDevice.contains(address)) {
|
||||
QString name = pairedDevice.value(address).at(0);
|
||||
+ pairedList.removeAll(address);
|
||||
pairedDevice.remove(address);
|
||||
emit devPairSignal(name, paired);
|
||||
}
|
||||
@@ -128,6 +131,8 @@ void BluetoothDbus::devNameChangedSignalSLot(QString address, QString name) {
|
||||
}
|
||||
|
||||
void BluetoothDbus::devBatteryChangedSignalSLot(QString address, QString battery) {
|
||||
+ if (isHuaWeiFlag)
|
||||
+ return;
|
||||
qDebug() << "devBatteryChangedSignalSLot" << address << battery;
|
||||
QStringList updateList;
|
||||
updateList.append(pairedDevice.value(address).at(0));
|
||||
@@ -181,7 +186,10 @@ void BluetoothDbus::addNewPairedDevice(QString address) {
|
||||
QDBusMessage _response3 = CALL_METHOD(_m3);
|
||||
if (_response3.type() == QDBusMessage::ReplyMessage)
|
||||
{
|
||||
- device.append(_response3.arguments().takeFirst().toString());
|
||||
+ if (isHuaWeiFlag)
|
||||
+ device.append(_response3.arguments().takeFirst().toString());
|
||||
+ else
|
||||
+ device.append(QString("-1"));
|
||||
}
|
||||
pairedDevice.insert(address, device);
|
||||
getDevConnectStatus(address);
|
||||
@@ -386,8 +394,9 @@ void BluetoothDbus::getDefaultAdapterPairedDevices() {
|
||||
if (response.type() == QDBusMessage::ReplyMessage)
|
||||
{
|
||||
QStringList ret = response.arguments().takeFirst().toStringList();
|
||||
-
|
||||
+ qDebug() << ret;
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
+ pairedList.append(ret.at(i));
|
||||
addNewPairedDevice(ret.at(i));
|
||||
}
|
||||
qDebug() << "init paired devices over : " << pairedDevice;
|
||||
@@ -400,8 +409,11 @@ bool BluetoothDbus::isPowered() {
|
||||
return powered;
|
||||
}
|
||||
|
||||
+QList<QString> BluetoothDbus::getPairedDevicesList() {
|
||||
+ return pairedList;
|
||||
+}
|
||||
+
|
||||
QMap<QString, QStringList> BluetoothDbus::getPairedDevices() {
|
||||
- getDefaultAdapterPairedDevices();
|
||||
return pairedDevice;
|
||||
}
|
||||
|
||||
@@ -409,3 +421,19 @@ bool BluetoothDbus::isConnected(QString name) {
|
||||
qDebug() << connectedDevice;
|
||||
return connectedDevice.keys().contains(name);
|
||||
}
|
||||
+
|
||||
+
|
||||
+bool BluetoothDbus::isHuaWei() {
|
||||
+ QProcess p;
|
||||
+ p.start("bash", QStringList() <<"-c" << "cat /proc/cpuinfo | grep Hardware");
|
||||
+ p.waitForFinished();
|
||||
+ QString strResult = p.readAllStandardOutput();
|
||||
+
|
||||
+ QString str = strResult.toLower();
|
||||
+ if(str.length() == 0)
|
||||
+ return false;
|
||||
+ if(str.indexOf("huawei") != -1 || str.indexOf("pangu") != -1 ||
|
||||
+ str.indexOf("kirin") != -1)
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/ukui-bluetooth/daemon/bluetoothdbus.h b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
index 365052f..ba93476 100644
|
||||
--- a/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
+++ b/ukui-bluetooth/daemon/bluetoothdbus.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QDBusReply>
|
||||
#include <QDBusMessage>
|
||||
#include <QMap>
|
||||
+#include <QProcess>
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
#define SYSTEMD_SERVICE "com.ukui.bluetooth"
|
||||
@@ -73,6 +74,7 @@ public:
|
||||
bool isPowered();
|
||||
bool isConnected(QString name);
|
||||
QMap<QString, QStringList> getPairedDevices();
|
||||
+ QList<QString> getPairedDevicesList();
|
||||
|
||||
signals:
|
||||
void showTrayIcon(bool);
|
||||
@@ -101,6 +103,9 @@ private:
|
||||
void connectDBusSignals();
|
||||
void addNewPairedDevice(QString address);
|
||||
bool powered = false;
|
||||
+ bool isHuaWeiFlag = false;
|
||||
+ bool isHuaWei();
|
||||
+ QList<QString> pairedList;
|
||||
QMap<QString, QStringList> pairedDevice;
|
||||
QMap<QString, QString> connectedDevice;
|
||||
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.cpp b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
index 67b293e..bc5ae12 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.cpp
|
||||
@@ -81,7 +81,7 @@ TrayWidget::TrayWidget(bool intel, BluetoothDbus *dBus, QWidget *parent):
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("bluetooth"));
|
||||
pairedDevices = _SessionDBus->getPairedDevices();
|
||||
-
|
||||
+ pairedList = _SessionDBus->getPairedDevicesList();
|
||||
InitMemberVariables();
|
||||
connectUISignalAndSlot();
|
||||
layoutAddPairedDev();
|
||||
@@ -390,7 +390,7 @@ void TrayWidget::layoutAddPairedDev()
|
||||
int count = 0;
|
||||
qDebug() << Q_FUNC_INFO << pairedDevices.size() << __LINE__;
|
||||
if (!_PairedWidget->findChildren<QDevItem *>().size()) {
|
||||
- for (auto item : pairedDevices.keys()) {
|
||||
+ for (auto item : pairedList) {
|
||||
QString name = pairedDevices.value(item).at(0);
|
||||
_SessionDBus->getDevConnectStatus(item);
|
||||
QDevItem *dev = new QDevItem(item, pairedDevices.value(item), _SessionDBus->isConnected(name), _PairedWidget);
|
||||
@@ -428,6 +428,7 @@ void TrayWidget::layoutAddPairedDev()
|
||||
|
||||
void TrayWidget::updatePairedDev() {
|
||||
pairedDevices = _SessionDBus->getPairedDevices();
|
||||
+ pairedList = _SessionDBus->getPairedDevicesList();
|
||||
clearPairedWidget();
|
||||
layoutAddPairedDev();
|
||||
}
|
||||
@@ -467,8 +468,10 @@ void TrayWidget::clearPairedWidget()
|
||||
*************************************************/
|
||||
void TrayWidget::removePairedDevUIByAddress(QString address)
|
||||
{
|
||||
- pairedDevices = _SessionDBus->getPairedDevices();
|
||||
qDebug() << Q_FUNC_INFO << pairedDevices << __LINE__;
|
||||
+ if (!pairedList.contains(address))
|
||||
+ return;
|
||||
+ pairedList.removeAll(address);
|
||||
if (!pairedDevices.contains(address))
|
||||
return;
|
||||
qDebug() << Q_FUNC_INFO << address << __LINE__;
|
||||
@@ -480,12 +483,10 @@ void TrayWidget::removePairedDevUIByAddress(QString address)
|
||||
item = nullptr;
|
||||
}
|
||||
pairedDevices.remove(address);
|
||||
- updatePairedDev();
|
||||
}
|
||||
|
||||
void TrayWidget::showUI()
|
||||
{
|
||||
- updatePairedDev();
|
||||
if (!_Intel)
|
||||
setWidgetPosition();
|
||||
else {
|
||||
diff --git a/ukui-bluetooth/mainwidget/traywidget.h b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
index 233910f..3de9ae7 100644
|
||||
--- a/ukui-bluetooth/mainwidget/traywidget.h
|
||||
+++ b/ukui-bluetooth/mainwidget/traywidget.h
|
||||
@@ -82,6 +82,7 @@ private:
|
||||
QFrame *lineFrame = nullptr;
|
||||
QFrame *lineFrame2 = nullptr;
|
||||
QMap<QString, QStringList> pairedDevices;
|
||||
+ QList<QString> pairedList;
|
||||
double tran =1;
|
||||
bool _Intel;
|
||||
int selfHeight = 0;
|
|
@ -0,0 +1,32 @@
|
|||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 79a27b2..b0a50d1 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -19,7 +19,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
StyleSettings = new QGSettings("org.ukui.style");
|
||||
connect(StyleSettings,&QGSettings::changed,this,&FileReceivingPopupWidget::GSettingsChanges);
|
||||
}
|
||||
-
|
||||
this->setFixedSize(520,276);
|
||||
this->setWindowIcon(QIcon::fromTheme("bluetooth"));
|
||||
this->setWindowTitle(tr("Bluetooth file transfer"));
|
||||
@@ -412,6 +411,7 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
file_source->setGeometry(12,150,505,24);
|
||||
file_source->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
+ this->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index abf51e9..dcb1262 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -490,6 +490,7 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
}else if(status == QString("Error")){
|
||||
tranfer_error();
|
||||
this->send_state = _SEND_FAILURE ;
|
||||
+ this->activateWindow();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,436 @@
|
|||
diff --git a/debian/ukui-bluetooth.install b/debian/ukui-bluetooth.install
|
||||
index ffb99d1..b1731a2 100644
|
||||
--- a/debian/ukui-bluetooth.install
|
||||
+++ b/debian/ukui-bluetooth.install
|
||||
@@ -1,4 +1,5 @@
|
||||
ukui-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
+data/ukui-bluetooth-tray.desktop /etc/xdg/autostart/
|
||||
data/ukui-bluetooth.desktop /etc/xdg/autostart/
|
||||
ukcc-bluetooth/translations/*.qm /usr/share/ukui-bluetooth/translations/
|
||||
ukcc-bluetooth/translations/*.ts /usr/share/ukui-bluetooth/translations/
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 6dc15a3..824b6c7 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -331,7 +331,7 @@ void Daemon::initBluezManager()
|
||||
|
||||
_DefualtAdapter = this->getDefualtAdapter();
|
||||
launchDbusSignal();
|
||||
- launchTrayUI();
|
||||
+// launchTrayUI();
|
||||
|
||||
if (nullptr != _DefualtAdapter)
|
||||
_DefualtAdapter.data()->setPowered(_mGsetting["switch"].toBool());
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index 8dd0a27..1ec5122 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -83,11 +83,6 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
ft1.setPixelSize(18);
|
||||
file_source->setFont(ft1);
|
||||
file_source->setWordWrap(true);
|
||||
- file_source->setStyleSheet("QLabel{\
|
||||
- font-size: 18px;\
|
||||
- font-family: PingFangSC-Medium, PingFang SC;\
|
||||
- font-weight: 500;\
|
||||
- line-height: 25px;}");
|
||||
file_source->setWordWrap(true);
|
||||
|
||||
file_icon = new QLabel(this);
|
||||
@@ -509,4 +504,14 @@ void FileReceivingPopupWidget::GSettingsChanges(const QString &key)
|
||||
this->setPalette(palette);
|
||||
this->update();
|
||||
}
|
||||
+ if (key == "systemFontSize") {
|
||||
+ int size = StyleSettings->get("system-font-size").toInt() - 11;
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(18 + size);
|
||||
+ file_source->setFont(ft);
|
||||
+ ft.setPixelSize(14 + size);
|
||||
+ file_name->setFont(ft);
|
||||
+ file_size->setFont(ft);
|
||||
+ window_Title->setFont(ft);
|
||||
+ }
|
||||
}
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index c34e513..9b155c6 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -45,14 +45,12 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
|
||||
tip_text = new QLabel(tr("Transferring to \"")+dev_name+"\"",this);
|
||||
- tip_text->setStyleSheet("QLabel{\
|
||||
- width: 214px;\
|
||||
- height: 27px;\
|
||||
- font-size: 18px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 500;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ QFont ft_18, ft_14;
|
||||
+ ft_14.setPixelSize(14);
|
||||
+ ft_18.setPixelSize(18);
|
||||
+
|
||||
+ tip_text->setFont(ft_18);
|
||||
+ tip_text->setWordWrap(true);
|
||||
tip_text->setVisible(false);
|
||||
|
||||
initFileInfo();
|
||||
@@ -61,15 +59,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
target_icon->setPixmap(file_icon.at(0).pixmap(64,64));
|
||||
|
||||
target_size = new QLabel(file_size.at(0),this);
|
||||
- target_size->setStyleSheet("QLabel{\
|
||||
- width: 100px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: NotoSansCJKsc-Regular;\
|
||||
- line-height: 24px;\
|
||||
- color: #818181;\
|
||||
- opacity: 1;\
|
||||
- }");
|
||||
+ target_size->setFont(ft_14);
|
||||
|
||||
QFontMetrics fontMetrics(target_size->font());
|
||||
QString fileName;
|
||||
@@ -81,29 +71,13 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
}else
|
||||
fileName = fontMetrics.elidedText(selectedFiles.at(0).split("/").at(selectedFiles.at(0).split("/").length()-1), Qt::ElideMiddle, 280);
|
||||
target_name = new QLabel(fileName,this);
|
||||
- target_name->setStyleSheet("QLabel{\
|
||||
- width: 300px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;\
|
||||
- }");
|
||||
+ target_name->setFont(ft_14);
|
||||
target_name->setWordWrap(true);
|
||||
|
||||
|
||||
transNum = new QLabel("1/"+QString::number(fileNums), this);
|
||||
transNum->setVisible(false);
|
||||
- transNum->setStyleSheet("QLabel{\
|
||||
- width: 22px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 30px;\
|
||||
- opacity: 1;}");
|
||||
-
|
||||
+ transNum->setFont(ft_14);
|
||||
|
||||
m_progressbar = new QProgressBar(this);
|
||||
m_progressbar->setOrientation(Qt::Horizontal);
|
||||
@@ -112,14 +86,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
|
||||
Tiptop = new QLabel(tr("Select Device"),this);
|
||||
Tiptop->setFixedSize(100,20);
|
||||
- Tiptop->setStyleSheet("QLabel{\
|
||||
- width: 100px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ Tiptop->setFont(ft_14);
|
||||
|
||||
dev_widget = new DeviceSeleterWidget(devicelist, this,dev_address);
|
||||
|
||||
@@ -153,14 +120,7 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
tranfer_status_text = new QLabel(this);
|
||||
tranfer_status_text->setText(tr("File Transmission Failed !"));
|
||||
tranfer_status_text->setVisible(false);
|
||||
- tranfer_status_text->setStyleSheet("QLabel{\
|
||||
- width: 126px;\
|
||||
- height: 27px;\
|
||||
- font-size: 18px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 500;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ tranfer_status_text->setFont(ft_18);
|
||||
|
||||
if (is_Intel)
|
||||
initIntelLayout();
|
||||
@@ -176,20 +136,16 @@ BluetoothFileTransferWidget::~BluetoothFileTransferWidget()
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initLayout() {
|
||||
+ QFont ft_14;
|
||||
+ ft_14.setPixelSize(14);
|
||||
+
|
||||
this->setFixedSize(520,620);
|
||||
title_icon = new QLabel(this);
|
||||
title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
title_icon->resize(22,22);
|
||||
|
||||
title_text = new QLabel(tr("Bluetooth file transfer"),this);
|
||||
- title_text->setStyleSheet("QLabel{\
|
||||
- width: 200px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ title_text->setFont(ft_14);
|
||||
|
||||
close_btn = new QPushButton(this);
|
||||
close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||
@@ -212,39 +168,27 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
dev_widget->setGeometry(32,175,456,356);
|
||||
Tiptop->setGeometry(32,144,100,20);
|
||||
target_size->setGeometry(112,88,70,30);
|
||||
- tip_text->setGeometry(32,52,452,28);
|
||||
+ tip_text->setGeometry(32,52,452,56);
|
||||
target_icon->setGeometry(32,56,64,64);
|
||||
target_name->setGeometry(112,63,400,20);
|
||||
transNum->setGeometry(459,168,52,20);
|
||||
if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,175,406,8);
|
||||
+ m_progressbar->setGeometry(32,185,406,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,175,454,8);
|
||||
+ m_progressbar->setGeometry(32,185,454,8);
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
+ QFont ft_14;
|
||||
+ ft_14.setPixelSize(14);
|
||||
this->setWindowFlags(Qt::Dialog);
|
||||
this->setFixedSize(478,530);
|
||||
cancel_btn->setFixedSize(112,56);
|
||||
ok_btn->setFixedSize(112,56);
|
||||
target_name->setFixedHeight(23);
|
||||
- target_name->setStyleSheet("QLabel{\
|
||||
- width: 300px;\
|
||||
- height: 20px;\
|
||||
- font-size: 16px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ target_name->setFont(ft_14);
|
||||
target_size->setFixedWidth(68);
|
||||
- target_size->setStyleSheet("QLabel{\
|
||||
- width: 100px;\
|
||||
- height: 20px;\
|
||||
- font-size: 16px;\
|
||||
- font-family: NotoSansCJKsc-Regular;\
|
||||
- line-height: 24px;\
|
||||
- color: #818181;\
|
||||
- opacity: 1;}");
|
||||
+ target_size->setFont(ft_14);
|
||||
dev_widget->resize(430,296);
|
||||
ok_btn->setGeometry(342,450,112,56);
|
||||
cancel_btn->setGeometry(214,450,112,56);
|
||||
@@ -253,7 +197,7 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
dev_widget->setGeometry(24,139,430,296);
|
||||
Tiptop->setGeometry(32,111,100,20);
|
||||
target_size->setGeometry(104,60,70,30);
|
||||
- tip_text->setGeometry(32,32,452,28);
|
||||
+ tip_text->setGeometry(32,32,452,56);
|
||||
target_icon->setGeometry(24,24,64,64);
|
||||
target_name->setGeometry(104,28,400,20);
|
||||
transNum->setGeometry(410,148,52,20);
|
||||
@@ -350,9 +294,9 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
target_size->setGeometry(104,103,68,30);
|
||||
} else {
|
||||
cancel_btn->setGeometry(376, 213, 100, 36);
|
||||
- target_icon->setGeometry(32,95,64,64);
|
||||
- target_name->setGeometry(112,102,400,20);
|
||||
- target_size->setGeometry(112,127,68,30);
|
||||
+ target_icon->setGeometry(32,105,64,64);
|
||||
+ target_name->setGeometry(112,112,400,20);
|
||||
+ target_size->setGeometry(112,137,68,30);
|
||||
}
|
||||
|
||||
main_animation_group = new QParallelAnimationGroup(this);
|
||||
@@ -448,9 +392,9 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
m_progressbar->setGeometry(24,155,420,8);
|
||||
else
|
||||
if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,175,406,8);
|
||||
+ m_progressbar->setGeometry(32,185,406,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,175,454,8);
|
||||
+ m_progressbar->setGeometry(32,185,454,8);
|
||||
transNum->setVisible(fileNums - 1);
|
||||
this->update();
|
||||
this->activateWindow();
|
||||
@@ -511,12 +455,9 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
tranfer_status_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-success.svg"));
|
||||
tranfer_status_text->setText(tr("File Transmition Succeed!"));
|
||||
tranfer_status_text->setFixedWidth(500);
|
||||
- tranfer_status_text->setStyleSheet("QLabel{\
|
||||
- font-family: NotoSansCJKsc;\
|
||||
- font-size: 16px;\
|
||||
- line-height: 19px;\
|
||||
- text-align: center;\
|
||||
- color: #0FCE75;}");
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(16);
|
||||
+ tranfer_status_text->setFont(ft);
|
||||
if (is_Intel) {
|
||||
tranfer_status_icon->setGeometry(207,57,64,64);
|
||||
tranfer_status_text->setGeometry(191,129,200,24);
|
||||
@@ -561,12 +502,9 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
tranfer_status_icon->setFixedSize(64,64);
|
||||
tranfer_status_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
tranfer_status_text->setFixedWidth(500);
|
||||
- tranfer_status_text->setStyleSheet("QLabel{\
|
||||
- font-family: NotoSansCJKsc;\
|
||||
- font-size: 16px;\
|
||||
- line-height: 19px;\
|
||||
- text-align: center;\
|
||||
- color: #FB5050;}");
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(16);
|
||||
+ tranfer_status_text->setFont(ft);
|
||||
tranfer_status_icon->setGeometry(207,57,64,64);
|
||||
tranfer_status_text->setGeometry(191,129,200,24);
|
||||
}
|
||||
@@ -606,6 +544,19 @@ void BluetoothFileTransferWidget::GSettingsChanges(const QString &key)
|
||||
this->setPalette(palette);
|
||||
this->update();
|
||||
}
|
||||
+ if (key == "systemFontSize") {
|
||||
+ int size = GSettings->get("system-font-size").toInt() - 11;
|
||||
+ QFont ft;
|
||||
+ ft.setPixelSize(14+size);
|
||||
+ title_text->setFont(ft);
|
||||
+ target_size->setFont(ft);
|
||||
+ target_name->setFont(ft);
|
||||
+ transNum->setFont(ft);
|
||||
+ Tiptop->setFont(ft);
|
||||
+ ft.setPixelSize(18+size);
|
||||
+ tip_text->setFont(ft);
|
||||
+ tranfer_status_text->setFont(ft);
|
||||
+ }
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::onClicked_OK_Btn()
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index 7b2f0ca..6fa5890 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -57,21 +57,20 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
// line-height: 24px;}");
|
||||
//top_label->setWordWrap(true);
|
||||
|
||||
+ QFont ft_14, ft_16, ft_20, ft_24, ft_40;
|
||||
+ int ft_size = settings->get("system-font-size").toInt() - 11;
|
||||
+ ft_14.setPixelSize(14 + ft_size);
|
||||
+ ft_16.setPixelSize(16 + ft_size);
|
||||
+ ft_20.setPixelSize(20 + ft_size);
|
||||
+ ft_24.setPixelSize(24 + ft_size);
|
||||
+ ft_40.setPixelSize(40 + ft_size);
|
||||
tip_label = new QLabel(tip_text,this);
|
||||
- tip_label->setStyleSheet("QLabel{\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;}");
|
||||
+ tip_label->setFont(ft_14);
|
||||
tip_label->setWordWrap(true);
|
||||
tip_label->setToolTip(dev_name);
|
||||
|
||||
PIN_label = new QLabel(PINCode,this);
|
||||
- PIN_label->setStyleSheet("QLabel{\
|
||||
- font-size: 24px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;}");
|
||||
+ PIN_label->setFont(ft_24);
|
||||
|
||||
accept_btn = new QPushButton(tr("Connect"),this);
|
||||
|
||||
@@ -84,25 +83,15 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
connect(accept_btn,&QPushButton::clicked,this,&PinCodeWidget::onClick_close_btn);
|
||||
accept_btn->setText(tr("Confirm"));
|
||||
accept_btn->adjustSize();
|
||||
- //accept_btn->setVisible(false);
|
||||
+ //accept_btn->setddVisible(false);
|
||||
refuse_btn->setVisible(false);
|
||||
}
|
||||
|
||||
if (is_Intel) {
|
||||
this->setWindowFlags(Qt::Dialog);
|
||||
this->setFixedSize(510, 239);
|
||||
- tip_label->setStyleSheet("QLabel{\
|
||||
- font-size: 16px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;}");
|
||||
-
|
||||
- PIN_label->setStyleSheet("QLabel{\
|
||||
- font-size: 40px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;}");
|
||||
-
|
||||
+ tip_label->setFont(ft_16);
|
||||
+ PIN_label->setFont(ft_40);
|
||||
tip_label->setGeometry(24,24,450,40);
|
||||
PIN_label->setGeometry(24,88,462,47);
|
||||
accept_btn->setGeometry(374,159,112,56);
|
||||
@@ -114,14 +103,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
title_icon->resize(22,22);
|
||||
|
||||
title_text = new QLabel(tr("Bluetooth Connections"),this);
|
||||
- title_text->setStyleSheet("QLabel{\
|
||||
- width: 200px;\
|
||||
- height: 20px;\
|
||||
- font-size: 14px;\
|
||||
- font-family: Noto Sans CJK SC;\
|
||||
- font-weight: 400;\
|
||||
- line-height: 24px;\
|
||||
- opacity: 1;}");
|
||||
+ title_text->setFont(ft_14);
|
||||
title_text->adjustSize();
|
||||
|
||||
close_btn = new QPushButton(this);
|
||||
@@ -136,7 +118,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
title_icon->setGeometry(8, 8, 22, 22);
|
||||
title_text->setGeometry(38, 9, 160, 20);
|
||||
PIN_label->setGeometry(25,90,207,36);
|
||||
- tip_label->setGeometry(25,56,437,40);
|
||||
+ tip_label->setGeometry(25,56,437,44);
|
||||
accept_btn->setGeometry(388,152,108,36);
|
||||
refuse_btn->setGeometry(264,152,108,36);
|
||||
}
|
||||
@@ -194,7 +176,10 @@ void PinCodeWidget::updateUIInfo(const QString &name, const QString &pin)
|
||||
tip_label->setToolTip(name);
|
||||
}
|
||||
if(show_flag)
|
||||
- tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
+ if (is_Intel)
|
||||
+ tip_text = tr("If the PIN on \'")+Name+tr("\' is the same as this PIN. Please press \'Connect\'");
|
||||
+ else
|
||||
+ tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
else
|
||||
tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair:")).arg(Name);
|
||||
tip_label->setText(tip_text);
|
||||
@@ -239,6 +224,16 @@ void PinCodeWidget::GSettingsChanges(const QString &key)
|
||||
palette.setColor(QPalette::Background,QColor(Qt::black));
|
||||
}
|
||||
}
|
||||
+ if (key == "systemFontSize") {
|
||||
+ int size = settings->get("system-font-size").toInt() - 11;
|
||||
+ qDebug() << Q_FUNC_INFO << size;
|
||||
+ QFont ft, ft1;
|
||||
+ ft.setPixelSize(14 + size);
|
||||
+ tip_label->setFont(ft);
|
||||
+ title_text->setFont(ft);
|
||||
+ ft1.setPixelSize(24 + size);
|
||||
+ PIN_label->setFont(ft1);
|
||||
+ }
|
||||
this->setPalette(palette);
|
||||
this->update();
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 8f8ad08..a3c9611 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -76,7 +76,7 @@ void QDevItem::InitMemberVariables()
|
||||
void QDevItem::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
-
|
||||
+ _leaved = false;
|
||||
_MStatus = Status::Hover;
|
||||
update();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void QDevItem::enterEvent(QEvent *event)
|
||||
void QDevItem::leaveEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
-
|
||||
+ _leaved = true;
|
||||
_MStatus = Status::Nomal;
|
||||
update();
|
||||
}
|
||||
@@ -94,12 +94,17 @@ void QDevItem::mousePressEvent(QMouseEvent *event)
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
_pressFlag = true;
|
||||
_MStatus = Status::Click;
|
||||
+ this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QDevItem::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && _pressFlag) {
|
||||
+ if (_leaved)
|
||||
+ _MStatus = Status::Nomal;
|
||||
+ else
|
||||
+ _MStatus = Status::Hover;
|
||||
MouseClickedFunc();
|
||||
}
|
||||
}
|
||||
@@ -169,12 +174,23 @@ QColor QDevItem::getDevStatusColor()
|
||||
{
|
||||
QColor color;
|
||||
if (_Connected) {
|
||||
- color = QColor("#2FB3E8");
|
||||
- } else {
|
||||
- if(StyleSettings->get("style-name").toString() == "ukui-light")
|
||||
- color = QColor("#EBEBEB");
|
||||
+ if (_MStatus == Status::Click)
|
||||
+ color = QColor("#1699CF");
|
||||
else
|
||||
- color = QColor(55, 55, 59);
|
||||
+ color = QColor("#2FB3E8");
|
||||
+ } else {
|
||||
+ if(StyleSettings->get("style-name").toString() == "ukui-light") {
|
||||
+ if (_MStatus == Status::Click)
|
||||
+ color = QColor("#E0E0E0");
|
||||
+ else
|
||||
+ color = QColor("#EFEFEF");
|
||||
+ } else {
|
||||
+ if (_MStatus == Status::Click)
|
||||
+ color = QColor("#444444");
|
||||
+ else
|
||||
+ color = QColor("#666666");
|
||||
+ }
|
||||
+ color.setAlpha(tran);
|
||||
}
|
||||
|
||||
return color;
|
||||
diff --git a/ukui-bluetooth/component/qdevitem.h b/ukui-bluetooth/component/qdevitem.h
|
||||
index c5d3b4d..837f992 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.h
|
||||
+++ b/ukui-bluetooth/component/qdevitem.h
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
bool _pressFlag;
|
||||
int iconFlag = 7;
|
||||
bool _Connected;
|
||||
+ bool _leaved = false;
|
||||
|
||||
QTimer *_iconTimer = nullptr;
|
||||
BluezQt::DevicePtr _MDev = nullptr;
|
|
@ -0,0 +1,19 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index a3c9611..adc2c9c 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -268,8 +268,12 @@ void QDevItem::DrawStatusIcon(QPainter &painter)
|
||||
painter.setPen(QColor(Qt::black));
|
||||
batteryPixmap = getDevTypeIcon();
|
||||
} else {
|
||||
- painter.setPen(QColor(Qt::white));
|
||||
- batteryPixmap = loadSvg(getDevTypeIcon(), PixmapColor::WHITE);
|
||||
+ if (StyleSettings->get("icon-theme-name").toString() == "ukui-classical")
|
||||
+ batteryPixmap = getDevTypeIcon();
|
||||
+ else {
|
||||
+ painter.setPen(QColor(Qt::white));
|
||||
+ batteryPixmap = loadSvg(getDevTypeIcon(), PixmapColor::WHITE);
|
||||
+ }
|
||||
}
|
||||
|
||||
style()->drawItemPixmap(&painter, QRect(25, 16, 18, 18), Qt::AlignCenter, batteryPixmap);
|
|
@ -0,0 +1,57 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index d02f9e2..84a63a9 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -19,6 +19,7 @@ const QString INTERFACE = "com.ukui.bluetooth";
|
||||
static qint64 blockChangeTime = 0;
|
||||
qint64 powerChangeTime = 0;
|
||||
bool resetFlag = false;
|
||||
+bool rebootFlag = false;
|
||||
|
||||
/************************************************
|
||||
* @brief 判断是否存在给定的程序启动参数
|
||||
@@ -272,6 +273,14 @@ void Daemon::initBluezManager()
|
||||
if (operational) {
|
||||
qInfo() << Q_FUNC_INFO << "Bluez Manager restart";
|
||||
registerBluezAgent();
|
||||
+ } else {
|
||||
+ if (_DefualtAdapter) {
|
||||
+ if (abs(QDateTime::currentMSecsSinceEpoch() - ::powerChangeTime) >= 300) {
|
||||
+ ::rebootFlag = true;
|
||||
+ } else {
|
||||
+ ::rebootFlag = false;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
});
|
||||
|
||||
diff --git a/service/daemon.h b/service/daemon.h
|
||||
index 8a34d31..db57eab 100644
|
||||
--- a/service/daemon.h
|
||||
+++ b/service/daemon.h
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
extern qint64 powerChangeTime;
|
||||
extern bool resetFlag;
|
||||
+extern bool rebootFlag;
|
||||
|
||||
enum DevOperate {
|
||||
PAIR = 0,
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index aef72e9..052bd6b 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -749,11 +749,12 @@ void SessionDbusRegister::connectSignal()
|
||||
// if (powered)
|
||||
Daemon::reconnectFunc();
|
||||
|
||||
- if (::resetFlag) {
|
||||
+ if (::resetFlag || ::rebootFlag) {
|
||||
QTimer::singleShot(100,this,[=]{
|
||||
Daemon::_DefualtAdapter.data()->setPowered(false);
|
||||
});
|
||||
::resetFlag = false;
|
||||
+ ::rebootFlag = false;
|
||||
}
|
||||
|
||||
Config::gsetting->set("switch",QVariant(powered));
|
|
@ -0,0 +1,438 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 01aebcc..d029650 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "sessiondbusregister.h"
|
||||
|
||||
+static bool isScan = false;
|
||||
+
|
||||
static inline bool isAvailableAddress(QString addr) {
|
||||
if (addr.isEmpty() || addr.isNull())
|
||||
return false;
|
||||
@@ -42,12 +44,10 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
|
||||
- static bool isScan = false;
|
||||
-
|
||||
if (dev)
|
||||
{
|
||||
if (Daemon::_DefualtAdapter.data()->isDiscovering()) {
|
||||
- isScan = true;
|
||||
+ ::isScan = true;
|
||||
Daemon::_DefualtAdapter.data()->stopDiscovery();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
dev.data()->type() == BluezQt::Device::Headset ) {
|
||||
|
||||
BluezQt::PendingCall *pending = dev.data()->disconnectFromDevice();
|
||||
- connect(pending,&BluezQt::PendingCall::finished,this,[&](BluezQt::PendingCall *call){
|
||||
+ connect(pending,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *call){
|
||||
if (!call->error()) {
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
@@ -74,7 +74,7 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
|
||||
- if (isScan) {
|
||||
+ if (::isScan) {
|
||||
Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
}
|
||||
});
|
||||
@@ -88,13 +88,13 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
}
|
||||
//当没有任何音频设备连接,最后再连接目标设备
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
- connect(call,&BluezQt::PendingCall::finished,this,[&](BluezQt::PendingCall *callReturn){
|
||||
+ connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
|
||||
- if (isScan) {
|
||||
+ if (::isScan) {
|
||||
Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
}
|
||||
});
|
||||
@@ -103,13 +103,13 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
qDebug () << Q_FUNC_INFO << dev.data()->type() << __LINE__;
|
||||
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
- connect(call,&BluezQt::PendingCall::finished,this,[&](BluezQt::PendingCall *callReturn){
|
||||
+ connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
|
||||
- if (isScan) {
|
||||
+ if (::isScan) {
|
||||
Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
}
|
||||
|
||||
@@ -548,6 +548,7 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::discoveringChanged,this,[=](bool status){
|
||||
qDebug() << Q_FUNC_INFO << "discoveringChanged" << __LINE__;
|
||||
+// ::isScan = status;
|
||||
emit defaultScanStatusChanged(status);
|
||||
});
|
||||
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index b7650fc..7bd5476 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -424,10 +424,12 @@ void BlueToothMain::refreshBluetoothAdapterInterfaceUI()
|
||||
{
|
||||
_MCentralWidget->setCurrentWidget(m_normal_main_widget);
|
||||
}
|
||||
- if(frame_2->isVisible())
|
||||
+ if(frame_2->isVisible()) {
|
||||
frame_2->setVisible(false);
|
||||
- frame_top->setMinimumSize(582,187);
|
||||
- frame_top->setMaximumSize(1800,187);
|
||||
+ line_frame2->setVisible(false);
|
||||
+ }
|
||||
+ frame_top->setMinimumSize(582,217);
|
||||
+ frame_top->setMaximumSize(1800,217);
|
||||
}
|
||||
else if (m_adapter_address_list.size() > 1)
|
||||
{
|
||||
@@ -437,8 +439,8 @@ void BlueToothMain::refreshBluetoothAdapterInterfaceUI()
|
||||
}
|
||||
if(!frame_2->isVisible())
|
||||
frame_2->setVisible(true);
|
||||
- frame_top->setMinimumSize(582,239);
|
||||
- frame_top->setMaximumSize(1800,239);
|
||||
+ frame_top->setMinimumSize(582,279);
|
||||
+ frame_top->setMaximumSize(1800,279);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -775,6 +777,8 @@ void BlueToothMain::addMyDeviceItemUI(bluetoothdevice * device)
|
||||
//setDefaultAdapterScanOn(true);
|
||||
});
|
||||
m_myDev_show_flag = true;
|
||||
+
|
||||
+ mDevFrameAddLineFrame("paired",device->getDevAddress());
|
||||
paired_dev_layout->addWidget(item,Qt::AlignTop);
|
||||
}
|
||||
return;
|
||||
@@ -859,6 +863,7 @@ void BlueToothMain::addOneBluetoothDeviceItemUi(bluetoothdevice * device)
|
||||
delayStartDiscover_timer->start();
|
||||
});
|
||||
|
||||
+ mDevFrameAddLineFrame("other",device->getDevAddress());
|
||||
device_list_layout->insertWidget(0,item,0,Qt::AlignTop);
|
||||
|
||||
last_discovery_device_address << device->getDevAddress();
|
||||
@@ -1336,13 +1341,13 @@ void BlueToothMain::showBluetoothNormalMainWindow()
|
||||
if ((m_adapter_address_list.size() > 1) &&
|
||||
(m_adapter_address_list.size() == m_adapter_name_list.size()))//用什么作为适配数量的判断
|
||||
{
|
||||
- frame_top->setMinimumSize(582,239);
|
||||
- frame_top->setMaximumSize(1800,239);
|
||||
+ frame_top->setMinimumSize(582,279);
|
||||
+ frame_top->setMaximumSize(1800,279);
|
||||
}
|
||||
else
|
||||
{
|
||||
- frame_top->setMinimumSize(582,187);
|
||||
- frame_top->setMaximumSize(1800,187);
|
||||
+ frame_top->setMinimumSize(582,217);
|
||||
+ frame_top->setMaximumSize(1800,217);
|
||||
}
|
||||
|
||||
frame_middle = new QWidget(m_normal_main_widget);
|
||||
@@ -1380,18 +1385,28 @@ void BlueToothMain::initMainWindowTopUI()
|
||||
top_layout->setContentsMargins(0,0,0,0);
|
||||
top_layout->addWidget(label_1);
|
||||
|
||||
- QVBoxLayout *layout = new QVBoxLayout();
|
||||
+ QFrame *top_frame = new QFrame(frame_top);
|
||||
+ top_frame->setMinimumWidth(582);
|
||||
+ top_frame->setFrameShape(QFrame::Shape::Box);
|
||||
+ top_layout->addWidget(top_frame);
|
||||
+
|
||||
+ QVBoxLayout *layout = new QVBoxLayout(top_frame);
|
||||
layout->setSpacing(2);
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
- top_layout->addLayout(layout);
|
||||
|
||||
- QFrame *frame_1 = new QFrame(frame_top);
|
||||
+ QFrame *frame_1 = new QFrame(top_frame);
|
||||
frame_1->setMinimumWidth(582);
|
||||
frame_1->setFrameShape(QFrame::Shape::Box);
|
||||
- frame_1->setFixedHeight(50);
|
||||
+ frame_1->setFixedHeight(60);
|
||||
frame_1->setAutoFillBackground(true);
|
||||
layout->addWidget(frame_1);
|
||||
|
||||
+ QFrame *line_frame1 = new QFrame(top_frame);
|
||||
+ line_frame1->setFixedHeight(1);
|
||||
+ line_frame1->setMinimumWidth(582);
|
||||
+ line_frame1->setFrameStyle(QFrame::HLine);
|
||||
+ layout->addWidget(line_frame1);
|
||||
+
|
||||
QHBoxLayout *frame_1_layout = new QHBoxLayout(frame_1);
|
||||
frame_1_layout->setSpacing(10);
|
||||
frame_1_layout->setContentsMargins(16,0,16,0);
|
||||
@@ -1416,13 +1431,21 @@ void BlueToothMain::initMainWindowTopUI()
|
||||
|
||||
frame_1_layout->addWidget(m_open_bluetooth_btn);
|
||||
|
||||
- frame_2 = new QFrame(frame_top);
|
||||
+ line_frame2 = new QFrame(top_frame);
|
||||
+ line_frame2->setFixedHeight(1);
|
||||
+ line_frame2->setMinimumWidth(582);
|
||||
+ line_frame2->setFrameStyle(QFrame::HLine);
|
||||
+
|
||||
+ frame_2 = new QFrame(top_frame);
|
||||
frame_2->setMinimumWidth(582);
|
||||
frame_2->setFrameShape(QFrame::Shape::Box);
|
||||
- frame_2->setFixedHeight(50);
|
||||
- if(m_adapter_address_list.size() <= 1)
|
||||
- frame_2->setVisible(false);
|
||||
+ frame_2->setFixedHeight(60);
|
||||
layout->addWidget(frame_2);
|
||||
+ layout->addWidget(line_frame2);
|
||||
+ if(m_adapter_address_list.size() <= 1) {
|
||||
+ frame_2->setVisible(false);
|
||||
+ line_frame2->setVisible(false);
|
||||
+ }
|
||||
|
||||
QHBoxLayout *frame_2_layout = new QHBoxLayout(frame_2);
|
||||
frame_2_layout->setSpacing(10);
|
||||
@@ -1446,12 +1469,18 @@ void BlueToothMain::initMainWindowTopUI()
|
||||
connect(m_adapter_list_cmbox,SIGNAL(currentIndexChanged(int)),this,SLOT(adapterComboxChanged(int)));
|
||||
frame_2_layout->addWidget(m_adapter_list_cmbox);
|
||||
|
||||
- QFrame *frame_3 = new QFrame(frame_top);
|
||||
+ QFrame *frame_3 = new QFrame(top_frame);
|
||||
frame_3->setMinimumWidth(582);
|
||||
frame_3->setFrameShape(QFrame::Shape::Box);
|
||||
- frame_3->setFixedHeight(50);
|
||||
+ frame_3->setFixedHeight(60);
|
||||
layout->addWidget(frame_3);
|
||||
|
||||
+ QFrame *line_frame3 = new QFrame(top_frame);
|
||||
+ line_frame3->setFixedHeight(1);
|
||||
+ line_frame3->setMinimumWidth(582);
|
||||
+ line_frame3->setFrameStyle(QFrame::HLine);
|
||||
+ layout->addWidget(line_frame3);
|
||||
+
|
||||
QHBoxLayout *frame_3_layout = new QHBoxLayout(frame_3);
|
||||
frame_3_layout->setSpacing(10);
|
||||
frame_3_layout->setContentsMargins(16,0,16,0);
|
||||
@@ -1479,10 +1508,10 @@ void BlueToothMain::initMainWindowTopUI()
|
||||
}
|
||||
connect(m_show_panel_btn,&SwitchButton::checkedChanged,this,&BlueToothMain::setTrayVisible);
|
||||
|
||||
- QFrame *frame_4 = new QFrame(frame_top);
|
||||
+ QFrame *frame_4 = new QFrame(top_frame);
|
||||
frame_4->setMinimumWidth(582);
|
||||
frame_4->setFrameShape(QFrame::Shape::Box);
|
||||
- frame_4->setFixedHeight(50);
|
||||
+ frame_4->setFixedHeight(60);
|
||||
layout->addWidget(frame_4);
|
||||
|
||||
QHBoxLayout *frame_4_layout = new QHBoxLayout(frame_4);
|
||||
@@ -1517,16 +1546,21 @@ void BlueToothMain::initMainWindowMiddleUI()
|
||||
middle_layout->setSpacing(8);
|
||||
middle_layout->setContentsMargins(0,0,0,0);
|
||||
|
||||
- paired_dev_layout = new QVBoxLayout();
|
||||
- paired_dev_layout->setSpacing(2);
|
||||
- paired_dev_layout->setContentsMargins(0,0,0,0);
|
||||
-
|
||||
TitleLabel *middle_label = new TitleLabel(frame_middle);
|
||||
middle_label->setText(tr("My Devices"));
|
||||
middle_label->resize(72,25);
|
||||
|
||||
+ QFrame *mDev_frame = new QFrame(frame_middle);
|
||||
+ mDev_frame->setObjectName("mDev_frame");
|
||||
+ mDev_frame->setMinimumWidth(582);
|
||||
+ mDev_frame->setFrameShape(QFrame::Shape::Box);
|
||||
+
|
||||
+ paired_dev_layout = new QVBoxLayout(mDev_frame);
|
||||
+ paired_dev_layout->setSpacing(2);
|
||||
+ paired_dev_layout->setContentsMargins(0,0,0,0);
|
||||
+
|
||||
middle_layout->addWidget(middle_label,Qt::AlignTop);
|
||||
- middle_layout->addLayout(paired_dev_layout,Qt::AlignTop);
|
||||
+ middle_layout->addWidget(mDev_frame,Qt::AlignTop);
|
||||
|
||||
frame_middle->setLayout(middle_layout);
|
||||
}
|
||||
@@ -1595,7 +1629,10 @@ void BlueToothMain::initMainWindowbottomUI()
|
||||
bottom_layout->setContentsMargins(0,0,0,0);
|
||||
bottom_layout->addLayout(title_layout);
|
||||
|
||||
- device_list = new QWidget();
|
||||
+ device_list = new QFrame();
|
||||
+ device_list->setObjectName("device_list");
|
||||
+ device_list->setMinimumWidth(582);
|
||||
+ device_list->setFrameShape(QFrame::Shape::Box);
|
||||
|
||||
bottom_layout->addWidget(device_list);
|
||||
|
||||
@@ -1722,10 +1759,20 @@ void BlueToothMain::changeDeviceParentWindow(const QString &address)
|
||||
}
|
||||
|
||||
DeviceInfoItem *item = device_list->findChild<DeviceInfoItem *>(address);
|
||||
+ QFrame *line_item = device_list->findChild<QFrame *>("line-"+address);
|
||||
if(item){
|
||||
device_list_layout->removeWidget(item);
|
||||
item->setParent(frame_middle);
|
||||
+
|
||||
+ if(line_item) {
|
||||
+ device_list_layout->removeWidget(line_item);
|
||||
+ line_item->setParent(NULL);
|
||||
+ line_item->deleteLater();
|
||||
+ }
|
||||
+
|
||||
+ mDevFrameAddLineFrame("paired",address);
|
||||
paired_dev_layout->addWidget(item);
|
||||
+
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
@@ -1797,11 +1844,18 @@ void BlueToothMain::removeDeviceItemUI(QString address)
|
||||
//if(last_discovery_device_address.indexOf(address) != -1)
|
||||
//{
|
||||
DeviceInfoItem *item = device_list->findChild<DeviceInfoItem *>(address);
|
||||
+ QFrame *line_item = device_list->findChild<QFrame *>("line-"+address);
|
||||
if(item)
|
||||
{
|
||||
device_list_layout->removeWidget(item);
|
||||
item->setParent(NULL);
|
||||
item->deleteLater();
|
||||
+
|
||||
+ if(line_item) {
|
||||
+ device_list_layout->removeWidget(line_item);
|
||||
+ line_item->setParent(NULL);
|
||||
+ line_item->deleteLater();
|
||||
+ }
|
||||
//m_discovery_device_address_all_list.removeAll(address);
|
||||
//last_discovery_device_address.removeAll(address);
|
||||
}
|
||||
@@ -1814,10 +1868,21 @@ void BlueToothMain::removeDeviceItemUI(QString address)
|
||||
//}else{
|
||||
//DeviceInfoItem *item = frame_middle->findChild<DeviceInfoItem *>(address);
|
||||
item = frame_middle->findChild<DeviceInfoItem *>(address);
|
||||
+ line_item = frame_middle->findChild<QFrame *>("line-"+address);
|
||||
if(item){
|
||||
+
|
||||
+
|
||||
paired_dev_layout->removeWidget(item);
|
||||
item->setParent(NULL);
|
||||
item->deleteLater();
|
||||
+
|
||||
+ if (line_item) {
|
||||
+ paired_dev_layout->removeWidget(line_item);
|
||||
+ line_item->setParent(NULL);
|
||||
+ line_item->deleteLater();
|
||||
+ } else
|
||||
+ removeMDevFrameLineFrame("paired");
|
||||
+
|
||||
qDebug() << Q_FUNC_INFO << "frame_middle->children().size()" << frame_middle->children().size();
|
||||
if(frame_middle->children().size() == 2)
|
||||
{
|
||||
@@ -2024,6 +2089,67 @@ void BlueToothMain::adapterComboxChanged(int i)
|
||||
qDebug() << Q_FUNC_INFO << "end";
|
||||
}
|
||||
|
||||
+void BlueToothMain::mDevFrameAddLineFrame(QString str,QString addr)
|
||||
+{
|
||||
+ qDebug() << Q_FUNC_INFO << "#########################" << addr;
|
||||
+
|
||||
+ if ("paired" == str) {
|
||||
+
|
||||
+ if (!frame_middle->findChildren<DeviceInfoItem *>().size()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ QFrame *line_frame = new QFrame(mDev_frame);
|
||||
+ line_frame->setObjectName("line-"+addr);
|
||||
+ line_frame->setFixedHeight(1);
|
||||
+ line_frame->setMinimumWidth(582);
|
||||
+ line_frame->setFrameStyle(QFrame::HLine);
|
||||
+ paired_dev_layout->addWidget(line_frame,Qt::AlignTop);
|
||||
+
|
||||
+ } else if ("other" == str) {
|
||||
+
|
||||
+ if (!frame_bottom->findChildren<DeviceInfoItem *>().size()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ QFrame *line_frame = new QFrame(device_list);
|
||||
+ line_frame->setObjectName("line-"+addr);
|
||||
+ line_frame->setFixedHeight(1);
|
||||
+ line_frame->setMinimumWidth(582);
|
||||
+ line_frame->setFrameStyle(QFrame::HLine);
|
||||
+ device_list_layout->insertWidget(0,line_frame,Qt::AlignTop);
|
||||
+
|
||||
+ } else {
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void BlueToothMain::removeMDevFrameLineFrame(QString str)
|
||||
+{
|
||||
+ qDebug() << Q_FUNC_INFO ;
|
||||
+
|
||||
+ if ("paired" == str) {
|
||||
+
|
||||
+ if ((frame_middle->findChildren<QFrame *>().size() - frame_middle->findChildren<DeviceInfoItem *>().size() - 2) == frame_middle->findChildren<DeviceInfoItem *>().size()) {
|
||||
+ QLayoutItem *child;
|
||||
+ if ((child = paired_dev_layout->takeAt(0)) != 0) {
|
||||
+ if (child->widget()->objectName().startsWith("line-")) {
|
||||
+
|
||||
+ child->widget()->setParent(NULL);
|
||||
+
|
||||
+ delete child;
|
||||
+ child = nullptr;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ } else if ("other" == str) {
|
||||
+
|
||||
+ } else {
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void BlueToothMain::cleanPairDevices()
|
||||
{
|
||||
QLayoutItem *child;
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.h b/ukcc-bluetooth/bluetoothmain.h
|
||||
index 8cba45e..32de960 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.h
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.h
|
||||
@@ -115,8 +115,10 @@ private:
|
||||
QVBoxLayout * errorWidgetLayout = nullptr;
|
||||
QLabel * errorWidgetIcon = nullptr;
|
||||
QLabel * errorWidgetTip0 = nullptr;
|
||||
+ QFrame * line_frame2 = nullptr;
|
||||
+ QFrame * mDev_frame = nullptr;
|
||||
|
||||
- QWidget * device_list = nullptr;
|
||||
+ QFrame * device_list = nullptr;
|
||||
QWidget * paired_device_list = nullptr;
|
||||
QVBoxLayout * device_list_layout = nullptr;
|
||||
BluetoothNameLabel * bluetooth_name = nullptr;
|
||||
@@ -175,7 +177,8 @@ private:
|
||||
QTimer * delayStartDiscover_timer = nullptr;
|
||||
|
||||
private:
|
||||
-
|
||||
+ void mDevFrameAddLineFrame(QString,QString);
|
||||
+ void removeMDevFrameLineFrame(QString);
|
||||
void monitorBluetoothDbusConnection();
|
||||
void removeDeviceItemUI(QString address);
|
||||
void addMyDeviceItemUI(bluetoothdevice *);
|
|
@ -0,0 +1,125 @@
|
|||
diff --git a/patches/series b/patches/series
|
||||
index f389773..4a3f45a 100644
|
||||
--- a/patches/series
|
||||
+++ b/patches/series
|
||||
@@ -24,3 +24,4 @@ ukcc_bluetooth_more_adapter.patch
|
||||
ukcc_bluetooth_ui_error.patch
|
||||
huawei_connect_back_strategy.patch
|
||||
fixed_bug_89263.patch
|
||||
+fixed_bug_93037.patch
|
||||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 94e72db..9342c48 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -642,13 +642,14 @@ void Daemon::launchDbusSignal()
|
||||
|
||||
void Daemon::reconnectFunc()
|
||||
{
|
||||
- if (!_mGsetting["switch"].toBool()) {
|
||||
- qInfo() << Q_FUNC_INFO << "Adapter is power down;";
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
qInfo() << Q_FUNC_INFO << "START";
|
||||
QTimer::singleShot(400,this,[=]{
|
||||
+
|
||||
+ if (!_DefualtAdapter.data()->isPowered()) {
|
||||
+ qInfo() << Q_FUNC_INFO << "Adapter is power down;";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
QStringList target_list = Config::getDeviceConnectTimeList(QString("/etc/pairDevice.list"));
|
||||
qInfo() << "reconnect dev list" << target_list;
|
||||
qDebug() << Q_FUNC_INFO << target_list;
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index d029650..e8f186b 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -42,7 +42,7 @@ bool SessionDbusRegister::InterfaceAlreadyExists()
|
||||
|
||||
void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
{
|
||||
- qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
+ qDebug () << Q_FUNC_INFO << "START" << __LINE__;
|
||||
|
||||
if (dev)
|
||||
{
|
||||
@@ -57,15 +57,19 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
|
||||
BluezQt::AdapterPtr MDevAdapter = dev.data()->adapter();
|
||||
|
||||
- for (auto dev : MDevAdapter.data()->devices()) {
|
||||
+ for (auto tmpdev : MDevAdapter.data()->devices()) {
|
||||
+ qDebug () << Q_FUNC_INFO << "=======================" << tmpdev.data()->name() << __LINE__;
|
||||
+ if (tmpdev.data()->isConnected() && tmpdev.data()->isPaired()) {
|
||||
+ if (tmpdev.data()->type() == BluezQt::Device::AudioVideo ||
|
||||
+ tmpdev.data()->type() == BluezQt::Device::Headphones ||
|
||||
+ tmpdev.data()->type() == BluezQt::Device::Headset ) {
|
||||
|
||||
- if (dev.data()->isConnected() && dev.data()->isPaired()) {
|
||||
- if (dev.data()->type() == BluezQt::Device::AudioVideo ||
|
||||
- dev.data()->type() == BluezQt::Device::Headphones ||
|
||||
- dev.data()->type() == BluezQt::Device::Headset ) {
|
||||
+ qDebug () << Q_FUNC_INFO << "==================disconn=====" << tmpdev.data()->name() << __LINE__;
|
||||
|
||||
- BluezQt::PendingCall *pending = dev.data()->disconnectFromDevice();
|
||||
+ BluezQt::PendingCall *pending = tmpdev.data()->disconnectFromDevice();
|
||||
+ qDebug () << Q_FUNC_INFO << "=======================" << __LINE__;
|
||||
connect(pending,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *call){
|
||||
+ qDebug () << Q_FUNC_INFO << "=================conn======" << dev.data()->name() << call << __LINE__;
|
||||
if (!call->error()) {
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
@@ -73,7 +77,7 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
-
|
||||
+ qDebug () << Q_FUNC_INFO << "===================conn====" << dev.data()->name() << " ok" << __LINE__;
|
||||
if (::isScan) {
|
||||
Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
}
|
||||
@@ -88,6 +92,7 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
}
|
||||
//当没有任何音频设备连接,最后再连接目标设备
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
+
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
@@ -116,6 +121,8 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
});
|
||||
}
|
||||
}
|
||||
+
|
||||
+ qDebug () << Q_FUNC_INFO << "END" << __LINE__;
|
||||
}
|
||||
|
||||
bool SessionDbusRegister::getBluetoothBlock()
|
||||
@@ -548,7 +555,7 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::discoveringChanged,this,[=](bool status){
|
||||
qDebug() << Q_FUNC_INFO << "discoveringChanged" << __LINE__;
|
||||
-// ::isScan = status;
|
||||
+ ::isScan = status;
|
||||
emit defaultScanStatusChanged(status);
|
||||
});
|
||||
|
||||
@@ -566,7 +573,7 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(devPtr.data(),&BluezQt::Device::connectedChanged,this,[=](bool v){
|
||||
qDebug() << Q_FUNC_INFO << "connectedChanged" << devPtr.data()->address() <<
|
||||
- v << devPtr.data()->isPaired() << devPtr->isConnected();
|
||||
+ v << devPtr.data()->isPaired() << devPtr->isConnected() << devPtr.data()->name();
|
||||
emit devConnectStatusSignal(devPtr.data()->address(),v);
|
||||
|
||||
if (v && devPtr.data()->isPaired()) {
|
||||
@@ -606,7 +613,7 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(dev.data(),&BluezQt::Device::connectedChanged,this,[=](bool v){
|
||||
qDebug() << Q_FUNC_INFO << "connectedChanged" << dev.data()->address() <<
|
||||
- v << dev.data()->isPaired() << dev->isConnected();
|
||||
+ v << dev.data()->isPaired() << dev->isConnected() << dev.data()->name();
|
||||
emit devConnectStatusSignal(dev.data()->address(),v);
|
||||
|
||||
if (v && dev.data()->isPaired()) {
|
|
@ -0,0 +1,116 @@
|
|||
diff --git a/service/daemon.cpp b/service/daemon.cpp
|
||||
index 9342c48..4c42016 100644
|
||||
--- a/service/daemon.cpp
|
||||
+++ b/service/daemon.cpp
|
||||
@@ -319,7 +319,7 @@ void Daemon::initBluezManager()
|
||||
|
||||
_DefualtAdapter = getDefualtAdapter();
|
||||
qDebug() << Q_FUNC_INFO << _DefualtAdapter.data()->name();
|
||||
-
|
||||
+ launchDbusSignal();
|
||||
});
|
||||
|
||||
connect(_BluezManager,&BluezQt::Manager::bluetoothOperationalChanged,this,[=](bool operational){
|
||||
@@ -574,7 +574,6 @@ void Daemon::monitorSleepSlot(bool sleep)
|
||||
QTimer::singleShot(200,this,[=]{
|
||||
_DefualtAdapter = getDefualtAdapter();
|
||||
launchDbusSignal();
|
||||
-
|
||||
});
|
||||
|
||||
reconnectFunc();
|
||||
@@ -637,7 +636,6 @@ void Daemon::launchDbusSignal()
|
||||
QDBusInterface interface(SERVICE,PATH,INTERFACE,QDBusConnection::sessionBus());
|
||||
interface.call("connectSignal");
|
||||
qDebug() << Q_FUNC_INFO << "end";
|
||||
-
|
||||
}
|
||||
|
||||
void Daemon::reconnectFunc()
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index e8f186b..99e140c 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -187,7 +187,8 @@ QString SessionDbusRegister::getAdapterNameByAddr(QString addr)
|
||||
void SessionDbusRegister::setDefaultAdapterScanOn(bool scanon)
|
||||
{
|
||||
if (!Daemon::_DefualtAdapter.isNull()) {
|
||||
- BluezQt::PendingCall *call = nullptr;
|
||||
+// BluezQt::PendingCall *call = nullptr;
|
||||
+ ::isScan = scanon;
|
||||
if (scanon) {
|
||||
Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
} else {
|
||||
@@ -555,7 +556,6 @@ void SessionDbusRegister::connectSignal()
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::discoveringChanged,this,[=](bool status){
|
||||
qDebug() << Q_FUNC_INFO << "discoveringChanged" << __LINE__;
|
||||
- ::isScan = status;
|
||||
emit defaultScanStatusChanged(status);
|
||||
});
|
||||
|
||||
@@ -565,7 +565,7 @@ void SessionDbusRegister::connectSignal()
|
||||
});
|
||||
|
||||
connect(Daemon::_DefualtAdapter.data(),&BluezQt::Adapter::deviceAdded,this,[=](BluezQt::DevicePtr devPtr){
|
||||
- qDebug() << Q_FUNC_INFO << "deviceAdded:" << devPtr->address() << ";line = "<< __LINE__ ;
|
||||
+ qInfo() << Q_FUNC_INFO << "deviceAdded:" << devPtr->address() << ";line = "<< __LINE__ ;
|
||||
emit deviceScanResult(devPtr.data()->address(),devPtr.data()->name(),BluezQt::Device::typeToString(devPtr.data()->type()));
|
||||
|
||||
//清空信号,防止重复连接
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index 7bd5476..a88c72f 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -1546,10 +1546,17 @@ void BlueToothMain::initMainWindowMiddleUI()
|
||||
middle_layout->setSpacing(8);
|
||||
middle_layout->setContentsMargins(0,0,0,0);
|
||||
|
||||
+
|
||||
+ QHBoxLayout *label_layout = new QHBoxLayout();
|
||||
+ label_layout->setSpacing(0);
|
||||
+ label_layout->setContentsMargins(16,0,0,0);
|
||||
+
|
||||
TitleLabel *middle_label = new TitleLabel(frame_middle);
|
||||
middle_label->setText(tr("My Devices"));
|
||||
middle_label->resize(72,25);
|
||||
|
||||
+ label_layout->addWidget(middle_label);
|
||||
+
|
||||
QFrame *mDev_frame = new QFrame(frame_middle);
|
||||
mDev_frame->setObjectName("mDev_frame");
|
||||
mDev_frame->setMinimumWidth(582);
|
||||
@@ -1559,7 +1566,7 @@ void BlueToothMain::initMainWindowMiddleUI()
|
||||
paired_dev_layout->setSpacing(2);
|
||||
paired_dev_layout->setContentsMargins(0,0,0,0);
|
||||
|
||||
- middle_layout->addWidget(middle_label,Qt::AlignTop);
|
||||
+ middle_layout->addLayout(label_layout,Qt::AlignTop);
|
||||
middle_layout->addWidget(mDev_frame,Qt::AlignTop);
|
||||
|
||||
frame_middle->setLayout(middle_layout);
|
||||
@@ -1569,7 +1576,7 @@ void BlueToothMain::initMainWindowbottomUI()
|
||||
{
|
||||
QHBoxLayout *title_layout = new QHBoxLayout();
|
||||
title_layout->setSpacing(10);
|
||||
- title_layout->setContentsMargins(0,0,10,0);
|
||||
+ title_layout->setContentsMargins(16,0,16,0);
|
||||
|
||||
TitleLabel *label_1 = new TitleLabel(frame_bottom);
|
||||
//~ contents_path /bluetooth/Other Devices
|
||||
diff --git a/ukcc-bluetooth/ukcc-bluetooth_zh_CN.qm b/ukcc-bluetooth/ukcc-bluetooth_zh_CN.qm
|
||||
index 16fcf52..a0272fd 100644
|
||||
Binary files a/ukcc-bluetooth/ukcc-bluetooth_zh_CN.qm and b/ukcc-bluetooth/ukcc-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukcc-bluetooth/ukcc-bluetooth_zh_CN.ts b/ukcc-bluetooth/ukcc-bluetooth_zh_CN.ts
|
||||
index 9ca4f2e..1c9482c 100644
|
||||
--- a/ukcc-bluetooth/ukcc-bluetooth_zh_CN.ts
|
||||
+++ b/ukcc-bluetooth/ukcc-bluetooth_zh_CN.ts
|
||||
@@ -40,7 +40,7 @@
|
||||
<message>
|
||||
<location filename="bluetoothmain.cpp" line="1536"/>
|
||||
<source>Other Devices</source>
|
||||
- <translation>蓝牙设备</translation>
|
||||
+ <translation>其他设备</translation>
|
||||
<extra-contents_path>/bluetooth/Other Devices</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 4a1213e..9cafd28 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -756,7 +756,7 @@ void SessionDbusRegister::connectSignal()
|
||||
::resetFlag = false;
|
||||
}
|
||||
|
||||
- Config::gsetting->set("switch",QVariant(powered));
|
||||
+ Config::gsetting->set("switch",QVariant(powered));
|
||||
|
||||
emit defaultAdapterPowerChanged(powered);
|
||||
});
|
||||
diff --git a/ukcc-bluetooth/bluetoothmain.cpp b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
index e243a86..0615cd3 100644
|
||||
--- a/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ b/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -2142,7 +2142,7 @@ void BlueToothMain::mDevFrameAddLineFrame(QString str,QString addr)
|
||||
|
||||
if ("paired" == str) {
|
||||
|
||||
- if (frame_middle->findChildren<DeviceInfoItem *>().size() < 1) {
|
||||
+ if (frame_middle->findChildren<DeviceInfoItem *>().size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
Index: upstream/ukui-bluetooth/component/qdevitem.cpp
|
||||
===================================================================
|
||||
--- upstream.orig/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ upstream/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -289,21 +289,21 @@ void QDevItem::DrawBattery(QPainter &pai
|
||||
return;
|
||||
|
||||
painter.save();
|
||||
-
|
||||
+ battery = 100;
|
||||
QString batteryIcon = QString("battery-level-") + QString::number(battery / 10 * 10) + QString("-symbolic");
|
||||
QString batteryString = _Battery + QString("%");
|
||||
QPixmap batteryPixmap;
|
||||
|
||||
if(StyleSettings->get("style-name").toString() == "ukui-light") {
|
||||
painter.setPen(QColor(Qt::black));
|
||||
- batteryPixmap = QIcon::fromTheme(batteryIcon).pixmap(20,20);
|
||||
+ batteryPixmap = loadSvg(QIcon::fromTheme(batteryIcon).pixmap(20,20), PixmapColor::BLACK);
|
||||
} else {
|
||||
painter.setPen(QColor(Qt::white));
|
||||
batteryPixmap = loadSvg(QIcon::fromTheme(batteryIcon).pixmap(20,20), PixmapColor::WHITE);
|
||||
}
|
||||
|
||||
- painter.drawText(348,12,40,28,Qt::AlignLeft, batteryString);
|
||||
- style()->drawItemPixmap(&painter, QRect(324, 14, 20, 20), Qt::AlignCenter, batteryPixmap);
|
||||
+ painter.drawText(344,12,52,28,Qt::AlignLeft, batteryString);
|
||||
+ style()->drawItemPixmap(&painter, QRect(320, 14, 20, 20), Qt::AlignCenter, batteryPixmap);
|
||||
painter.restore();
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
diff --git a/data/org.ukui.bluetooth.gschema.xml b/data/org.ukui.bluetooth.gschema.xml
|
||||
index 0ee300c..20da8c3 100644
|
||||
--- a/data/org.ukui.bluetooth.gschema.xml
|
||||
+++ b/data/org.ukui.bluetooth.gschema.xml
|
||||
@@ -1,7 +1,7 @@
|
||||
<schemalist gettext-domain="ukui-bluetooth">
|
||||
<schema id="org.ukui.bluetooth" path="/org/ukui/bluetooth/">
|
||||
<key type="b" name="switch">
|
||||
- <default>false</default>
|
||||
+ <default>true</default>
|
||||
<summary>bluetooth switch</summary>
|
||||
<description>bluetooth switch</description>
|
||||
</key>
|
||||
diff --git a/qtsingleapplication/qtsingleapplication.pri b/qtsingleapplication/qtsingleapplication.pri
|
||||
index 6f2bced..1d85285 100644
|
||||
--- a/qtsingleapplication/qtsingleapplication.pri
|
||||
+++ b/qtsingleapplication/qtsingleapplication.pri
|
||||
@@ -1,4 +1,3 @@
|
||||
-include(../common.pri)
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
QT *= network
|
||||
diff --git a/service/sessiondbusregister.cpp b/service/sessiondbusregister.cpp
|
||||
index 3debe7c..01aebcc 100644
|
||||
--- a/service/sessiondbusregister.cpp
|
||||
+++ b/service/sessiondbusregister.cpp
|
||||
@@ -41,8 +41,16 @@ bool SessionDbusRegister::InterfaceAlreadyExists()
|
||||
void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << __LINE__;
|
||||
+
|
||||
+ static bool isScan = false;
|
||||
+
|
||||
if (dev)
|
||||
{
|
||||
+ if (Daemon::_DefualtAdapter.data()->isDiscovering()) {
|
||||
+ isScan = true;
|
||||
+ Daemon::_DefualtAdapter.data()->stopDiscovery();
|
||||
+ }
|
||||
+
|
||||
if (dev.data()->type() == BluezQt::Device::AudioVideo ||
|
||||
dev.data()->type() == BluezQt::Device::Headphones ||
|
||||
dev.data()->type() == BluezQt::Device::Headset ) {
|
||||
@@ -65,6 +73,10 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
+
|
||||
+ if (isScan) {
|
||||
+ Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
+ }
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -76,22 +88,31 @@ void SessionDbusRegister::AudioDevConnectFunc(BluezQt::DevicePtr dev)
|
||||
}
|
||||
//当没有任何音频设备连接,最后再连接目标设备
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
- connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ connect(call,&BluezQt::PendingCall::finished,this,[&](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
+
|
||||
+ if (isScan) {
|
||||
+ Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
+ }
|
||||
});
|
||||
} else {
|
||||
|
||||
qDebug () << Q_FUNC_INFO << dev.data()->type() << __LINE__;
|
||||
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
- connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ connect(call,&BluezQt::PendingCall::finished,this,[&](BluezQt::PendingCall *callReturn){
|
||||
qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
+
|
||||
+ if (isScan) {
|
||||
+ Daemon::_DefualtAdapter.data()->startDiscovery();
|
||||
+ }
|
||||
+
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -378,7 +399,7 @@ qint64 SessionDbusRegister::getDevBattery(const QString addr)
|
||||
#endif
|
||||
|
||||
QString SessionDbusRegister::getDevName(const QString addr)
|
||||
-{
|
||||
+{
|
||||
if (addr.isEmpty() || addr.isNull() || Daemon::_DefualtAdapter.isNull())
|
||||
return "";
|
||||
|
|
@ -0,0 +1,607 @@
|
|||
diff --git a/ukui-bluetooth/component/qdevitem.cpp b/ukui-bluetooth/component/qdevitem.cpp
|
||||
index 89d9655..87985ba 100644
|
||||
--- a/ukui-bluetooth/component/qdevitem.cpp
|
||||
+++ b/ukui-bluetooth/component/qdevitem.cpp
|
||||
@@ -209,7 +209,7 @@ QPixmap QDevItem::getDevTypeIcon()
|
||||
} else {
|
||||
switch (_Type) {
|
||||
case BluezQt::Device::Phone:
|
||||
- icon = QIcon::fromTheme("phone");
|
||||
+ icon = QIcon::fromTheme("phone-symbolic");
|
||||
break;
|
||||
case BluezQt::Device::Computer:
|
||||
icon = QIcon::fromTheme("computer-symbolic");
|
||||
@@ -230,7 +230,7 @@ QPixmap QDevItem::getDevTypeIcon()
|
||||
icon = QIcon::fromTheme("input-mouse-symbolic");
|
||||
break;
|
||||
default:
|
||||
- icon = QIcon::fromTheme("bluetooth-active-symbolic");
|
||||
+ icon = QIcon::fromTheme("bluetooth-symbolic");
|
||||
break;
|
||||
}
|
||||
}
|
||||
diff --git a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
index d229165..998611e 100644
|
||||
--- a/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -72,7 +72,10 @@ FileReceivingPopupWidget::FileReceivingPopupWidget(QString devname, QString file
|
||||
}
|
||||
}else
|
||||
fileicon = QIcon::fromTheme("text");
|
||||
- file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
+ if (isIntel)
|
||||
+ file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive..."),this);
|
||||
+ else
|
||||
+ file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
QFont ft;
|
||||
ft.setPixelSize(14);
|
||||
@@ -197,20 +200,20 @@ void FileReceivingPopupWidget::initLayout() {
|
||||
|
||||
void FileReceivingPopupWidget::initIntelLayout() {
|
||||
this->setWindowFlags(Qt::Dialog);
|
||||
- this->setFixedSize(520,256);
|
||||
+ this->setFixedSize(478,280);
|
||||
QFont ft;
|
||||
ft.setPixelSize(16);
|
||||
file_size->setFont(ft);
|
||||
file_name->setFont(ft);
|
||||
|
||||
- accept_btn->setGeometry(390,185,112,56);
|
||||
- cancel_btn->setGeometry(262,185,112,56);
|
||||
- file_name->setGeometry(112,91,293,23);
|
||||
- file_size->setGeometry(112,116,293,23);
|
||||
- view_btn->setGeometry(390,195,120,36);
|
||||
- file_source->setGeometry(32,32,460,54);
|
||||
- file_icon->setGeometry(32,84,64,64);
|
||||
- transfer_progress->setGeometry(32,164,454,8);
|
||||
+ accept_btn->setGeometry(342,200,112,56);
|
||||
+ cancel_btn->setGeometry(214,200,112,56);
|
||||
+ file_name->setGeometry(104,71,293,23);
|
||||
+ file_size->setGeometry(104,103,293,23);
|
||||
+ view_btn->setGeometry(342,200,120,36);
|
||||
+ file_source->setGeometry(24,24,460,54);
|
||||
+ file_icon->setGeometry(24,67,64,64);
|
||||
+ transfer_progress->setGeometry(24,155,430,8);
|
||||
warn_icon->setGeometry(32,34,22,22);
|
||||
}
|
||||
|
||||
@@ -329,7 +332,7 @@ void FileReceivingPopupWidget::OnClickedAcceptBtn()
|
||||
QPropertyAnimation *cancel_btn_action = new QPropertyAnimation(cancel_btn,"pos");
|
||||
cancel_btn_action->setStartValue(cancel_btn->geometry().topLeft());
|
||||
if (isIntel)
|
||||
- cancel_btn_action->setEndValue(QPoint(374,205));
|
||||
+ cancel_btn_action->setEndValue(QPoint(342,200));
|
||||
else
|
||||
cancel_btn_action->setEndValue(QPoint(390,215));
|
||||
cancel_btn_action->setDuration(100);
|
||||
@@ -429,17 +432,15 @@ void FileReceivingPopupWidget::file_transfer_completed(QString status)
|
||||
if (isIntel) {
|
||||
warn_icon->setFixedSize(64,64);
|
||||
warn_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
- warn_icon->setGeometry(220,66,64,64);
|
||||
file_source->setText(tr("File Transmission Failed !"));
|
||||
- file_source->setFixedWidth(505);
|
||||
file_source->setStyleSheet("QLabel{\
|
||||
font-family: NotoSansCJKsc;\
|
||||
font-size: 16px;\
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #FB5050;}");
|
||||
- file_source->setGeometry(12,130,505,24);
|
||||
- file_source->setAlignment(Qt::AlignCenter);
|
||||
+ warn_icon->setGeometry(207,57,64,64);
|
||||
+ file_source->setGeometry(191,129,200,24);
|
||||
}
|
||||
this->activateWindow();
|
||||
}
|
||||
diff --git a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
index 68ccfc0..c34e513 100644
|
||||
--- a/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ b/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -122,7 +122,6 @@ BluetoothFileTransferWidget::BluetoothFileTransferWidget(QStringList files, QMap
|
||||
opacity: 1;}");
|
||||
|
||||
dev_widget = new DeviceSeleterWidget(devicelist, this,dev_address);
|
||||
- dev_widget->resize(456,356);
|
||||
|
||||
ok_btn = new QPushButton(tr("OK"),this);
|
||||
ok_btn->setFixedSize(100,36);
|
||||
@@ -202,6 +201,7 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
emit close_the_pre_session();
|
||||
this->close();
|
||||
});
|
||||
+ dev_widget->resize(456,356);
|
||||
title_icon->setGeometry(8,8,22,22);
|
||||
title_text->setGeometry(36,8,200,20);
|
||||
close_btn->setGeometry(484,4,30,30);
|
||||
@@ -224,7 +224,7 @@ void BluetoothFileTransferWidget::initLayout() {
|
||||
|
||||
void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
this->setWindowFlags(Qt::Dialog);
|
||||
- this->setFixedSize(520,600);
|
||||
+ this->setFixedSize(478,530);
|
||||
cancel_btn->setFixedSize(112,56);
|
||||
ok_btn->setFixedSize(112,56);
|
||||
target_name->setFixedHeight(23);
|
||||
@@ -245,21 +245,22 @@ void BluetoothFileTransferWidget::initIntelLayout() {
|
||||
line-height: 24px;\
|
||||
color: #818181;\
|
||||
opacity: 1;}");
|
||||
- ok_btn->setGeometry(376,525,112,56);
|
||||
- cancel_btn->setGeometry(240,525,112,56);
|
||||
+ dev_widget->resize(430,296);
|
||||
+ ok_btn->setGeometry(342,450,112,56);
|
||||
+ cancel_btn->setGeometry(214,450,112,56);
|
||||
tranfer_status_text->setGeometry(62,33,376,27);
|
||||
tranfer_status_icon->setGeometry(32,35,22,22);
|
||||
- dev_widget->setGeometry(32,155,456,356);
|
||||
- Tiptop->setGeometry(32,124,100,20);
|
||||
- target_size->setGeometry(112,68,70,30);
|
||||
+ dev_widget->setGeometry(24,139,430,296);
|
||||
+ Tiptop->setGeometry(32,111,100,20);
|
||||
+ target_size->setGeometry(104,60,70,30);
|
||||
tip_text->setGeometry(32,32,452,28);
|
||||
- target_icon->setGeometry(32,36,64,64);
|
||||
- target_name->setGeometry(112,43,400,20);
|
||||
- transNum->setGeometry(459,148,52,20);
|
||||
+ target_icon->setGeometry(24,24,64,64);
|
||||
+ target_name->setGeometry(104,28,400,20);
|
||||
+ transNum->setGeometry(410,148,52,20);
|
||||
if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,155,406,8);
|
||||
+ m_progressbar->setGeometry(24,155,372,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,155,454,8);
|
||||
+ m_progressbar->setGeometry(24,155,420,8);
|
||||
}
|
||||
|
||||
void BluetoothFileTransferWidget::initFileInfo() {
|
||||
@@ -343,10 +344,10 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
dev_widget->setVisible(false);
|
||||
tip_text->setVisible(true);
|
||||
if (is_Intel) {
|
||||
- cancel_btn->setGeometry(376, 185, 112, 56);
|
||||
- target_icon->setGeometry(32,75,64,64);
|
||||
- target_name->setGeometry(112,62,400,20);
|
||||
- target_size->setGeometry(112,107,68,30);
|
||||
+ cancel_btn->setGeometry(342, 200, 112, 56);
|
||||
+ target_icon->setGeometry(24,67,64,64);
|
||||
+ target_name->setGeometry(104,71,400,20);
|
||||
+ target_size->setGeometry(104,103,68,30);
|
||||
} else {
|
||||
cancel_btn->setGeometry(376, 213, 100, 36);
|
||||
target_icon->setGeometry(32,95,64,64);
|
||||
@@ -366,7 +367,10 @@ void BluetoothFileTransferWidget::Initialize_and_start_animation()
|
||||
main_animation_group->addAnimation(progress_action);
|
||||
main_animation_group->start();
|
||||
connect(main_animation_group,&QParallelAnimationGroup::finished,this,[=]{
|
||||
- this->setFixedSize(520,276);
|
||||
+ if (is_Intel)
|
||||
+ this->setFixedSize(478,280);
|
||||
+ else
|
||||
+ this->setFixedSize(520,276);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -439,9 +443,9 @@ void BluetoothFileTransferWidget::insertNewFileList(QStringList fileList) {
|
||||
transNum->setText(QString::number(transfing)+"/"+QString::number(fileNums));
|
||||
if (is_Intel)
|
||||
if (fileNums > 1)
|
||||
- m_progressbar->setGeometry(32,155,406,8);
|
||||
+ m_progressbar->setGeometry(24,155,372,8);
|
||||
else
|
||||
- m_progressbar->setGeometry(32,155,454,8);
|
||||
+ m_progressbar->setGeometry(24,155,420,8);
|
||||
else
|
||||
if (fileNums > 1)
|
||||
m_progressbar->setGeometry(32,175,406,8);
|
||||
@@ -513,10 +517,9 @@ void BluetoothFileTransferWidget::get_transfer_status(QString status)
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #0FCE75;}");
|
||||
- tranfer_status_text->setAlignment(Qt::AlignCenter);
|
||||
if (is_Intel) {
|
||||
- tranfer_status_icon->setGeometry(220,66,64,64);
|
||||
- tranfer_status_text->setGeometry(12,130,500,24);
|
||||
+ tranfer_status_icon->setGeometry(207,57,64,64);
|
||||
+ tranfer_status_text->setGeometry(191,129,200,24);
|
||||
} else {
|
||||
tranfer_status_icon->setGeometry(220,86,64,64);
|
||||
tranfer_status_text->setGeometry(12,150,500,24);
|
||||
@@ -557,7 +560,6 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
if (is_Intel){
|
||||
tranfer_status_icon->setFixedSize(64,64);
|
||||
tranfer_status_icon->setPixmap(QPixmap("/usr/share/ukui-bluetooth/file-transfer-failed.svg"));
|
||||
- tranfer_status_icon->setGeometry(220,66,64,64);
|
||||
tranfer_status_text->setFixedWidth(500);
|
||||
tranfer_status_text->setStyleSheet("QLabel{\
|
||||
font-family: NotoSansCJKsc;\
|
||||
@@ -565,8 +567,8 @@ void BluetoothFileTransferWidget::tranfer_error()
|
||||
line-height: 19px;\
|
||||
text-align: center;\
|
||||
color: #FB5050;}");
|
||||
- tranfer_status_text->setGeometry(12,130,500,24);
|
||||
- tranfer_status_text->setAlignment(Qt::AlignCenter);
|
||||
+ tranfer_status_icon->setGeometry(207,57,64,64);
|
||||
+ tranfer_status_text->setGeometry(191,129,200,24);
|
||||
}
|
||||
|
||||
tranfer_status_icon->setVisible(true);
|
||||
diff --git a/ukui-bluetooth/pin/pincodewidget.cpp b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
index 2b2b899..b1e0951 100644
|
||||
--- a/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
+++ b/ukui-bluetooth/pin/pincodewidget.cpp
|
||||
@@ -43,7 +43,10 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
Name.append("...");
|
||||
}
|
||||
if(show_flag) {
|
||||
- tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
+ if (is_Intel)
|
||||
+ tip_text = tr("If the PIN on \'")+Name+tr("\' is the same as this PIN. Please press \'Connect\'");
|
||||
+ else
|
||||
+ tip_text = tr("If \'")+Name+tr("\' the PIN on is the same as this PIN. Please press \'Connect\'.");
|
||||
} else
|
||||
tip_text = QString(tr("Please enter the following PIN code on the bluetooth device '%1' and press enter to pair:")).arg(Name);
|
||||
//top_label = new QLabel(top_text,this);
|
||||
@@ -87,7 +90,7 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
|
||||
if (is_Intel) {
|
||||
this->setWindowFlags(Qt::Dialog);
|
||||
- this->setFixedSize(510, 267);
|
||||
+ this->setFixedSize(510, 239);
|
||||
tip_label->setStyleSheet("QLabel{\
|
||||
font-size: 16px;\
|
||||
font-family: Noto Sans CJK SC;\
|
||||
@@ -100,10 +103,10 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
font-weight: 400;\
|
||||
line-height: 24px;}");
|
||||
|
||||
- tip_label->setGeometry(24,52,450,40);
|
||||
- PIN_label->setGeometry(24,116,462,47);
|
||||
- accept_btn->setGeometry(373,187,112,56);
|
||||
- refuse_btn->setGeometry(246,187,112,56);
|
||||
+ tip_label->setGeometry(24,24,450,40);
|
||||
+ PIN_label->setGeometry(24,88,462,47);
|
||||
+ accept_btn->setGeometry(374,159,112,56);
|
||||
+ refuse_btn->setGeometry(246,159,112,56);
|
||||
} else {
|
||||
this->setFixedSize(520,212);
|
||||
title_icon = new QLabel(this);
|
||||
@@ -134,8 +137,8 @@ PinCodeWidget::PinCodeWidget(QString name, QString pin, bool flag)
|
||||
title_text->setGeometry(38, 9, 160, 20);
|
||||
PIN_label->setGeometry(25,90,207,36);
|
||||
tip_label->setGeometry(25,56,437,40);
|
||||
- accept_btn->setGeometry(362,152,116,36);
|
||||
- refuse_btn->setGeometry(238,152,116,36);
|
||||
+ accept_btn->setGeometry(400,152,116,36);
|
||||
+ refuse_btn->setGeometry(288,152,116,36);
|
||||
}
|
||||
QList<QScreen *> list = QGuiApplication::screens();
|
||||
this->move(list.at(0)->size().width()/2-this->width()/2,list.at(0)->size().height()/2-this->height()/2);
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm
|
||||
index 93a563c..8ae5966 100644
|
||||
Binary files a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm and b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.qm differ
|
||||
diff --git a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
index 7eaba2d..76f0d1d 100644
|
||||
--- a/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
+++ b/ukui-bluetooth/translations/ukui-bluetooth_zh_CN.ts
|
||||
@@ -4,61 +4,61 @@
|
||||
<context>
|
||||
<name>BluetoothFileTransferWidget</name>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="28"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="48"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="32"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="185"/>
|
||||
<source>Bluetooth file transfer</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="71"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="312"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="47"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="335"/>
|
||||
<source>Transferring to "</source>
|
||||
<translation>发送文件至 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="107"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="404"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="431"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="80"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="434"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="473"/>
|
||||
<source> and </source>
|
||||
<translation> 等 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="107"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="406"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="433"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="80"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="436"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="475"/>
|
||||
<source> files more</source>
|
||||
<translation> 个文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="146"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="113"/>
|
||||
<source>Select Device</source>
|
||||
<translation>选择设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="162"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="462"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="526"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="127"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="505"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="575"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="176"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="140"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="194"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="155"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
<translation>文件发送失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="466"/>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="478"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="508"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="526"/>
|
||||
<source>File Transmition Succeed!</source>
|
||||
<translation>文件发送成功!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="486"/>
|
||||
+ <location filename="../fileSend/bluetoothfiletransferwidget.cpp" line="534"/>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
@@ -66,7 +66,7 @@
|
||||
<context>
|
||||
<name>BluetoothSettingLabel</name>
|
||||
<message>
|
||||
- <location filename="../component/bluetoothsettinglabel.cpp" line="111"/>
|
||||
+ <location filename="../component/bluetoothsettinglabel.cpp" line="101"/>
|
||||
<source>Bluetooth Settings</source>
|
||||
<translation>蓝牙设置</translation>
|
||||
</message>
|
||||
@@ -97,72 +97,78 @@
|
||||
<context>
|
||||
<name>FileReceivingPopupWidget</name>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="24"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="27"/>
|
||||
<source>Bluetooth file transfer</source>
|
||||
<translation>蓝牙文件传输</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="64"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="177"/>
|
||||
<source>Bluetooth File</source>
|
||||
<translation>蓝牙文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="101"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="240"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="362"/>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="395"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="78"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="391"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="428"/>
|
||||
<source>File from "</source>
|
||||
<translation>文件来自 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="101"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="76"/>
|
||||
+ <source>", waiting for receive...</source>
|
||||
+ <translation>",等待接收...</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="78"/>
|
||||
<source>", waiting for receive.</source>
|
||||
<translation>",等待接收。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="148"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="123"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="155"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="129"/>
|
||||
<source>Accept</source>
|
||||
<translation>接收</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="168"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="140"/>
|
||||
<source>View</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="240"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
<source>", is receiving... (has recieved </source>
|
||||
<translation>",正在接收… (已接收 </translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="240"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="267"/>
|
||||
<source> files)</source>
|
||||
<translation> 个文件)</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="362"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="391"/>
|
||||
<source>", is receiving...</source>
|
||||
<translation>",正在接收…</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="378"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="409"/>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="395"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="428"/>
|
||||
<source>", received failed !</source>
|
||||
<translation>",接收失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="403"/>
|
||||
+ <location filename="../fileReceive/filereceivingpopupwidget.cpp" line="436"/>
|
||||
<source>File Transmission Failed !</source>
|
||||
- <translation>文件发送失败!</translation>
|
||||
+ <translation>文件传输失败!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -176,12 +182,12 @@
|
||||
<context>
|
||||
<name>MainProgram</name>
|
||||
<message>
|
||||
- <location filename="../main/mainprogram.cpp" line="171"/>
|
||||
+ <location filename="../main/mainprogram.cpp" line="176"/>
|
||||
<source>Warning</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../main/mainprogram.cpp" line="171"/>
|
||||
+ <location filename="../main/mainprogram.cpp" line="176"/>
|
||||
<source>The selected file is empty, please select the file again !</source>
|
||||
<translation>所选文件为空,请重新选择!</translation>
|
||||
</message>
|
||||
@@ -189,80 +195,58 @@
|
||||
<context>
|
||||
<name>PinCodeWidget</name>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="30"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="32"/>
|
||||
<source>Bluetooth pairing</source>
|
||||
<translation>蓝牙设备配对</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <source>Bluetooth Connect Request From '</source>
|
||||
- <translation type="vanished">蓝牙连接请求来自 "</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <source>'.</source>
|
||||
- <translation type="vanished">"。</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <source>If you want to pair with this device, please make sure the numbers below are the same with the devices.</source>
|
||||
- <translation type="vanished">若要连接此设备,请确认下面的数字与该设备上的一致。</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <source>Please make sure the PIN code displayed on '</source>
|
||||
- <translation type="vanished">如果 "</translation>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="47"/>
|
||||
+ <source>' is the same as this PIN. Please press 'Connect'</source>
|
||||
+ <translation>”上的数字与下面相同,请点击“连接”</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <source>' matches the number below. Please press 'Connect'.</source>
|
||||
- <translation type="vanished">" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair !</source>
|
||||
- <translation type="vanished">请在蓝牙设备 "%1" 上输入相同PIN,并按"Enter"确认:</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="61"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="49"/>
|
||||
<location filename="../pin/pincodewidget.cpp" line="197"/>
|
||||
<source>If '</source>
|
||||
<translation>如果 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="42"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="116"/>
|
||||
<source>Bluetooth Connections</source>
|
||||
<translation>蓝牙连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="61"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="49"/>
|
||||
<location filename="../pin/pincodewidget.cpp" line="197"/>
|
||||
<source>' the PIN on is the same as this PIN. Please press 'Connect'.</source>
|
||||
<translation>" 上的PIN码与此PIN码相同,请按 "连接"。</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="63"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="47"/>
|
||||
+ <source>If the PIN on '</source>
|
||||
+ <translation>如“</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="51"/>
|
||||
<location filename="../pin/pincodewidget.cpp" line="199"/>
|
||||
<source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair:</source>
|
||||
<translation>请在蓝牙设备 "%1" 上输入相同PIN,并按"Enter"确认:</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="99"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="85"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <source>Please enter the following PIN code on the bluetooth device '%1' and press enter to pair</source>
|
||||
- <translation type="vanished">请在蓝牙设备 "%1" 上输入相同PIN,并按"Enter"确认:</translation>
|
||||
- </message>
|
||||
- <message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="88"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="76"/>
|
||||
<source>Connect</source>
|
||||
<translation>连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../pin/pincodewidget.cpp" line="90"/>
|
||||
+ <location filename="../pin/pincodewidget.cpp" line="78"/>
|
||||
<source>Refush</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
- <message>
|
||||
- <source>confirm</source>
|
||||
- <translation type="vanished">确定</translation>
|
||||
- </message>
|
||||
<message>
|
||||
<location filename="../pin/pincodewidget.cpp" line="157"/>
|
||||
<location filename="../pin/pincodewidget.cpp" line="172"/>
|
||||
@@ -313,17 +297,17 @@
|
||||
<context>
|
||||
<name>TrayWidget</name>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="74"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="78"/>
|
||||
<source>bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="252"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="258"/>
|
||||
<source>Bluetooth</source>
|
||||
<translation>蓝牙</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../mainwidget/traywidget.cpp" line="303"/>
|
||||
+ <location filename="../mainwidget/traywidget.cpp" line="309"/>
|
||||
<source>My Device</source>
|
||||
<translation>我的设备</translation>
|
||||
</message>
|
|
@ -0,0 +1,309 @@
|
|||
Index: ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/daemon/bluetoothdbus.cpp
|
||||
@@ -86,7 +86,13 @@ void BluetoothDbus::devConnectStatusSign
|
||||
}
|
||||
|
||||
void BluetoothDbus::devNameChangedSignalSLot(QString address, QString name) {
|
||||
- qDebug() << "devNameChangedSignalSLot" << address << name ;
|
||||
+ qDebug() << "devNameChangedSignalSLot" << address << name;
|
||||
+
|
||||
+ if (connectedDevice.values().contains(address)
|
||||
+ && pairedDevice.keys().contains(address)) {
|
||||
+ connectedDevice.remove(pairedDevice.value(address).at(0));
|
||||
+ }
|
||||
+ getDevConnectStatus(address);
|
||||
QStringList updateList;
|
||||
updateList.append(name);
|
||||
updateList.append(pairedDevice.value(address).at(1));
|
||||
@@ -153,6 +159,7 @@ void BluetoothDbus::addNewPairedDevice(Q
|
||||
device.append(_response3.arguments().takeFirst().toString());
|
||||
}
|
||||
pairedDevice.insert(address, device);
|
||||
+ getDevConnectStatus(address);
|
||||
}
|
||||
|
||||
void BluetoothDbus::sendFiles(QString address, QString filename) {
|
||||
@@ -281,17 +288,18 @@ void BluetoothDbus::getDevConnectStatus(
|
||||
if (response.type() == QDBusMessage::ReplyMessage)
|
||||
{
|
||||
bool connected = response.arguments().takeFirst().toBool();
|
||||
- if (connected
|
||||
- && !connectedDevice.values().contains(address)
|
||||
- && pairedDevice.keys().contains(address))
|
||||
+ if (connected && pairedDevice.keys().contains(address)) {
|
||||
+ if (connectedDevice.values().contains(address))
|
||||
+ connectedDevice.remove(connectedDevice.key(address));
|
||||
connectedDevice.insert(pairedDevice.value(address).at(0), address);
|
||||
+ }
|
||||
if (!connected
|
||||
&& connectedDevice.values().contains(address)
|
||||
&& pairedDevice.keys().contains(address))
|
||||
connectedDevice.remove(pairedDevice.value(address).at(0));
|
||||
- qDebug() << "init powered over : " << powered;
|
||||
+ qDebug() << "init connect status : " << connected << address;
|
||||
} else {
|
||||
- qDebug() << " powered method called failed!";
|
||||
+ qDebug() << " init connect status method called failed!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,5 +380,6 @@ QMap<QString, QStringList> BluetoothDbus
|
||||
}
|
||||
|
||||
bool BluetoothDbus::isConnected(QString name) {
|
||||
+ qDebug() << connectedDevice;
|
||||
return connectedDevice.keys().contains(name);
|
||||
}
|
||||
Index: ukui-bluetooth/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/fileReceive/filereceivingpopupwidget.cpp
|
||||
@@ -73,7 +73,7 @@ FileReceivingPopupWidget::FileReceivingP
|
||||
});
|
||||
|
||||
file_source = new QLabel(tr("File from \"")+target_name+tr("\", waiting for receive."),this);
|
||||
- file_source->setGeometry(32,52,500,54);
|
||||
+ file_source->setGeometry(32,52,460,54);
|
||||
file_source->setAlignment(Qt::AlignTop);
|
||||
QFont ft1;
|
||||
ft1.setPixelSize(18);
|
||||
Index: ukui-bluetooth/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
+++ ukui-bluetooth/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.cpp
|
||||
@@ -37,6 +37,9 @@ BluetoothFileTransferWidget::BluetoothFi
|
||||
this->setPalette(palette);
|
||||
this->setAutoFillBackground(true);
|
||||
|
||||
+ QDesktopWidget *deskdop = QApplication::desktop();
|
||||
+ move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2);
|
||||
+
|
||||
title_icon = new QLabel(this);
|
||||
title_icon->setPixmap(QIcon::fromTheme("preferences-system-bluetooth").pixmap(22,22));
|
||||
title_icon->resize(22,22);
|
||||
Index: ukui-bluetooth/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
+++ ukui-bluetooth/ukui-bluetooth/fileSend/bluetoothfiletransferwidget.h
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <KF5/BluezQt/bluezqt/device.h>
|
||||
#include "deviceseleterwidget.h"
|
||||
|
||||
+#include <QDesktopWidget>
|
||||
+#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
Index: ukui-bluetooth/service/sessiondbusregister.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/service/sessiondbusregister.cpp
|
||||
+++ ukui-bluetooth/service/sessiondbusregister.cpp
|
||||
@@ -76,6 +76,7 @@ void SessionDbusRegister::AudioDevConnec
|
||||
if (!call->error()) {
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
@@ -91,6 +92,7 @@ void SessionDbusRegister::AudioDevConnec
|
||||
//当没有任何音频设备连接,最后再连接目标设备
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
@@ -101,6 +103,7 @@ void SessionDbusRegister::AudioDevConnec
|
||||
|
||||
BluezQt::PendingCall *call = dev.data()->connectToDevice();
|
||||
connect(call,&BluezQt::PendingCall::finished,this,[=](BluezQt::PendingCall *callReturn){
|
||||
+ qDebug () << Q_FUNC_INFO << callReturn->error() << " " << callReturn->errorText() << __LINE__;
|
||||
if (callReturn->error()) {
|
||||
emit devOperateErrorSignal(dev.data()->address());
|
||||
}
|
||||
@@ -565,8 +568,8 @@ void SessionDbusRegister::connectSignal(
|
||||
});
|
||||
|
||||
connect(devPtr.data(),&BluezQt::Device::rssiChanged,this,[=](bool v){
|
||||
- qDebug() << Q_FUNC_INFO << "rssiChanged" << devPtr.data()->address() << " val = " <<
|
||||
- devPtr->rssi() << ";line = "<< __LINE__ ;
|
||||
+ //qDebug() << Q_FUNC_INFO << "rssiChanged" << devPtr.data()->address() << " val = " <<
|
||||
+ ;// devPtr->rssi() << ";line = "<< __LINE__ ;
|
||||
});
|
||||
|
||||
connect(devPtr.data(),&BluezQt::Device::typeChanged,this,[=](BluezQt::Device::Type type){
|
||||
@@ -604,8 +607,8 @@ void SessionDbusRegister::connectSignal(
|
||||
});
|
||||
|
||||
connect(dev.data(),&BluezQt::Device::rssiChanged,this,[=](bool v){
|
||||
- qDebug() << Q_FUNC_INFO << "rssiChanged" << dev.data()->address() << " val = " <<
|
||||
- dev->rssi() << ";line = "<< __LINE__ ;
|
||||
+ //qDebug() << Q_FUNC_INFO << "rssiChanged" << dev.data()->address() << " val = " <<
|
||||
+ ;// dev->rssi() << ";line = "<< __LINE__ ;
|
||||
});
|
||||
|
||||
connect(dev.data(),&BluezQt::Device::typeChanged,this,[=](BluezQt::Device::Type type){
|
||||
Index: ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
===================================================================
|
||||
--- ukui-bluetooth.orig/ukcc-bluetooth/bluetoothmain.cpp
|
||||
+++ ukui-bluetooth/ukcc-bluetooth/bluetoothmain.cpp
|
||||
@@ -389,6 +389,8 @@ bluetoothadapter * BlueToothMain::create
|
||||
qDebug () << Q_FUNC_INFO << adapter_address << __LINE__;
|
||||
bluetoothadapter * adapter_dev = nullptr ;
|
||||
|
||||
+ //将等待值修改为300ms
|
||||
+ //建议基于事件定时获取,防止出现异常
|
||||
QString adapter_dev_name = getAdapterName(adapter_address);
|
||||
qDebug() << Q_FUNC_INFO << adapter_dev_name << __LINE__;
|
||||
if (adapter_dev_name.isEmpty())
|
||||
@@ -530,6 +532,11 @@ void BlueToothMain::reportAdapterRemoveS
|
||||
void BlueToothMain::reportDefaultAdapterPowerChanged(bool isPower)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << isPower << __LINE__;
|
||||
+ if ("normalWidget" != this->centralWidget()->objectName())
|
||||
+ {
|
||||
+ qDebug () << Q_FUNC_INFO << "is not normalWidget" << __LINE__;
|
||||
+ return;
|
||||
+ }
|
||||
m_current_adapter_power_swtich = isPower;
|
||||
if(m_settings)
|
||||
m_settings->set("switch",QVariant::fromValue(isPower));
|
||||
@@ -691,7 +698,10 @@ bluetoothdevice * BlueToothMain::createO
|
||||
void BlueToothMain::reportDeviceScanResult(QString devAddress,QString devName)
|
||||
{
|
||||
qDebug () << Q_FUNC_INFO << devName << devAddress << __LINE__;
|
||||
-
|
||||
+ if (delayStartDiscover_timer && delayStartDiscover_timer->isActive())
|
||||
+ {
|
||||
+ delayStartDiscover_timer->stop();
|
||||
+ }
|
||||
//设备列表已经存在该设备,添加到界面中去
|
||||
for (bluetoothdevice * tmpDev : m_default_bluetooth_adapter->m_bluetooth_device_list)
|
||||
{
|
||||
@@ -715,8 +725,16 @@ void BlueToothMain::reportDeviceScanResu
|
||||
qDebug() << "effective device";
|
||||
device->setObjectName(devAddress);
|
||||
m_default_bluetooth_adapter->m_bluetooth_device_list.append(device);
|
||||
- if(whetherToAddCurrentInterface(device))
|
||||
- addOneBluetoothDeviceItemUi(device);
|
||||
+ if(device->isPaired())
|
||||
+ {
|
||||
+ this->addMyDeviceItemUI(device);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if(this->whetherToAddCurrentInterface(device))
|
||||
+ this->addOneBluetoothDeviceItemUi(device);
|
||||
+ }
|
||||
+
|
||||
|
||||
}
|
||||
|
||||
@@ -931,7 +949,7 @@ bool BlueToothMain::getBluetoothBlock()
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getBluetoothBlock");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -946,7 +964,7 @@ QString BlueToothMain::getDefaultAdapter
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<QString> reply=iface.call("getDefaultAdapterAddress");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -961,7 +979,7 @@ QStringList BlueToothMain::getAdapterDev
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<QStringList> reply=iface.call("getAdapterDevAddressList");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -989,8 +1007,8 @@ QString BlueToothMain::getAdapterName(QS
|
||||
PATH,
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
- //设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ //设置超时时间, 从20ms增加300ms,减少出现异常的几率
|
||||
+ iface.setTimeout(300);
|
||||
QDBusReply<QString> reply=iface.call("getAdapterNameByAddr", adapterAddress);
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1005,7 +1023,7 @@ bool BlueToothMain::getDefaultAdapterPow
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间 ms
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getDefaultAdapterPower");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1035,7 +1053,7 @@ bool BlueToothMain::getDefaultAdapterDis
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getDefaultAdapterDiscoverable");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1048,8 +1066,8 @@ bool BlueToothMain::getDefaultAdapterSca
|
||||
PATH,
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
- //设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ //设置超时时间,从20ms延迟至100ms
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getDefaultAdapterScanStatus");
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1063,8 +1081,8 @@ QString BlueToothMain::getDevName(QStrin
|
||||
PATH,
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
- //设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ //设置超时时间,从20ms延长至300ms
|
||||
+ iface.setTimeout(300);
|
||||
QDBusReply<QString> reply=iface.call("getDevName",deviceAddress);
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1078,7 +1096,7 @@ bool BlueToothMain::getDevPairStatus(QSt
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getDevPairStatus",deviceAddress);
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1091,7 +1109,7 @@ bool BlueToothMain::getDevConnectStatus(
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<bool> reply=iface.call("getDevConnectStatus",deviceAddress);
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
return reply;
|
||||
@@ -1120,7 +1138,7 @@ QString BlueToothMain::getDevType(QStrin
|
||||
INTERFACE,
|
||||
QDBusConnection::sessionBus());
|
||||
//设置超时时间
|
||||
- iface.setTimeout(20);
|
||||
+ iface.setTimeout(100);
|
||||
QDBusReply<QString> reply=iface.call("getDevType",deviceAddress);
|
||||
//qDebug () << Q_FUNC_INFO << "==========================" << reply << __LINE__;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue