Skip to content

Commit

Permalink
Optimized for cross-platform support
Browse files Browse the repository at this point in the history
macOS deployment files and platform specific fixes
Settings are now globally stored in AppConfigLocation
  • Loading branch information
TCB13 committed Apr 27, 2019
1 parent f19f4d2 commit 71037c5
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 70 deletions.
16 changes: 15 additions & 1 deletion LoFloccus.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type AppSettings struct {
}

var (
appVersion = "1.1.2"
configFile = "LoFloccus-Settings.ini"
cfg *ini.File
windowWidget *widgets.QWidget
Expand Down Expand Up @@ -73,13 +74,17 @@ func main() {
windowWidget = loader.Load(file, nil)
windowWidget.SetFixedSize2(windowWidget.Width(), windowWidget.Height())
windowWidget.SetWindowIcon(icon)
windowWidget.SetStyleSheet("QWidget{font-size:12px}");
windowWidget.SetWindowTitle(windowWidget.WindowTitle() + " v" + appVersion)
windowWidget.ConnectDestroyQWidget(func() {
exitApp()
})
setupSystray(icon)

var (
uiLogo = widgets.NewQLabelFromPointer(windowWidget.FindChild("logo", core.Qt__FindChildrenRecursively).Pointer())
uiLogoLabel = widgets.NewQLabelFromPointer(windowWidget.FindChild("logo_label", core.Qt__FindChildrenRecursively).Pointer())
uiDescriptionLabel = widgets.NewQLabelFromPointer(windowWidget.FindChild("description_label", core.Qt__FindChildrenRecursively).Pointer())

uiSrvStatus = widgets.NewQLabelFromPointer(windowWidget.FindChild("srv_status", core.Qt__FindChildrenRecursively).Pointer())
uiXBELPath = widgets.NewQLabelFromPointer(windowWidget.FindChild("xbel_path", core.Qt__FindChildrenRecursively).Pointer())
Expand All @@ -92,13 +97,21 @@ func main() {
uiBtnServerControl = widgets.NewQPushButtonFromPointer(windowWidget.FindChild("btn_server_control", core.Qt__FindChildrenRecursively).Pointer())
uiBtnHideControl = widgets.NewQPushButtonFromPointer(windowWidget.FindChild("btn_hide_tray", core.Qt__FindChildrenRecursively).Pointer())

uiConnectLabel = widgets.NewQLabelFromPointer(windowWidget.FindChild("connect_label", core.Qt__FindChildrenRecursively).Pointer())
uiSettingsLabel = widgets.NewQLabelFromPointer(windowWidget.FindChild("settings_label", core.Qt__FindChildrenRecursively).Pointer())

uiSettingsStartMinimized = widgets.NewQCheckBoxFromPointer(windowWidget.FindChild("start_minimized", core.Qt__FindChildrenRecursively).Pointer())
uiSettingsStartServer = widgets.NewQCheckBoxFromPointer(windowWidget.FindChild("start_open", core.Qt__FindChildrenRecursively).Pointer())
)

var pixMap = gui.NewQPixmap5(":/qml/logo.png", "", core.Qt__NoFormatConversion)
uiLogo.SetPixmap(pixMap)

uiLogoLabel.SetStyleSheet("QLabel{font-size:16px;font-weight:600;}");
uiDescriptionLabel.SetStyleSheet("QLabel{font-size:14px;font-weight:600;}");
uiConnectLabel.SetStyleSheet("QLabel{font-weight:600;}");
uiSettingsLabel.SetStyleSheet("QLabel{font-weight:600;}");

uiSrvAddr.SetText("http://" + serverConfig.address + ":" + strconv.Itoa(serverConfig.port))
uiSrvUser.SetText(serverConfig.user);
uiSrvPasswd.SetText(serverConfig.passwd);
Expand Down Expand Up @@ -192,7 +205,7 @@ func setupSystray(icon *gui.QIcon) {
tray.SetToolTip("LoFloccus App")
tray.SetContextMenu(menu)
tray.ConnectActivated(func(reason widgets.QSystemTrayIcon__ActivationReason) {
if reason != widgets.QSystemTrayIcon__Context {
if reason != widgets.QSystemTrayIcon__Context && core.QSysInfo_ProductType() == "windows" {
windowWidget.Show()
}
})
Expand All @@ -205,6 +218,7 @@ func exitApp() {
}

func loadAppConfig() {
configFile = core.QStandardPaths_WritableLocation(core.QStandardPaths__AppConfigLocation) + "/" + configFile
var err error
cfg, err = ini.Load(configFile)
if err != nil {
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ Sync Floccus to a Local Folder!

**LoFloccus** is a small companion app for Floccus that empowers you to sync your bookmarks with whatever service or tool you would like to!

![LoFloccus](https://cdn.iklive.eu/tcb13/2019/lofloccus-1-1-0.png)
![LoFloccus](https://cdn.iklive.eu/tcb13/2019/lofloccus-1-1-0.png)

## Download LoFloccus

- **Windows**: https://github.com/TCB13/LoFloccus/releases/download/1.1.1/LoFloccus-1-1-1.zip
- **macOS**: Available Soon!
- **Windows**: https://github.com/TCB13/LoFloccus/releases/download/1.1.2/LoFloccus-Win.zip
- **macOS**: https://github.com/TCB13/LoFloccus/releases/download/1.1.2/LoFloccus-macOS.zip

## Why and How

Expand All @@ -29,16 +29,23 @@ Enjoy the best of Floccus and combine it with favourite sync tool!

LoFloccus was built using Golang and Qt.

#### Windows
**Develop**:
#### Develop
1. Install Qt
2. Install https://github.com/therecipe/qt
3. Add user variable `CGO_LDFLAGS`: `C:\Users\Public\env_windows_amd64_Tools\mingw730_64\x86_64-w64-mingw32\lib\libmsvcrt.a`
4. Add to user `Path` variable: `C:\Users\Public\env_windows_amd64\5.12.0\mingw73_64\bin` and `C:\Users\Public\env_windows_amd64_Tools\mingw730_64\bin`
3. (Windows only) Add user variable `CGO_LDFLAGS`: `C:\Users\Public\env_windows_amd64_Tools\mingw730_64\x86_64-w64-mingw32\lib\libmsvcrt.a`
4. (Windows only) Add to user `Path` variable: `C:\Users\Public\env_windows_amd64\5.12.0\mingw73_64\bin` and `C:\Users\Public\env_windows_amd64_Tools\mingw730_64\bin`
5. `go run LoFloccus.go`!

**Deploy**:
### Deploy for Windows
1. `cd LoFloccus`
2. `windres.exe .\Windows.rc -o Windows.syso`
3. `qtdeploy build desktop .`
4. Run `deploy/windows/LoFloccus.exe`!

### Deploy for macOS
1. `cd LoFloccus`
2. (Optionally) Install imagemagick `brew update && brew install imagemagick`
3. (Optionally) `generate-icns-from-svg.sh`
4. (Optionally) Move `icon.icns` to `darwin\Contents\Resources`
5. `qtdeploy build desktop .`
6. Run `deploy/darwin/LoFloccus.app`
10 changes: 5 additions & 5 deletions Windows.rc
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
IDI_ICON1 ICON DISCARDABLE "qml/icon.ico"

1 VERSIONINFO
FILEVERSION 1,1,1,0
PRODUCTVERSION 1,1,1,0
FILEVERSION 1,1,2,0
PRODUCTVERSION 1,1,2,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "LoFloccus"
VALUE "FileDescription", "Sync Floccus to a Local Folder!"
VALUE "FileVersion", "1.1.1"
VALUE "FileDescription", "LoFloccus"
VALUE "FileVersion", "1.1.2"
VALUE "InternalName", "LoFloccus"
VALUE "LegalCopyright", "LoFloccus"
VALUE "OriginalFilename", "LoFloccus.exe"
VALUE "ProductName", "LoFloccus"
VALUE "ProductVersion", "1.1.1"
VALUE "ProductVersion", "1.1.2"
END
END
BLOCK "VarFileInfo"
Expand Down
33 changes: 33 additions & 0 deletions darwin/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>LoFloccus</string>
<key>CFBundleGetInfoString</key>
<string>1.1.2, Copyright © 2019, TCB13.</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.tcb13.LoFloccus</string>
<key>CFBundleName</key>
<string>LoFloccus</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

Binary file added darwin/Contents/Resources/icon.icns
Binary file not shown.
18 changes: 18 additions & 0 deletions generate-icns-from-svg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

mkdir icon.iconset
convert -background none -size 16x16 -gravity center -extent 16x16 icon.svg icon.iconset/icon_16x16.png
convert -background none -size 32x32 -gravity center -extent 32x32 icon.svg icon.iconset/[email protected]
convert -background none -size 32x32 -gravity center -extent 32x32 icon.svg icon.iconset/icon_32x32.png
convert -background none -size 64x64 -gravity center -extent 64x64 icon.svg icon.iconset/[email protected]
convert -background none -size 64x64 -gravity center -extent 64x64 icon.svg icon.iconset/icon_64x64.png
convert -background none -size 128x128 -gravity center -extent 128x128 icon.svg icon.iconset/[email protected]
convert -background none -size 128x128 -gravity center -extent 128x128 icon.svg icon.iconset/icon_128x128.png
convert -background none -size 256x256 -gravity center -extent 256x256 icon.svg icon.iconset/[email protected]
convert -background none -size 256x256 -gravity center -extent 256x256 icon.svg icon.iconset/icon_256x256.png
convert -background none -size 512x512 -gravity center -extent 512x512 icon.svg icon.iconset/[email protected]
convert -background none -size 512x512 -gravity center -extent 512x512 icon.svg icon.iconset/icon_512x512.png
convert -background none -size 1024x1024 -gravity center -extent 1024x1024 icon.svg icon.iconset/[email protected]
iconutil --convert icns icon.iconset
rm -R icon.iconset

1 change: 1 addition & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 71037c5

Please sign in to comment.