Announcing YapStocks 2.0

Over the last few weeks, I’ve been working on a new plasmoid (KDE Plasma Applet) that provides a simple interface to monitor stocks. The first version was rather basic, being able to show the current market price only. Now it’s time to announce the availability of the second iteration of YapStocks (Yet Another Plasma Stocks Applet). I’ve recorded a short video clip showcasing all the features it has, ranging from the information summary to the historical price chart.

Continue reading “Announcing YapStocks 2.0”

Hands-on Sailfish OS on Redmi Note 7

Not sure if this is related to the COVID-19 lockdown, but we’ve seen a lot of geeky hobby projects coming up recently. A lot of community ports have been done over the last few months for niche mobile operating systems such as Sailfish OS. That’s exactly the one I played with briefly after purchasing a second-hand Redmi Note 7 on eBay (don’t ask me if I think it’s a waste of money now LOL).

If you come here hoping to find the resources, head to the GitHub repo directly where you can find the ROMs to download.

Make sure that you’ve unlocked the bootloader already! If not, you need to register a MI account and apply for unlocking here. You must log in to your MI account on both the unlocking tool and your phone (MI, POCO, RedMi). If you don’t have a Windows PC, I recommend using XiaoMiTool V2 which works on macOS, Linux, as well as Windows. Though I couldn’t find this on the official FAQ, you have to have a working SIM card inserted. You have to use the mobile data instead of WiFi when unlocking the bootloader on your phone because XiaoMi is doing some verification.

Another problem I encountered was that in fastboot mode, RedMi Note 7 would just say “Press any key to reboot” when any commands are sent from my laptop. After googling on this, there seems to be a driver bug that makes RedMi Note 7 fastboot USB3 unfriendly. Using a USB-Hub worked for most people, including me 🤷.

I wish you all a successful attempt to flash Sailfish OS into your RedMi Note 7. Here are some screenshots I took.

Continue reading “Hands-on Sailfish OS on Redmi Note 7”

Use npm packages in QML

I’ve been trying to code up some nice GUI for a hobby project which was done in JavaScript (Node.JS). I’ve looked at a few options that I have

  1. Use the not-yet-stable NodeGUI
  2. Go Web and use Electron
  3. Rewrite the core in Python or C++ to use Qt
  4. Use QML which has limited support for JavaScript

I’ve explored the option 1, however, I soon ran into the problems with the Model/View/Delegate architecture which means I would have to implement native plugins/add-ons in order to use ListView. Not to mention the framework itself is still heavily under development.

As for option 2, I’m not a web frontend engineer and personally I much prefer something that is native (or looks and feels native at least). For the third option, it feels a bit overkill but it is a possible way out.

Luckily I don’t have to do the re-implementation, because I’ve managed to get the core functionality bundled into a single JS file which works flawlessly in the QML environment. Before I start diving into the details on how you can make your npm packages work in QML, I have to emphasise that there are many limitations in the QML environment and it’s very likely that only a small subset of the npm package that you’re interested in is going to work.

Continue reading “Use npm packages in QML”

适用于KDE Plasma 5的雅虎天气小部件

去年简单粗暴地把自己写的Yahoo! Weather从KDE 4移植到了Plasma 5,但是一直没有好好改进一下。前段时间雅虎停止旧API支持,被迫更新,就顺便改改了。应该访客里有不少KDE的用户吧,想要一个简单的天气小部件的可以试试看。

主要卖点

  • 纯QML,不用编译直接装
  • 雅虎天气接口,大品牌值得信赖
  • 自认还算简洁明了的UI
  • 支持不同的计量单位(温度、气压、风速等)
  • 10天天气预报

Continue reading “适用于KDE Plasma 5的雅虎天气小部件”

我的第一本书《Qt 5 Blueprints》

从去年九月份开始写初稿,一直到前几天还在修改Prefinal,今天终于收到了邮件告知书已出版了!Qt作为一个负有盛名的C++开发框架,在下也不敢自称专家,拿Qt写过一些小程序,本科毕设时也用了Qt,最近活跃开发的就是Shadowsocks-Qt5了。

刚收到Packt Pub的邮件约稿时,蛮忐忑的,担心自己水平不够,英语又不是母语,再加上自己没有吓死人的Bio,也没有「几十年」的开发经验。不过当时联系我的编辑人挺好的,而且我也知道Packt Pub甚至有在联系一些本科学生写书,而且他们也是第一次写书。所以我也就答应了,毕竟出版商能加特效,书duang很好、很专业。

Continue reading “我的第一本书《Qt 5 Blueprints》”

libQtShadowsocks项目介绍和备忘

shadowsocks应该是继各种VPN和GoAgent之后,目前最受欢迎的代理协议了。VPN不灵活,而且能够被防火墙识别特征,能够轻松封锁,GoAgent则面临可用IP越来越少的困境。懒得介绍原项目了,不知道shadowsocks的自己去Google查吧。

libQtShadowsocks就像名字暗示的一样,是一个Library(库),用Qt(C++)写的,实现了shadowsocks的各项功能。

Continue reading “libQtShadowsocks项目介绍和备忘”

QCA 2.1.0在Windows上用MinGW的编译过程

QCA是Qt Cryptographic Architecture的缩写,简而言之就是安全组件(如OpenSSL)的Qt封装,方便Qt程序调用,而不用写一大串C代码。QCA自然是开源的,而且好像是KDE的一个project(反正代码是在KDE的git服务器上)。

时隔四年,QCA总算发布了新版本,虽然是小版本号的变化(2.0.3 -> 2.1.0),但却是非常重要的更新!!!首先支持使用Qt5了,其次使用CMake而不是qmake来管理了。如果不支持Qt5的话,我也不会关心QCA的…………

但是目前主流Linux发行版的官方仓库还是2.0.3版的QCA,而且这次也没有Windows builds下载,只有源码包,好在编译不太麻烦,下面就记录了本次编译的过程(环境:Windows 8.1 x64 Pro, MinGW64 4.9.1 x64, MSYS, Qt 5.3.2 x64 static, OpenSSL 1.0.1j x64 static, CMake 3.1.0)。这次要编译的就是静态链接的QCA,如果你要编译动态链接的QCA,上面的工具链必须也是动态链接的!

Continue reading “QCA 2.1.0在Windows上用MinGW的编译过程”

材料微观组织图像分析软件即我的毕设项目开源

今天毕业设计答辩结束了,心情大好,于是回宿舍写下了本文~~(脑洞大开的节奏)

我的毕设项目是开发一个材料微观组织图像的分析软件,说直白点,主要功能就是数晶粒、测晶粒度级别数的,还能测多孔材料的孔隙率,第二相百分比等。软件名称是Computer-Aid Interactive Grain Analyser,简称CAIGA,名字没想太久,随便取的。。。

Continue reading “材料微观组织图像分析软件即我的毕设项目开源”

Shadowsocks的图形化客户端Shadowsocks-Qt5介绍

2015-04-08更新:2.0版全新发布,以下部分描述已过时(本文是写于0.x版时期)

不知道Shadowsocks的Windows用户有多少呢?除了一个简陋的Shadowsocks-go客户端、一个废弃的Shadowsocks-csharp客户端和一个用node实现的Shadowsocks-gui客户端,实在找不到一个Native的图形化客户端。于是自己挖坑来填了(越挖越大……)!

下面开始“推销”我的Shadowsocks-Qt5给各位看官使(tiao)用(keng)了!

Shadowsocks-Qt5

Continue reading “Shadowsocks的图形化客户端Shadowsocks-Qt5介绍”

自定义QWidget类使Qt图像控件能自动缩放

每次给这类文章取名字都很烦,一不小心就又臭又长了!>.< ...... 下面转入正(cai)题(guai) 相信大家一开始也和我一样,用QLabel来充当图像的显示控件,不过应该很快就会发现QLabel显示出来图像后,如果再改变父级控件的大小,此时QLabel的图像不会跟着变大而是保持原来的大小。更为糟糕的是,父级控件无法缩小了,因为QLabel的图像不会自动缩小,限制了父级控件的minimumSize! 其实是一个很囧的问题,网上一搜会发现几年前就有人提出怎么没有一个专门的QImageLabel啊?可能priority太低吧……Anyway,下面介绍通过自定义类(继承QWidget)实现一个可以自动缩放图像的控件。 Continue reading “自定义QWidget类使Qt图像控件能自动缩放”