Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e13d8dffd | |||
| 20e5efa711 | |||
| 6378740051 | |||
| b8ce7a667b | |||
| 281ca18d90 | |||
| 1725de6ace | |||
| 0ad7c03db0 | |||
| 1cdd0d113b | |||
| a0fae43690 | |||
| 04ac766125 | |||
| 9ac26467c0 | |||
| cbfc038839 | |||
| 7ae6462da0 | |||
| 09a3e5b90f | |||
| 1cddd17017 | |||
| 8fdc3a0428 | |||
| 18f10fc1b4 |
37
Makefile
37
Makefile
@@ -1,14 +1,13 @@
|
|||||||
|
VERSION := 1.1.0
|
||||||
VERSION := 1.0.3
|
|
||||||
GOFLAGS_L := -ldflags='-s -w -X main.Version=v$(VERSION)' -buildvcs=false -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
GOFLAGS_L := -ldflags='-s -w -X main.Version=v$(VERSION)' -buildvcs=false -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
||||||
GOFLAGS_W := -ldflags='-s -w -X main.Version=v$(VERSION) -H windowsgui' -buildvcs=false --tags=windowsqtstatic -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
GOFLAGS_W := -ldflags='-s -w -X main.Version=v$(VERSION) -H windowsgui' -buildvcs=false --tags=windowsqtstatic -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
# Allow overriding DOCKER with e.g. sudo docker
|
GO := go
|
||||||
DOCKER := docker
|
MIQT_DOCKER := miqt-docker
|
||||||
MIQT_UIC := miqt-uic
|
MIQT_UIC := miqt-uic
|
||||||
MIQT_RCC := miqt-rcc
|
MIQT_RCC := miqt-rcc
|
||||||
GO_WINRES := go-winres
|
GO_WINRES := go-winres
|
||||||
SOURCES := $(wildcard *.go *.ui *.qrc) resources.go mainwindow_ui.go itemwindow_ui.go rsrc_windows_amd64.syso
|
SOURCES := $(wildcard *.go *.ui *.qrc) resources.go resources.rcc mainwindow_ui.go itemwindow_ui.go rsrc_windows_amd64.syso
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build/qbolt build/qbolt.exe
|
all: build/qbolt build/qbolt.exe
|
||||||
@@ -18,20 +17,25 @@ dist: build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt-${VERSION}-debian12-
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f qbolt || true
|
rm -f qbolt
|
||||||
rm -rf build || true
|
rm -rf build
|
||||||
rm -f windows-manifest.json || true
|
mkdir -p build
|
||||||
|
touch build/.create_dir
|
||||||
|
rm -f windows-manifest.json
|
||||||
|
rm -f rsrc_windows_amd64.syso
|
||||||
|
rm -f resources.go
|
||||||
|
rm -f resources.rcc
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
|
|
||||||
resources.rcc resources.go: resources.qrc
|
resources.rcc resources.go: resources.qrc
|
||||||
$(MIQT_RCC) resources.qrc
|
$(MIQT_RCC) -Qt6 -Input resources.qrc
|
||||||
|
|
||||||
mainwindow_ui.go: mainwindow.ui
|
mainwindow_ui.go: mainwindow.ui
|
||||||
$(MIQT_UIC) -InFile mainwindow.ui -OutFile mainwindow_ui.go
|
$(MIQT_UIC) -Qt6 -InFile mainwindow.ui -OutFile mainwindow_ui.go
|
||||||
|
|
||||||
itemwindow_ui.go: itemwindow.ui
|
itemwindow_ui.go: itemwindow.ui
|
||||||
$(MIQT_UIC) -InFile itemwindow.ui -OutFile itemwindow_ui.go
|
$(MIQT_UIC) -Qt6 -InFile itemwindow.ui -OutFile itemwindow_ui.go
|
||||||
|
|
||||||
windows-manifest.json: windows-manifest.template.json Makefile
|
windows-manifest.json: windows-manifest.template.json Makefile
|
||||||
cat windows-manifest.template.json | sed -re 's_%VERSION%_$(VERSION)_' > windows-manifest.json
|
cat windows-manifest.template.json | sed -re 's_%VERSION%_$(VERSION)_' > windows-manifest.json
|
||||||
@@ -43,7 +47,7 @@ rsrc_windows_amd64.syso: windows-manifest.json
|
|||||||
# Linux release
|
# Linux release
|
||||||
|
|
||||||
build/qbolt: $(SOURCES)
|
build/qbolt: $(SOURCES)
|
||||||
go build $(GOFLAGS_L) -o build/qbolt
|
CGO_CFLAGS='-Os -ffunction-sections -fdata-sections -flto=auto' CGO_CXXFLAGS='-Os -ffunction-sections -fdata-sections -flto=auto' CGO_LDFLAGS='-Wl,--gc-sections -flto=auto -fwhole-program' $(GO) build $(GOFLAGS_L) -o build/qbolt
|
||||||
upx build/qbolt
|
upx build/qbolt
|
||||||
|
|
||||||
build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt
|
build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt
|
||||||
@@ -52,9 +56,12 @@ build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt
|
|||||||
# Windows release (docker)
|
# Windows release (docker)
|
||||||
|
|
||||||
build/qbolt.exe: $(SOURCES)
|
build/qbolt.exe: $(SOURCES)
|
||||||
( $(DOCKER) image ls | fgrep qbolt-win64-cross ) || ( cd docker && $(DOCKER) build -t qbolt-win64-cross:latest -f win64-cross.Dockerfile . )
|
# -flto causes internal compiler error
|
||||||
$(DOCKER) run --rm -v $(CURDIR):/qbolt -w /qbolt qbolt-win64-cross:latest /bin/sh -c "go build $(GOFLAGS_W) -o build/qbolt.exe"
|
$(MIQT_DOCKER) win64-qt6-static /bin/bash -c "CGO_CFLAGS='-Os -ffunction-sections -fdata-sections' CGO_CXXFLAGS='-Os -ffunction-sections -fdata-sections' CGO_LDFLAGS='-Wl,--gc-sections -fwhole-program' go build $(GOFLAGS_W) -o build/qbolt.exe"
|
||||||
upx --force build/qbolt.exe
|
# Must be stripped before upx'ing - @ref https://github.com/msys2/MSYS2-packages/issues/454
|
||||||
|
# However this removes the rsrc, loses the icon and causes a Defender detection
|
||||||
|
# strip build/qbolt.exe
|
||||||
|
# upx build/qbolt.exe
|
||||||
|
|
||||||
build/qbolt-${VERSION}-windows-x86_64.zip: build/qbolt.exe
|
build/qbolt-${VERSION}-windows-x86_64.zip: build/qbolt.exe
|
||||||
zip -9 -j build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe
|
zip -9 -j build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ The Windows binary is released under LGPL-3+ owing to the static copy of Qt.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
2025-05-04 1.1.0
|
||||||
|
- New feature to import/export database as zip archive
|
||||||
|
- Upgrade to Qt 6
|
||||||
|
- Add keyboard shortcuts for refresh
|
||||||
|
- Improve High DPI support
|
||||||
|
- Rebuild artefacts with miqt v0.10.0, etcd-io/bbolt v1.4.0, go 1.23, Qt 6.8 (win64)
|
||||||
|
- [⬇ Download here](https://git.ivysaur.me/code.ivysaur.me/qbolt/releases/tag/v1.1.0)
|
||||||
|
|
||||||
2024-10-05 1.0.3
|
2024-10-05 1.0.3
|
||||||
- Port from hybrid Go/C++ to now using [MIQT](https://github.com/mappu/miqt)
|
- Port from hybrid Go/C++ to now using [MIQT](https://github.com/mappu/miqt)
|
||||||
- Switch Windows build to win64
|
- Switch Windows build to win64
|
||||||
|
|||||||
30
bolt.go
30
bolt.go
@@ -95,7 +95,7 @@ func Bolt_DeleteBucket(db *bolt.DB, browse []string, delBucket string) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Bolt_SetItem(db *bolt.DB, browse []string, key, val string) error {
|
func Bolt_SetItem(db *bolt.DB, browse []string, key, val []byte) error {
|
||||||
if len(browse) == 0 {
|
if len(browse) == 0 {
|
||||||
return errors.New("Can't create top-level items")
|
return errors.New("Can't create top-level items")
|
||||||
}
|
}
|
||||||
@@ -107,11 +107,11 @@ func Bolt_SetItem(db *bolt.DB, browse []string, key, val string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return bucket.Put([]byte(key), []byte(val))
|
return bucket.Put(key, val)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Bolt_DeleteItem(db *bolt.DB, browse []string, key string) error {
|
func Bolt_DeleteItem(db *bolt.DB, browse []string, key []byte) error {
|
||||||
if len(browse) == 0 {
|
if len(browse) == 0 {
|
||||||
return errors.New("Can't create top-level items")
|
return errors.New("Can't create top-level items")
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ func Bolt_DeleteItem(db *bolt.DB, browse []string, key string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return bucket.Delete([]byte(key))
|
return bucket.Delete(key)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,14 +155,13 @@ func Bolt_BucketStats(db *bolt.DB, browse []string) (string, error) {
|
|||||||
return string(jBytes), err
|
return string(jBytes), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func Bolt_ListBuckets(db *bolt.DB, browse []string, cb func(b string)) error {
|
func Bolt_ListBuckets(db *bolt.DB, browse []string, cb func(b string) error) error {
|
||||||
|
|
||||||
if len(browse) == 0 {
|
if len(browse) == 0 {
|
||||||
// root mode
|
// root mode
|
||||||
return db.View(func(tx *bolt.Tx) error {
|
return db.View(func(tx *bolt.Tx) error {
|
||||||
return tx.ForEach(func(k []byte, _ *bolt.Bucket) error {
|
return tx.ForEach(func(k []byte, _ *bolt.Bucket) error {
|
||||||
cb(string(k))
|
return cb(string(k))
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ func Bolt_ListBuckets(db *bolt.DB, browse []string, cb func(b string)) error {
|
|||||||
return bucket.ForEach(func(k, v []byte) error {
|
return bucket.ForEach(func(k, v []byte) error {
|
||||||
// non-nil v means it's a data item
|
// non-nil v means it's a data item
|
||||||
if v == nil {
|
if v == nil {
|
||||||
cb(string(k))
|
return cb(string(k))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@@ -181,7 +180,7 @@ func Bolt_ListBuckets(db *bolt.DB, browse []string, cb func(b string)) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListItemInfo struct {
|
type ListItemInfo struct {
|
||||||
Name string
|
Name []byte
|
||||||
DataLen int64
|
DataLen int64
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,17 +197,22 @@ func Bolt_ListItems(db *bolt.DB, browse []string, cb func(ListItemInfo) error) e
|
|||||||
return nil // nil v means it's a bucket, skip
|
return nil // nil v means it's a bucket, skip
|
||||||
}
|
}
|
||||||
|
|
||||||
return cb(ListItemInfo{string(k), int64(len(v))})
|
kcopy := make([]byte, len(k))
|
||||||
|
copy(kcopy, k)
|
||||||
|
|
||||||
|
return cb(ListItemInfo{kcopy, int64(len(v))})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Bolt_GetItem(db *bolt.DB, browse []string, key string) (string, error) {
|
func Bolt_GetItem(db *bolt.DB, browse []string, key []byte) ([]byte, error) {
|
||||||
var ret string
|
var ret []byte
|
||||||
|
|
||||||
err := withBrowse_ReadOnly(db, browse, func(tx *bolt.Tx, bucket *bolt.Bucket) error {
|
err := withBrowse_ReadOnly(db, browse, func(tx *bolt.Tx, bucket *bolt.Bucket) error {
|
||||||
d := bucket.Get([]byte(key))
|
d := bucket.Get([]byte(key))
|
||||||
ret = string(d)
|
|
||||||
|
ret = make([]byte, len(d))
|
||||||
|
copy(ret, d)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return ret, err
|
return ret, err
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
FROM golang:1.23-bookworm
|
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
|
||||||
apt-get install -qyy gnupg2 ca-certificates
|
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive \
|
|
||||||
echo "deb https://pkg.mxe.cc/repos/apt buster main" >/etc/apt/sources.list.d/mxeapt.list && \
|
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -qyy mxe-x86-64-w64-mingw32.static-qt5 && \
|
|
||||||
apt-get clean
|
|
||||||
|
|
||||||
ENV PATH=/usr/lib/mxe/usr/bin:$PATH
|
|
||||||
|
|
||||||
ENV CXX=x86_64-w64-mingw32.static-g++
|
|
||||||
ENV CC=x86_64-w64-mingw32.static-gcc
|
|
||||||
ENV PKG_CONFIG=x86_64-w64-mingw32.static-pkg-config
|
|
||||||
ENV GOOS=windows
|
|
||||||
ENV CGO_ENABLED=1
|
|
||||||
|
|
||||||
167
export.go
Normal file
167
export.go
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Bolt_ExportDatabaseToZip(dbpath, zippath string) error {
|
||||||
|
db, err := Bolt_Open(true, dbpath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error opening database: %w", err)
|
||||||
|
}
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
|
fh, err := os.OpenFile(zippath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error opening output file: %w", err)
|
||||||
|
}
|
||||||
|
defer fh.Close()
|
||||||
|
|
||||||
|
zw := zip.NewWriter(fh)
|
||||||
|
|
||||||
|
// Filenames in zip files cannot contain `/` characters. Mangle it
|
||||||
|
safename := func(n string) string {
|
||||||
|
return strings.ReplaceAll(string(n), `/`, `__`)
|
||||||
|
}
|
||||||
|
|
||||||
|
var process func(currentPath []string) error
|
||||||
|
process = func(currentPath []string) error {
|
||||||
|
return Bolt_ListBuckets(db, currentPath, func(bucket string) error {
|
||||||
|
|
||||||
|
// Create entry for our own bucket
|
||||||
|
|
||||||
|
ourBucket := zip.FileHeader{
|
||||||
|
Name: path.Join(path.Join(Apply(currentPath, safename)...), safename(bucket)) + `/`, // Trailing slash = directory
|
||||||
|
}
|
||||||
|
ourBucket.SetMode(fs.ModeDir | 0755)
|
||||||
|
_, err := zw.CreateHeader(&ourBucket)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Child pathspec
|
||||||
|
|
||||||
|
childPath := CopySliceAdd(currentPath, bucket)
|
||||||
|
|
||||||
|
// Create file entries for all non-bucket children
|
||||||
|
|
||||||
|
err = Bolt_ListItems(db, childPath, func(li ListItemInfo) error {
|
||||||
|
fileItem := zip.FileHeader{
|
||||||
|
Name: path.Join(path.Join(Apply(childPath, safename)...), safename(string(li.Name))),
|
||||||
|
}
|
||||||
|
fileItem.SetMode(0644)
|
||||||
|
fileW, err := zw.CreateHeader(&fileItem)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
buff, err := Bolt_GetItem(db, childPath, []byte(li.Name))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = io.CopyN(fileW, bytes.NewReader(buff), li.DataLen)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recurse for all bucket-type children
|
||||||
|
|
||||||
|
process(childPath)
|
||||||
|
|
||||||
|
// Done
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
err = process([]string{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = zw.Flush()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = zw.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return fh.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Bolt_ImportZipToDatabase(dbpath, zippath string) error {
|
||||||
|
|
||||||
|
db, err := Bolt_Open(false, dbpath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error opening target database: %w", err)
|
||||||
|
}
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
|
fh, err := os.OpenFile(zippath, os.O_RDONLY, 0400)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error opening input archive: %w", err)
|
||||||
|
}
|
||||||
|
defer fh.Close()
|
||||||
|
|
||||||
|
fstat, err := fh.Stat()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
zr, err := zip.NewReader(fh, fstat.Size())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Reading zip file format: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, zf := range zr.File {
|
||||||
|
if strings.HasSuffix(zf.Name, `/`) || (zf.Mode()&fs.ModeDir) != 0 {
|
||||||
|
// Bucket
|
||||||
|
bucketPath := strings.Split(strings.TrimSuffix(zf.Name, `/`), `/`)
|
||||||
|
err = Bolt_CreateBucket(db, bucketPath[0:len(bucketPath)-1], bucketPath[len(bucketPath)-1])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Creating bucket %q: %w", zf.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Object
|
||||||
|
objectPath := strings.Split(zf.Name, `/`)
|
||||||
|
|
||||||
|
rc, err := zf.Open()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := io.ReadAll(rc)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = Bolt_SetItem(db, objectPath[0:len(objectPath)-1], []byte(objectPath[len(objectPath)-1]), content)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = rc.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done
|
||||||
|
return nil
|
||||||
|
}
|
||||||
10
go.mod
10
go.mod
@@ -1,10 +1,12 @@
|
|||||||
module code.ivysaur.me/qbolt
|
module code.ivysaur.me/qbolt
|
||||||
|
|
||||||
go 1.23
|
go 1.23.0
|
||||||
|
|
||||||
|
toolchain go1.23.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/mappu/miqt v0.5.0
|
github.com/mappu/miqt v0.10.0
|
||||||
go.etcd.io/bbolt v1.3.11
|
go.etcd.io/bbolt v1.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require golang.org/x/sys v0.4.0 // indirect
|
require golang.org/x/sys v0.32.0 // indirect
|
||||||
|
|||||||
13
go.sum
13
go.sum
@@ -1,11 +1,20 @@
|
|||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/mappu/miqt v0.5.0 h1:BWajkNI9PWlWN6ZDgWKwv1gieBGEImRqlWS8ZqDmDfA=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/mappu/miqt v0.5.0/go.mod h1:xFg7ADaO1QSkmXPsPODoKe/bydJpRG9fgCYyIDl/h1U=
|
github.com/mappu/miqt v0.10.0 h1:w+ucRwdoIO7xS32us34lL2Mh0+aarywNpQz6c76ZSDY=
|
||||||
|
github.com/mappu/miqt v0.10.0/go.mod h1:xFg7ADaO1QSkmXPsPODoKe/bydJpRG9fgCYyIDl/h1U=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
|
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
|
||||||
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
|
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
|
||||||
|
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
|
||||||
|
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
|
||||||
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||||
|
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||||
|
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// Generated by miqt-uic. To update this file, edit the .ui file in
|
// Generated by miqt-uic. To update this file, edit the .ui file in
|
||||||
// Qt Designer, and then run 'go generate'.
|
// Qt Designer, and then run 'go generate'.
|
||||||
//
|
//
|
||||||
//go:generate miqt-uic -InFile itemwindow.ui -OutFile itemwindow_ui.go
|
//go:generate miqt-uic -Qt6 -InFile itemwindow.ui -OutFile itemwindow_ui.go
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mappu/miqt/qt"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ItemWindowUi struct {
|
type ItemWindowUi struct {
|
||||||
@@ -21,37 +21,43 @@ type ItemWindowUi struct {
|
|||||||
// NewItemWindowUi creates all Qt widget classes for ItemWindow.
|
// NewItemWindowUi creates all Qt widget classes for ItemWindow.
|
||||||
func NewItemWindowUi() *ItemWindowUi {
|
func NewItemWindowUi() *ItemWindowUi {
|
||||||
ui := &ItemWindowUi{}
|
ui := &ItemWindowUi{}
|
||||||
|
ui.ItemWindow = qt.NewQDialog(nil)
|
||||||
ui.ItemWindow = qt.NewQDialog2(nil)
|
ItemWindow__objectName := qt.NewQAnyStringView3("ItemWindow")
|
||||||
ui.ItemWindow.SetObjectName("ItemWindow")
|
ui.ItemWindow.SetObjectName(*ItemWindow__objectName)
|
||||||
|
ItemWindow__objectName.Delete() // setter copied value
|
||||||
ui.ItemWindow.Resize(370, 353)
|
ui.ItemWindow.Resize(370, 353)
|
||||||
ui.ItemWindow.SetWindowTitle("")
|
ui.ItemWindow.SetWindowTitle("")
|
||||||
icon0 := qt.NewQIcon()
|
icon0 := qt.NewQIcon()
|
||||||
icon0.AddFile4(":/rsrc/database_lightning.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon0.AddFile4(":/rsrc/database_lightning.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.ItemWindow.SetWindowIcon(icon0)
|
ui.ItemWindow.SetWindowIcon(icon0)
|
||||||
|
|
||||||
ui.gridLayout_2 = qt.NewQGridLayout(ui.ItemWindow.QWidget)
|
ui.gridLayout_2 = qt.NewQGridLayout(ui.ItemWindow.QWidget)
|
||||||
ui.gridLayout_2.SetObjectName("gridLayout_2")
|
gridLayout_2__objectName := qt.NewQAnyStringView3("gridLayout_2")
|
||||||
|
ui.gridLayout_2.SetObjectName(*gridLayout_2__objectName)
|
||||||
|
gridLayout_2__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_2.SetVerticalSpacing(0)
|
ui.gridLayout_2.SetVerticalSpacing(0)
|
||||||
ui.gridLayout_2.SetContentsMargins(0, 0, 0, 0)
|
ui.gridLayout_2.SetContentsMargins(0, 0, 0, 0)
|
||||||
ui.gridLayout_2.SetSpacing(6)
|
ui.gridLayout_2.SetSpacing(6)
|
||||||
|
ui.contentArea = qt.NewQPlainTextEdit(ui.ItemWindow.QWidget)
|
||||||
ui.contentArea = qt.NewQPlainTextEdit3(ui.ItemWindow.QWidget)
|
contentArea__objectName := qt.NewQAnyStringView3("contentArea")
|
||||||
ui.contentArea.SetObjectName("contentArea")
|
ui.contentArea.SetObjectName(*contentArea__objectName)
|
||||||
|
contentArea__objectName.Delete() // setter copied value
|
||||||
ui.contentArea.SetFrameShape(qt.QFrame__NoFrame)
|
ui.contentArea.SetFrameShape(qt.QFrame__NoFrame)
|
||||||
|
|
||||||
ui.gridLayout_2.AddWidget2(ui.contentArea.QWidget, 0, 0)
|
ui.gridLayout_2.AddWidget2(ui.contentArea.QWidget, 0, 0)
|
||||||
|
ui.frame = qt.NewQFrame(ui.ItemWindow.QWidget)
|
||||||
ui.frame = qt.NewQFrame2(ui.ItemWindow.QWidget)
|
frame__objectName := qt.NewQAnyStringView3("frame")
|
||||||
ui.frame.SetObjectName("frame")
|
ui.frame.SetObjectName(*frame__objectName)
|
||||||
|
frame__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout = qt.NewQGridLayout(ui.frame.QWidget)
|
ui.gridLayout = qt.NewQGridLayout(ui.frame.QWidget)
|
||||||
ui.gridLayout.SetObjectName("gridLayout")
|
gridLayout__objectName := qt.NewQAnyStringView3("gridLayout")
|
||||||
|
ui.gridLayout.SetObjectName(*gridLayout__objectName)
|
||||||
|
gridLayout__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout.SetContentsMargins(11, 11, 11, 11)
|
ui.gridLayout.SetContentsMargins(11, 11, 11, 11)
|
||||||
ui.gridLayout.SetSpacing(6)
|
ui.gridLayout.SetSpacing(6)
|
||||||
|
ui.buttonBox = qt.NewQDialogButtonBox(ui.frame.QWidget)
|
||||||
ui.buttonBox = qt.NewQDialogButtonBox5(ui.frame.QWidget)
|
buttonBox__objectName := qt.NewQAnyStringView3("buttonBox")
|
||||||
ui.buttonBox.SetObjectName("buttonBox")
|
ui.buttonBox.SetObjectName(*buttonBox__objectName)
|
||||||
|
buttonBox__objectName.Delete() // setter copied value
|
||||||
ui.buttonBox.SetStandardButtons(qt.QDialogButtonBox__Cancel | qt.QDialogButtonBox__Save)
|
ui.buttonBox.SetStandardButtons(qt.QDialogButtonBox__Cancel | qt.QDialogButtonBox__Save)
|
||||||
ui.buttonBox.OnAccepted(ui.ItemWindow.Accept)
|
ui.buttonBox.OnAccepted(ui.ItemWindow.Accept)
|
||||||
ui.buttonBox.OnRejected(ui.ItemWindow.Reject)
|
ui.buttonBox.OnRejected(ui.ItemWindow.Reject)
|
||||||
|
|||||||
8
main.go
8
main.go
@@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/mappu/miqt/qt"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version string = "v0.0.0-devel"
|
var Version string = "v0.0.0-devel"
|
||||||
@@ -15,6 +15,12 @@ func main() {
|
|||||||
qt.QGuiApplication_SetApplicationDisplayName("QBolt")
|
qt.QGuiApplication_SetApplicationDisplayName("QBolt")
|
||||||
qt.QGuiApplication_SetWindowIcon(qt.NewQIcon4(":/rsrc/database_lightning.png"))
|
qt.QGuiApplication_SetWindowIcon(qt.NewQIcon4(":/rsrc/database_lightning.png"))
|
||||||
|
|
||||||
|
// High DPI tweaks
|
||||||
|
qt.QCoreApplication_SetAttribute2(qt.AA_EnableHighDpiScaling, true)
|
||||||
|
qt.QCoreApplication_SetAttribute2(qt.AA_UseHighDpiPixmaps, true)
|
||||||
|
qt.QCoreApplication_SetAttribute2(qt.AA_Use96Dpi, true)
|
||||||
|
qt.QGuiApplication_SetHighDpiScaleFactorRoundingPolicy(qt.PassThrough)
|
||||||
|
|
||||||
w := NewMainWindow()
|
w := NewMainWindow()
|
||||||
w.ui.MainWindow.Show()
|
w.ui.MainWindow.Show()
|
||||||
|
|
||||||
|
|||||||
144
mainwindow.go
144
mainwindow.go
@@ -2,11 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mappu/miqt/qt"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
|
"github.com/mappu/miqt/qt6/mainthread"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,13 +25,13 @@ func NewMainWindow() *MainWindow {
|
|||||||
|
|
||||||
this.on_bucketTree_currentItemChanged(nil, nil)
|
this.on_bucketTree_currentItemChanged(nil, nil)
|
||||||
|
|
||||||
this.databaseContext = qt.NewQMenu()
|
this.databaseContext = qt.NewQMenu(this.ui.MainWindow.QWidget)
|
||||||
this.databaseContext.QWidget.AddAction(this.ui.actionRefresh_buckets)
|
this.databaseContext.QWidget.AddAction(this.ui.actionRefresh_buckets)
|
||||||
this.databaseContext.QWidget.AddAction(this.ui.actionAdd_bucket)
|
this.databaseContext.QWidget.AddAction(this.ui.actionAdd_bucket)
|
||||||
this.databaseContext.AddSeparator()
|
this.databaseContext.AddSeparator()
|
||||||
this.databaseContext.QWidget.AddAction(this.ui.actionDisconnect)
|
this.databaseContext.QWidget.AddAction(this.ui.actionDisconnect)
|
||||||
|
|
||||||
this.bucketContext = qt.NewQMenu()
|
this.bucketContext = qt.NewQMenu(this.ui.MainWindow.QWidget)
|
||||||
this.bucketContext.QWidget.AddAction(this.ui.actionRefresh_buckets)
|
this.bucketContext.QWidget.AddAction(this.ui.actionRefresh_buckets)
|
||||||
this.bucketContext.QWidget.AddAction(this.ui.actionAdd_bucket)
|
this.bucketContext.QWidget.AddAction(this.ui.actionAdd_bucket)
|
||||||
this.bucketContext.AddSeparator()
|
this.bucketContext.AddSeparator()
|
||||||
@@ -40,6 +41,8 @@ func NewMainWindow() *MainWindow {
|
|||||||
this.ui.actionNew_database.OnTriggered(this.on_actionNew_database_triggered)
|
this.ui.actionNew_database.OnTriggered(this.on_actionNew_database_triggered)
|
||||||
this.ui.actionOpen_database.OnTriggered(this.on_actionOpen_database_triggered)
|
this.ui.actionOpen_database.OnTriggered(this.on_actionOpen_database_triggered)
|
||||||
this.ui.actionOpen_database_as_read_only.OnTriggered(this.on_actionOpen_database_as_read_only_triggered)
|
this.ui.actionOpen_database_as_read_only.OnTriggered(this.on_actionOpen_database_as_read_only_triggered)
|
||||||
|
this.ui.actionExport_database_as_zip.OnTriggered(this.onactionExport_database_as_zip_triggered)
|
||||||
|
this.ui.actionCreate_database_from_zip.OnTriggered(this.onactionCreate_database_from_zip_triggered)
|
||||||
this.ui.actionExit.OnTriggered(this.on_actionExit_triggered)
|
this.ui.actionExit.OnTriggered(this.on_actionExit_triggered)
|
||||||
this.ui.actionAbout_Qt.OnTriggered(this.on_actionAbout_Qt_triggered)
|
this.ui.actionAbout_Qt.OnTriggered(this.on_actionAbout_Qt_triggered)
|
||||||
this.ui.actionAbout_qbolt.OnTriggered(this.on_actionAbout_qbolt_triggered)
|
this.ui.actionAbout_qbolt.OnTriggered(this.on_actionAbout_qbolt_triggered)
|
||||||
@@ -55,6 +58,11 @@ func NewMainWindow() *MainWindow {
|
|||||||
this.ui.DeleteDataButton.OnClicked(this.on_DeleteDataButton_clicked)
|
this.ui.DeleteDataButton.OnClicked(this.on_DeleteDataButton_clicked)
|
||||||
this.ui.bucketData.OnItemSelectionChanged(this.on_bucketData_itemSelectionChanged)
|
this.ui.bucketData.OnItemSelectionChanged(this.on_bucketData_itemSelectionChanged)
|
||||||
|
|
||||||
|
this.ui.MainWindow.SetAcceptDrops(true)
|
||||||
|
this.ui.MainWindow.OnDragEnterEvent(this.onDragEnter)
|
||||||
|
this.ui.MainWindow.OnDragMoveEvent(this.onDragMove)
|
||||||
|
this.ui.MainWindow.OnDropEvent(this.onDropEvent)
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +76,7 @@ var bdbs []*bolt.DB = nil
|
|||||||
func SET_BDB(top *qt.QTreeWidgetItem, bdb *bolt.DB) {
|
func SET_BDB(top *qt.QTreeWidgetItem, bdb *bolt.DB) {
|
||||||
idx := len(bdbs)
|
idx := len(bdbs)
|
||||||
bdbs = append(bdbs, bdb)
|
bdbs = append(bdbs, bdb)
|
||||||
top.SetData(0, BdbPointerRole, qt.NewQVariant7(idx)) // Don't store a Go pointer in Qt memory
|
top.SetData(0, BdbPointerRole, qt.NewQVariant4(idx)) // Don't store a Go pointer in Qt memory
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_BDB(top *qt.QTreeWidgetItem) *bolt.DB {
|
func GET_BDB(top *qt.QTreeWidgetItem) *bolt.DB {
|
||||||
@@ -88,6 +96,39 @@ func (this *MainWindow) Widget() *qt.QWidget {
|
|||||||
return this.ui.centralWidget
|
return this.ui.centralWidget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MainWindow) onDragEnter(super func(event *qt.QDragEnterEvent), event *qt.QDragEnterEvent) {
|
||||||
|
if !event.MimeData().HasUrls() {
|
||||||
|
event.Ignore()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Accept()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MainWindow) onDragMove(super func(event *qt.QDragMoveEvent), event *qt.QDragMoveEvent) {
|
||||||
|
if !event.MimeData().HasUrls() {
|
||||||
|
event.Ignore()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
event.SetDropAction(qt.CopyAction)
|
||||||
|
event.Accept()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MainWindow) onDropEvent(super func(event *qt.QDropEvent), event *qt.QDropEvent) {
|
||||||
|
if !event.MimeData().HasUrls() {
|
||||||
|
event.Ignore()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Accept()
|
||||||
|
paths := event.MimeData().Urls()
|
||||||
|
for _, path := range paths {
|
||||||
|
lpath := path.ToLocalFile()
|
||||||
|
this.openDatabase(lpath, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *MainWindow) on_actionNew_database_triggered() {
|
func (this *MainWindow) on_actionNew_database_triggered() {
|
||||||
file := qt.QFileDialog_GetSaveFileName2(this.Widget(), "Save new bolt database as...")
|
file := qt.QFileDialog_GetSaveFileName2(this.Widget(), "Save new bolt database as...")
|
||||||
if len(file) > 0 {
|
if len(file) > 0 {
|
||||||
@@ -134,13 +175,61 @@ func (this *MainWindow) openDatabase(file string, readOnly bool) {
|
|||||||
this.ui.bucketTree.ExpandItem(top)
|
this.ui.bucketTree.ExpandItem(top)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDisplayName(qba string) string {
|
func (this *MainWindow) onactionExport_database_as_zip_triggered() {
|
||||||
if qba == "" {
|
|
||||||
return "<empty>"
|
dbPath := qt.QFileDialog_GetOpenFileName2(this.Widget(), "Select bolt database...")
|
||||||
|
if dbPath == "" {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := strconv.Quote(qba)
|
zipPath := qt.QFileDialog_GetSaveFileName4(this.Widget(), "Save as...", "", "Zip files (*.zip)")
|
||||||
return ret[1 : len(ret)-1]
|
if zipPath == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
err := Bolt_ExportDatabaseToZip(dbPath, zipPath)
|
||||||
|
mainthread.Start(func() {
|
||||||
|
if err != nil {
|
||||||
|
this.alert(fmt.Sprintf("Error exporting database as zip: %s", err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.alert("Exported as zip successfully.")
|
||||||
|
})
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MainWindow) onactionCreate_database_from_zip_triggered() {
|
||||||
|
|
||||||
|
zipPath := qt.QFileDialog_GetOpenFileName4(this.Widget(), "Select zip archive...", "", "Zip files (*.zip)")
|
||||||
|
if zipPath == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dbPath := qt.QFileDialog_GetSaveFileName2(this.Widget(), "Save as...")
|
||||||
|
if dbPath == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Qt popped up a message saying 'will overwrite existing'
|
||||||
|
// Make that true
|
||||||
|
if err := os.Remove(dbPath); err != nil && !os.IsNotExist(err) {
|
||||||
|
this.alert(fmt.Sprintf("Error removing existing database for overwrite: %s", err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
err := Bolt_ImportZipToDatabase(dbPath, zipPath)
|
||||||
|
mainthread.Start(func() {
|
||||||
|
if err != nil {
|
||||||
|
this.alert(fmt.Sprintf("Error importing database from zip %q: %s", zipPath, err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.alert("Imported zip to database successfully.")
|
||||||
|
})
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MainWindow) refreshBucketTree(itm *qt.QTreeWidgetItem) {
|
func (this *MainWindow) refreshBucketTree(itm *qt.QTreeWidgetItem) {
|
||||||
@@ -153,15 +242,17 @@ func (this *MainWindow) refreshBucketTree(itm *qt.QTreeWidgetItem) {
|
|||||||
i -= 1
|
i -= 1
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Bolt_ListBuckets(ws.bdb, ws.browse, func(qba string) {
|
err := Bolt_ListBuckets(ws.bdb, ws.browse, func(qba string) error {
|
||||||
|
|
||||||
child := qt.NewQTreeWidgetItem6(itm) // NewQTreeWidgetItem()
|
child := qt.NewQTreeWidgetItem6(itm) // NewQTreeWidgetItem()
|
||||||
child.SetText(0, getDisplayName(qba))
|
child.SetText(0, getDisplayName([]byte(qba)))
|
||||||
child.SetData(0, BinaryDataRole, qt.NewQVariant15(MakeQByteArray(qba)))
|
child.SetData(0, BinaryDataRole, qt.NewQVariant12([]byte(qba)))
|
||||||
child.SetIcon(0, qt.NewQIcon4(":/rsrc/table.png"))
|
child.SetIcon(0, qt.NewQIcon4(":/rsrc/table.png"))
|
||||||
|
|
||||||
itm.AddChild(child)
|
itm.AddChild(child)
|
||||||
this.refreshBucketTree(child)
|
this.refreshBucketTree(child)
|
||||||
|
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.alert(fmt.Sprintf("Error listing buckets under %s: %s", strings.Join(ws.browse, `/`), err.Error()))
|
this.alert(fmt.Sprintf("Error listing buckets under %s: %s", strings.Join(ws.browse, `/`), err.Error()))
|
||||||
@@ -215,11 +306,11 @@ func (this *MainWindow) on_bucketTree_customContextMenuRequested(pos *qt.QPoint)
|
|||||||
|
|
||||||
if itm.Parent() != nil {
|
if itm.Parent() != nil {
|
||||||
// Child item, show the bucket menu
|
// Child item, show the bucket menu
|
||||||
this.bucketContext.Popup(this.ui.bucketTree.Viewport().MapToGlobal(pos))
|
this.bucketContext.Popup(this.ui.bucketTree.Viewport().MapToGlobalWithQPoint(pos))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Top-level item, show the database menu
|
// Top-level item, show the database menu
|
||||||
this.databaseContext.Popup(this.ui.bucketTree.Viewport().MapToGlobal(pos))
|
this.databaseContext.Popup(this.ui.bucketTree.Viewport().MapToGlobalWithQPoint(pos))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +374,7 @@ func (this *MainWindow) refreshData(bdb *bolt.DB, browse []string) {
|
|||||||
err := Bolt_ListItems(bdb, browse, func(lii ListItemInfo) error {
|
err := Bolt_ListItems(bdb, browse, func(lii ListItemInfo) error {
|
||||||
itm := qt.NewQTreeWidgetItem()
|
itm := qt.NewQTreeWidgetItem()
|
||||||
itm.SetText(0, getDisplayName(lii.Name))
|
itm.SetText(0, getDisplayName(lii.Name))
|
||||||
itm.SetData(0, BinaryDataRole, qt.NewQVariant15(MakeQByteArray(lii.Name)))
|
itm.SetData(0, BinaryDataRole, qt.NewQVariant12([]byte(lii.Name)))
|
||||||
itm.SetText(1, fmt.Sprintf("%d", lii.DataLen))
|
itm.SetText(1, fmt.Sprintf("%d", lii.DataLen))
|
||||||
this.ui.bucketData.AddTopLevelItem(itm)
|
this.ui.bucketData.AddTopLevelItem(itm)
|
||||||
return nil
|
return nil
|
||||||
@@ -328,7 +419,7 @@ func (this *MainWindow) getSelection(itm *qt.QTreeWidgetItem) windowSelection {
|
|||||||
if top.Parent() == nil {
|
if top.Parent() == nil {
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
browse = append(browse, FromQByteArray(top.Data(0, BinaryDataRole).ToByteArray()))
|
browse = append(browse, string(top.Data(0, BinaryDataRole).ToByteArray()))
|
||||||
top = top.Parent()
|
top = top.Parent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,7 +431,7 @@ func (this *MainWindow) getSelection(itm *qt.QTreeWidgetItem) windowSelection {
|
|||||||
return windowSelection{itm: itm, top: top, browse: browse, bdb: bdb}
|
return windowSelection{itm: itm, top: top, browse: browse, bdb: bdb}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MainWindow) openEditor(bdb *bolt.DB, saveAs []string, saveAsKey string, currentContent []byte) {
|
func (this *MainWindow) openEditor(bdb *bolt.DB, saveAs []string, saveAsKey []byte, currentContent []byte) {
|
||||||
iw := NewItemWindowUi()
|
iw := NewItemWindowUi()
|
||||||
|
|
||||||
iw.contentArea.SetPlainText(string(currentContent))
|
iw.contentArea.SetPlainText(string(currentContent))
|
||||||
@@ -349,7 +440,7 @@ func (this *MainWindow) openEditor(bdb *bolt.DB, saveAs []string, saveAsKey stri
|
|||||||
iw.ItemWindow.OnFinished(func(exitCode int) {
|
iw.ItemWindow.OnFinished(func(exitCode int) {
|
||||||
if exitCode == int(qt.QDialog__Accepted) {
|
if exitCode == int(qt.QDialog__Accepted) {
|
||||||
|
|
||||||
err := Bolt_SetItem(bdb, saveAs, saveAsKey, iw.contentArea.ToPlainText())
|
err := Bolt_SetItem(bdb, saveAs, saveAsKey, []byte(iw.contentArea.ToPlainText()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.alert(fmt.Sprintf("Error saving item content: %s", err.Error()))
|
this.alert(fmt.Sprintf("Error saving item content: %s", err.Error()))
|
||||||
}
|
}
|
||||||
@@ -370,8 +461,7 @@ func (this *MainWindow) on_bucketData_doubleClicked(index *qt.QModelIndex) {
|
|||||||
|
|
||||||
// Get item key
|
// Get item key
|
||||||
|
|
||||||
model := index.Model()
|
key := index.DataWithRole(BinaryDataRole).ToByteArray()
|
||||||
key := FromQByteArray(model.Data2(model.Index(index.Row(), 0), BinaryDataRole).ToByteArray())
|
|
||||||
|
|
||||||
// DB lookup
|
// DB lookup
|
||||||
content, err := Bolt_GetItem(ws.bdb, ws.browse, key)
|
content, err := Bolt_GetItem(ws.bdb, ws.browse, key)
|
||||||
@@ -415,8 +505,8 @@ func (this *MainWindow) on_actionDelete_bucket_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prompt for confirmation
|
// Prompt for confirmation
|
||||||
bucketToDelete := FromQByteArray(ws.itm.Data(0, BinaryDataRole).ToByteArray())
|
bucketToDelete := ws.itm.Data(0, BinaryDataRole).ToByteArray()
|
||||||
if qt.QMessageBox_Question4(
|
if qt.QMessageBox_Question2(
|
||||||
this.Widget(),
|
this.Widget(),
|
||||||
"Delete bucket",
|
"Delete bucket",
|
||||||
fmt.Sprintf("Are you sure you want to remove the bucket '%s'?", getDisplayName(bucketToDelete)),
|
fmt.Sprintf("Are you sure you want to remove the bucket '%s'?", getDisplayName(bucketToDelete)),
|
||||||
@@ -434,7 +524,7 @@ func (this *MainWindow) on_actionDelete_bucket_triggered() {
|
|||||||
ws.browse = ws.browse[0 : len(ws.browse)-1]
|
ws.browse = ws.browse[0 : len(ws.browse)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Bolt_DeleteBucket(ws.bdb, ws.browse, bucketToDelete)
|
err := Bolt_DeleteBucket(ws.bdb, ws.browse, string(bucketToDelete))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.alert(fmt.Sprintf("Error removing bucket: %s", err.Error()))
|
this.alert(fmt.Sprintf("Error removing bucket: %s", err.Error()))
|
||||||
return
|
return
|
||||||
@@ -459,7 +549,7 @@ func (this *MainWindow) on_AddDataButton_clicked() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openEditor(ws.bdb, ws.browse, name, []byte(""))
|
this.openEditor(ws.bdb, ws.browse, []byte(name), []byte(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MainWindow) on_DeleteDataButton_clicked() {
|
func (this *MainWindow) on_DeleteDataButton_clicked() {
|
||||||
@@ -474,13 +564,13 @@ func (this *MainWindow) on_DeleteDataButton_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prompt for confirmation
|
// Prompt for confirmation
|
||||||
if qt.QMessageBox_Question4(this.Widget(), "Delete items", fmt.Sprintf("Are you sure you want to remove %d item(s)?", len(selection)), qt.QMessageBox__Yes, qt.QMessageBox__Cancel) != int(qt.QMessageBox__Yes) {
|
if qt.QMessageBox_Question2(this.Widget(), "Delete items", fmt.Sprintf("Are you sure you want to remove %d item(s)?", len(selection)), qt.QMessageBox__Yes, qt.QMessageBox__Cancel) != int(qt.QMessageBox__Yes) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var i int = len(selection)
|
var i int = len(selection)
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
err := Bolt_DeleteItem(ws.bdb, ws.browse, FromQByteArray(selection[i-1].Data(0, BinaryDataRole).ToByteArray()))
|
err := Bolt_DeleteItem(ws.bdb, ws.browse, selection[i-1].Data(0, BinaryDataRole).ToByteArray())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.alert(fmt.Sprintf("Error removing item: %s", err.Error()))
|
this.alert(fmt.Sprintf("Error removing item: %s", err.Error()))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -269,17 +269,27 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>668</width>
|
<width>668</width>
|
||||||
<height>29</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuConvert">
|
||||||
|
<property name="title">
|
||||||
|
<string>Convert</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionExport_database_as_zip"/>
|
||||||
|
<addaction name="actionCreate_database_from_zip"/>
|
||||||
|
</widget>
|
||||||
<addaction name="actionNew_database"/>
|
<addaction name="actionNew_database"/>
|
||||||
<addaction name="actionOpen_database"/>
|
<addaction name="actionOpen_database"/>
|
||||||
<addaction name="actionOpen_database_as_read_only"/>
|
<addaction name="actionOpen_database_as_read_only"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="menuConvert"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuHelp">
|
<widget class="QMenu" name="menuHelp">
|
||||||
@@ -319,6 +329,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&About QBolt</string>
|
<string>&About QBolt</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F1</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAbout_Qt">
|
<action name="actionAbout_Qt">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -372,6 +385,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Refresh buckets</string>
|
<string>Refresh buckets</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F5</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionClear_selection">
|
<action name="actionClear_selection">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -401,6 +417,16 @@
|
|||||||
<string>Open database as read-only...</string>
|
<string>Open database as read-only...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionExport_database_as_zip">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export database as zip</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionCreate_database_from_zip">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create database from zip</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
277
mainwindow_ui.go
277
mainwindow_ui.go
@@ -1,12 +1,12 @@
|
|||||||
// Generated by miqt-uic. To update this file, edit the .ui file in
|
// Generated by miqt-uic. To update this file, edit the .ui file in
|
||||||
// Qt Designer, and then run 'go generate'.
|
// Qt Designer, and then run 'go generate'.
|
||||||
//
|
//
|
||||||
//go:generate miqt-uic -InFile mainwindow.ui -OutFile mainwindow_ui.go
|
//go:generate miqt-uic -Qt6 -InFile mainwindow.ui -OutFile mainwindow_ui.go
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mappu/miqt/qt"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MainWindowUi struct {
|
type MainWindowUi struct {
|
||||||
@@ -36,6 +36,7 @@ type MainWindowUi struct {
|
|||||||
DeleteDataButton *qt.QPushButton
|
DeleteDataButton *qt.QPushButton
|
||||||
menuBar *qt.QMenuBar
|
menuBar *qt.QMenuBar
|
||||||
menuFile *qt.QMenu
|
menuFile *qt.QMenu
|
||||||
|
menuConvert *qt.QMenu
|
||||||
menuHelp *qt.QMenu
|
menuHelp *qt.QMenu
|
||||||
menuView *qt.QMenu
|
menuView *qt.QMenu
|
||||||
mainToolBar *qt.QToolBar
|
mainToolBar *qt.QToolBar
|
||||||
@@ -51,120 +52,153 @@ type MainWindowUi struct {
|
|||||||
actionNew_database *qt.QAction
|
actionNew_database *qt.QAction
|
||||||
actionAdd_bucket *qt.QAction
|
actionAdd_bucket *qt.QAction
|
||||||
actionOpen_database_as_read_only *qt.QAction
|
actionOpen_database_as_read_only *qt.QAction
|
||||||
|
actionExport_database_as_zip *qt.QAction
|
||||||
|
actionCreate_database_from_zip *qt.QAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMainWindowUi creates all Qt widget classes for MainWindow.
|
// NewMainWindowUi creates all Qt widget classes for MainWindow.
|
||||||
func NewMainWindowUi() *MainWindowUi {
|
func NewMainWindowUi() *MainWindowUi {
|
||||||
ui := &MainWindowUi{}
|
ui := &MainWindowUi{}
|
||||||
|
ui.MainWindow = qt.NewQMainWindow(nil)
|
||||||
ui.MainWindow = qt.NewQMainWindow2(nil)
|
MainWindow__objectName := qt.NewQAnyStringView3("MainWindow")
|
||||||
ui.MainWindow.SetObjectName("MainWindow")
|
ui.MainWindow.SetObjectName(*MainWindow__objectName)
|
||||||
|
MainWindow__objectName.Delete() // setter copied value
|
||||||
ui.MainWindow.Resize(668, 405)
|
ui.MainWindow.Resize(668, 405)
|
||||||
ui.MainWindow.SetWindowTitle("QBolt")
|
ui.MainWindow.SetWindowTitle("QBolt")
|
||||||
icon0 := qt.NewQIcon()
|
icon0 := qt.NewQIcon()
|
||||||
icon0.AddFile4(":/rsrc/database_lightning.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon0.AddFile4(":/rsrc/database_lightning.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.MainWindow.SetWindowIcon(icon0)
|
ui.MainWindow.SetWindowIcon(icon0)
|
||||||
|
|
||||||
ui.actionAbout_qbolt = qt.NewQAction()
|
ui.actionAbout_qbolt = qt.NewQAction()
|
||||||
ui.actionAbout_qbolt.SetObjectName("actionAbout_qbolt")
|
actionAbout_qbolt__objectName := qt.NewQAnyStringView3("actionAbout_qbolt")
|
||||||
|
ui.actionAbout_qbolt.SetObjectName(*actionAbout_qbolt__objectName)
|
||||||
|
actionAbout_qbolt__objectName.Delete() // setter copied value
|
||||||
icon1 := qt.NewQIcon()
|
icon1 := qt.NewQIcon()
|
||||||
icon1.AddFile4(":/rsrc/information.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon1.AddFile4(":/rsrc/information.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionAbout_qbolt.SetIcon(icon1)
|
ui.actionAbout_qbolt.SetIcon(icon1)
|
||||||
|
|
||||||
ui.actionAbout_Qt = qt.NewQAction()
|
ui.actionAbout_Qt = qt.NewQAction()
|
||||||
ui.actionAbout_Qt.SetObjectName("actionAbout_Qt")
|
actionAbout_Qt__objectName := qt.NewQAnyStringView3("actionAbout_Qt")
|
||||||
|
ui.actionAbout_Qt.SetObjectName(*actionAbout_Qt__objectName)
|
||||||
|
actionAbout_Qt__objectName.Delete() // setter copied value
|
||||||
ui.actionOpen_database = qt.NewQAction()
|
ui.actionOpen_database = qt.NewQAction()
|
||||||
ui.actionOpen_database.SetObjectName("actionOpen_database")
|
actionOpen_database__objectName := qt.NewQAnyStringView3("actionOpen_database")
|
||||||
|
ui.actionOpen_database.SetObjectName(*actionOpen_database__objectName)
|
||||||
|
actionOpen_database__objectName.Delete() // setter copied value
|
||||||
icon2 := qt.NewQIcon()
|
icon2 := qt.NewQIcon()
|
||||||
icon2.AddFile4(":/rsrc/database.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon2.AddFile4(":/rsrc/database.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionOpen_database.SetIcon(icon2)
|
ui.actionOpen_database.SetIcon(icon2)
|
||||||
|
|
||||||
ui.actionExit = qt.NewQAction()
|
ui.actionExit = qt.NewQAction()
|
||||||
ui.actionExit.SetObjectName("actionExit")
|
actionExit__objectName := qt.NewQAnyStringView3("actionExit")
|
||||||
|
ui.actionExit.SetObjectName(*actionExit__objectName)
|
||||||
|
actionExit__objectName.Delete() // setter copied value
|
||||||
icon3 := qt.NewQIcon()
|
icon3 := qt.NewQIcon()
|
||||||
icon3.AddFile4(":/rsrc/door_out.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon3.AddFile4(":/rsrc/door_out.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionExit.SetIcon(icon3)
|
ui.actionExit.SetIcon(icon3)
|
||||||
|
|
||||||
ui.actionDisconnect = qt.NewQAction()
|
ui.actionDisconnect = qt.NewQAction()
|
||||||
ui.actionDisconnect.SetObjectName("actionDisconnect")
|
actionDisconnect__objectName := qt.NewQAnyStringView3("actionDisconnect")
|
||||||
|
ui.actionDisconnect.SetObjectName(*actionDisconnect__objectName)
|
||||||
|
actionDisconnect__objectName.Delete() // setter copied value
|
||||||
icon4 := qt.NewQIcon()
|
icon4 := qt.NewQIcon()
|
||||||
icon4.AddFile4(":/rsrc/disconnect.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon4.AddFile4(":/rsrc/disconnect.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionDisconnect.SetIcon(icon4)
|
ui.actionDisconnect.SetIcon(icon4)
|
||||||
|
|
||||||
ui.actionDelete_bucket = qt.NewQAction()
|
ui.actionDelete_bucket = qt.NewQAction()
|
||||||
ui.actionDelete_bucket.SetObjectName("actionDelete_bucket")
|
actionDelete_bucket__objectName := qt.NewQAnyStringView3("actionDelete_bucket")
|
||||||
|
ui.actionDelete_bucket.SetObjectName(*actionDelete_bucket__objectName)
|
||||||
|
actionDelete_bucket__objectName.Delete() // setter copied value
|
||||||
icon5 := qt.NewQIcon()
|
icon5 := qt.NewQIcon()
|
||||||
icon5.AddFile4(":/rsrc/table_delete.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon5.AddFile4(":/rsrc/table_delete.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionDelete_bucket.SetIcon(icon5)
|
ui.actionDelete_bucket.SetIcon(icon5)
|
||||||
|
|
||||||
ui.actionRefresh_buckets = qt.NewQAction()
|
ui.actionRefresh_buckets = qt.NewQAction()
|
||||||
ui.actionRefresh_buckets.SetObjectName("actionRefresh_buckets")
|
actionRefresh_buckets__objectName := qt.NewQAnyStringView3("actionRefresh_buckets")
|
||||||
|
ui.actionRefresh_buckets.SetObjectName(*actionRefresh_buckets__objectName)
|
||||||
|
actionRefresh_buckets__objectName.Delete() // setter copied value
|
||||||
icon6 := qt.NewQIcon()
|
icon6 := qt.NewQIcon()
|
||||||
icon6.AddFile4(":/rsrc/arrow_refresh.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon6.AddFile4(":/rsrc/arrow_refresh.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionRefresh_buckets.SetIcon(icon6)
|
ui.actionRefresh_buckets.SetIcon(icon6)
|
||||||
|
|
||||||
ui.actionClear_selection = qt.NewQAction()
|
ui.actionClear_selection = qt.NewQAction()
|
||||||
ui.actionClear_selection.SetObjectName("actionClear_selection")
|
actionClear_selection__objectName := qt.NewQAnyStringView3("actionClear_selection")
|
||||||
|
ui.actionClear_selection.SetObjectName(*actionClear_selection__objectName)
|
||||||
|
actionClear_selection__objectName.Delete() // setter copied value
|
||||||
ui.actionNew_database = qt.NewQAction()
|
ui.actionNew_database = qt.NewQAction()
|
||||||
ui.actionNew_database.SetObjectName("actionNew_database")
|
actionNew_database__objectName := qt.NewQAnyStringView3("actionNew_database")
|
||||||
|
ui.actionNew_database.SetObjectName(*actionNew_database__objectName)
|
||||||
|
actionNew_database__objectName.Delete() // setter copied value
|
||||||
icon7 := qt.NewQIcon()
|
icon7 := qt.NewQIcon()
|
||||||
icon7.AddFile4(":/rsrc/database_add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon7.AddFile4(":/rsrc/database_add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionNew_database.SetIcon(icon7)
|
ui.actionNew_database.SetIcon(icon7)
|
||||||
|
|
||||||
ui.actionAdd_bucket = qt.NewQAction()
|
ui.actionAdd_bucket = qt.NewQAction()
|
||||||
ui.actionAdd_bucket.SetObjectName("actionAdd_bucket")
|
actionAdd_bucket__objectName := qt.NewQAnyStringView3("actionAdd_bucket")
|
||||||
|
ui.actionAdd_bucket.SetObjectName(*actionAdd_bucket__objectName)
|
||||||
|
actionAdd_bucket__objectName.Delete() // setter copied value
|
||||||
icon8 := qt.NewQIcon()
|
icon8 := qt.NewQIcon()
|
||||||
icon8.AddFile4(":/rsrc/table_add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon8.AddFile4(":/rsrc/table_add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.actionAdd_bucket.SetIcon(icon8)
|
ui.actionAdd_bucket.SetIcon(icon8)
|
||||||
|
|
||||||
ui.actionOpen_database_as_read_only = qt.NewQAction()
|
ui.actionOpen_database_as_read_only = qt.NewQAction()
|
||||||
ui.actionOpen_database_as_read_only.SetObjectName("actionOpen_database_as_read_only")
|
actionOpen_database_as_read_only__objectName := qt.NewQAnyStringView3("actionOpen_database_as_read_only")
|
||||||
|
ui.actionOpen_database_as_read_only.SetObjectName(*actionOpen_database_as_read_only__objectName)
|
||||||
ui.centralWidget = qt.NewQWidget2(ui.MainWindow.QWidget)
|
actionOpen_database_as_read_only__objectName.Delete() // setter copied value
|
||||||
ui.centralWidget.SetObjectName("centralWidget")
|
ui.actionExport_database_as_zip = qt.NewQAction()
|
||||||
|
actionExport_database_as_zip__objectName := qt.NewQAnyStringView3("actionExport_database_as_zip")
|
||||||
|
ui.actionExport_database_as_zip.SetObjectName(*actionExport_database_as_zip__objectName)
|
||||||
|
actionExport_database_as_zip__objectName.Delete() // setter copied value
|
||||||
|
ui.actionCreate_database_from_zip = qt.NewQAction()
|
||||||
|
actionCreate_database_from_zip__objectName := qt.NewQAnyStringView3("actionCreate_database_from_zip")
|
||||||
|
ui.actionCreate_database_from_zip.SetObjectName(*actionCreate_database_from_zip__objectName)
|
||||||
|
actionCreate_database_from_zip__objectName.Delete() // setter copied value
|
||||||
|
ui.centralWidget = qt.NewQWidget(ui.MainWindow.QWidget)
|
||||||
|
centralWidget__objectName := qt.NewQAnyStringView3("centralWidget")
|
||||||
|
ui.centralWidget.SetObjectName(*centralWidget__objectName)
|
||||||
|
centralWidget__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout = qt.NewQGridLayout(ui.centralWidget)
|
ui.gridLayout = qt.NewQGridLayout(ui.centralWidget)
|
||||||
ui.gridLayout.SetObjectName("gridLayout")
|
gridLayout__objectName := qt.NewQAnyStringView3("gridLayout")
|
||||||
|
ui.gridLayout.SetObjectName(*gridLayout__objectName)
|
||||||
|
gridLayout__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout.SetContentsMargins(0, 0, 0, 0)
|
ui.gridLayout.SetContentsMargins(0, 0, 0, 0)
|
||||||
ui.gridLayout.SetSpacing(6)
|
ui.gridLayout.SetSpacing(6)
|
||||||
|
ui.splitter = qt.NewQSplitter(ui.centralWidget)
|
||||||
ui.splitter = qt.NewQSplitter3(ui.centralWidget)
|
splitter__objectName := qt.NewQAnyStringView3("splitter")
|
||||||
ui.splitter.SetObjectName("splitter")
|
ui.splitter.SetObjectName(*splitter__objectName)
|
||||||
|
splitter__objectName.Delete() // setter copied value
|
||||||
ui.splitter.SetOrientation(qt.Horizontal)
|
ui.splitter.SetOrientation(qt.Horizontal)
|
||||||
ui.splitter.SetChildrenCollapsible(false)
|
ui.splitter.SetChildrenCollapsible(false)
|
||||||
|
ui.bucketTree = qt.NewQTreeWidget(ui.splitter.QWidget)
|
||||||
ui.bucketTree = qt.NewQTreeWidget2(ui.splitter.QWidget)
|
bucketTree__objectName := qt.NewQAnyStringView3("bucketTree")
|
||||||
ui.bucketTree.SetObjectName("bucketTree")
|
ui.bucketTree.SetObjectName(*bucketTree__objectName)
|
||||||
|
bucketTree__objectName.Delete() // setter copied value
|
||||||
ui.bucketTree.SetContextMenuPolicy(qt.CustomContextMenu)
|
ui.bucketTree.SetContextMenuPolicy(qt.CustomContextMenu)
|
||||||
ui.bucketTree.SetUniformRowHeights(true)
|
ui.bucketTree.SetUniformRowHeights(true)
|
||||||
ui.splitter.AddWidget(ui.bucketTree.QWidget)
|
ui.splitter.AddWidget(ui.bucketTree.QWidget)
|
||||||
|
ui.stackedWidget = qt.NewQStackedWidget(ui.splitter.QWidget)
|
||||||
ui.stackedWidget = qt.NewQStackedWidget2(ui.splitter.QWidget)
|
stackedWidget__objectName := qt.NewQAnyStringView3("stackedWidget")
|
||||||
ui.stackedWidget.SetObjectName("stackedWidget")
|
ui.stackedWidget.SetObjectName(*stackedWidget__objectName)
|
||||||
|
stackedWidget__objectName.Delete() // setter copied value
|
||||||
ui.databasePage = qt.NewQWidget2(ui.stackedWidget.QWidget)
|
ui.databasePage = qt.NewQWidget(ui.stackedWidget.QWidget)
|
||||||
ui.databasePage.SetObjectName("databasePage")
|
databasePage__objectName := qt.NewQAnyStringView3("databasePage")
|
||||||
|
ui.databasePage.SetObjectName(*databasePage__objectName)
|
||||||
|
databasePage__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_4 = qt.NewQGridLayout(ui.databasePage)
|
ui.gridLayout_4 = qt.NewQGridLayout(ui.databasePage)
|
||||||
ui.gridLayout_4.SetObjectName("gridLayout_4")
|
gridLayout_4__objectName := qt.NewQAnyStringView3("gridLayout_4")
|
||||||
|
ui.gridLayout_4.SetObjectName(*gridLayout_4__objectName)
|
||||||
|
gridLayout_4__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_4.SetContentsMargins(0, 0, 0, 0)
|
ui.gridLayout_4.SetContentsMargins(0, 0, 0, 0)
|
||||||
ui.gridLayout_4.SetSpacing(6)
|
ui.gridLayout_4.SetSpacing(6)
|
||||||
|
ui.databaseTabWidget = qt.NewQTabWidget(ui.databasePage)
|
||||||
ui.databaseTabWidget = qt.NewQTabWidget2(ui.databasePage)
|
databaseTabWidget__objectName := qt.NewQAnyStringView3("databaseTabWidget")
|
||||||
ui.databaseTabWidget.SetObjectName("databaseTabWidget")
|
ui.databaseTabWidget.SetObjectName(*databaseTabWidget__objectName)
|
||||||
|
databaseTabWidget__objectName.Delete() // setter copied value
|
||||||
ui.databasePropertiesTab = qt.NewQWidget2(ui.databaseTabWidget.QWidget)
|
ui.databasePropertiesTab = qt.NewQWidget(ui.databaseTabWidget.QWidget)
|
||||||
ui.databasePropertiesTab.SetObjectName("databasePropertiesTab")
|
databasePropertiesTab__objectName := qt.NewQAnyStringView3("databasePropertiesTab")
|
||||||
|
ui.databasePropertiesTab.SetObjectName(*databasePropertiesTab__objectName)
|
||||||
|
databasePropertiesTab__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_2 = qt.NewQGridLayout(ui.databasePropertiesTab)
|
ui.gridLayout_2 = qt.NewQGridLayout(ui.databasePropertiesTab)
|
||||||
ui.gridLayout_2.SetObjectName("gridLayout_2")
|
gridLayout_2__objectName := qt.NewQAnyStringView3("gridLayout_2")
|
||||||
|
ui.gridLayout_2.SetObjectName(*gridLayout_2__objectName)
|
||||||
|
gridLayout_2__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_2.SetContentsMargins(3, 3, 3, 3)
|
ui.gridLayout_2.SetContentsMargins(3, 3, 3, 3)
|
||||||
ui.gridLayout_2.SetSpacing(6)
|
ui.gridLayout_2.SetSpacing(6)
|
||||||
|
ui.databasePropertiesArea = qt.NewQPlainTextEdit(ui.databasePropertiesTab)
|
||||||
ui.databasePropertiesArea = qt.NewQPlainTextEdit3(ui.databasePropertiesTab)
|
databasePropertiesArea__objectName := qt.NewQAnyStringView3("databasePropertiesArea")
|
||||||
ui.databasePropertiesArea.SetObjectName("databasePropertiesArea")
|
ui.databasePropertiesArea.SetObjectName(*databasePropertiesArea__objectName)
|
||||||
|
databasePropertiesArea__objectName.Delete() // setter copied value
|
||||||
ui.databasePropertiesArea.SetFrameShape(qt.QFrame__NoFrame)
|
ui.databasePropertiesArea.SetFrameShape(qt.QFrame__NoFrame)
|
||||||
ui.databasePropertiesArea.SetReadOnly(true)
|
ui.databasePropertiesArea.SetReadOnly(true)
|
||||||
|
|
||||||
@@ -175,28 +209,34 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
|
|
||||||
ui.gridLayout_4.AddWidget2(ui.databaseTabWidget.QWidget, 0, 0)
|
ui.gridLayout_4.AddWidget2(ui.databaseTabWidget.QWidget, 0, 0)
|
||||||
ui.stackedWidget.AddWidget(ui.databasePage)
|
ui.stackedWidget.AddWidget(ui.databasePage)
|
||||||
|
ui.bucketPage = qt.NewQWidget(ui.stackedWidget.QWidget)
|
||||||
ui.bucketPage = qt.NewQWidget2(ui.stackedWidget.QWidget)
|
bucketPage__objectName := qt.NewQAnyStringView3("bucketPage")
|
||||||
ui.bucketPage.SetObjectName("bucketPage")
|
ui.bucketPage.SetObjectName(*bucketPage__objectName)
|
||||||
|
bucketPage__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_3 = qt.NewQGridLayout(ui.bucketPage)
|
ui.gridLayout_3 = qt.NewQGridLayout(ui.bucketPage)
|
||||||
ui.gridLayout_3.SetObjectName("gridLayout_3")
|
gridLayout_3__objectName := qt.NewQAnyStringView3("gridLayout_3")
|
||||||
|
ui.gridLayout_3.SetObjectName(*gridLayout_3__objectName)
|
||||||
|
gridLayout_3__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_3.SetContentsMargins(0, 0, 0, 0)
|
ui.gridLayout_3.SetContentsMargins(0, 0, 0, 0)
|
||||||
ui.gridLayout_3.SetSpacing(6)
|
ui.gridLayout_3.SetSpacing(6)
|
||||||
|
ui.bucketTabWidget = qt.NewQTabWidget(ui.bucketPage)
|
||||||
ui.bucketTabWidget = qt.NewQTabWidget2(ui.bucketPage)
|
bucketTabWidget__objectName := qt.NewQAnyStringView3("bucketTabWidget")
|
||||||
ui.bucketTabWidget.SetObjectName("bucketTabWidget")
|
ui.bucketTabWidget.SetObjectName(*bucketTabWidget__objectName)
|
||||||
|
bucketTabWidget__objectName.Delete() // setter copied value
|
||||||
ui.bucketPropertiesTab = qt.NewQWidget2(ui.bucketTabWidget.QWidget)
|
ui.bucketPropertiesTab = qt.NewQWidget(ui.bucketTabWidget.QWidget)
|
||||||
ui.bucketPropertiesTab.SetObjectName("bucketPropertiesTab")
|
bucketPropertiesTab__objectName := qt.NewQAnyStringView3("bucketPropertiesTab")
|
||||||
|
ui.bucketPropertiesTab.SetObjectName(*bucketPropertiesTab__objectName)
|
||||||
|
bucketPropertiesTab__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_5 = qt.NewQGridLayout(ui.bucketPropertiesTab)
|
ui.gridLayout_5 = qt.NewQGridLayout(ui.bucketPropertiesTab)
|
||||||
ui.gridLayout_5.SetObjectName("gridLayout_5")
|
gridLayout_5__objectName := qt.NewQAnyStringView3("gridLayout_5")
|
||||||
|
ui.gridLayout_5.SetObjectName(*gridLayout_5__objectName)
|
||||||
|
gridLayout_5__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_5.SetContentsMargins(3, 3, 3, 3)
|
ui.gridLayout_5.SetContentsMargins(3, 3, 3, 3)
|
||||||
ui.gridLayout_5.SetSpacing(6)
|
ui.gridLayout_5.SetSpacing(6)
|
||||||
|
ui.bucketPropertiesArea = qt.NewQPlainTextEdit(ui.bucketPropertiesTab)
|
||||||
ui.bucketPropertiesArea = qt.NewQPlainTextEdit3(ui.bucketPropertiesTab)
|
bucketPropertiesArea__objectName := qt.NewQAnyStringView3("bucketPropertiesArea")
|
||||||
ui.bucketPropertiesArea.SetObjectName("bucketPropertiesArea")
|
ui.bucketPropertiesArea.SetObjectName(*bucketPropertiesArea__objectName)
|
||||||
|
bucketPropertiesArea__objectName.Delete() // setter copied value
|
||||||
ui.bucketPropertiesArea.SetFrameShape(qt.QFrame__NoFrame)
|
ui.bucketPropertiesArea.SetFrameShape(qt.QFrame__NoFrame)
|
||||||
ui.bucketPropertiesArea.SetReadOnly(true)
|
ui.bucketPropertiesArea.SetReadOnly(true)
|
||||||
|
|
||||||
@@ -204,17 +244,20 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
icon10 := qt.NewQIcon()
|
icon10 := qt.NewQIcon()
|
||||||
icon10.AddFile4(":/rsrc/chart_bar.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon10.AddFile4(":/rsrc/chart_bar.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.bucketTabWidget.AddTab2(ui.bucketPropertiesTab, icon10, "")
|
ui.bucketTabWidget.AddTab2(ui.bucketPropertiesTab, icon10, "")
|
||||||
|
ui.bucketDataTab = qt.NewQWidget(ui.bucketTabWidget.QWidget)
|
||||||
ui.bucketDataTab = qt.NewQWidget2(ui.bucketTabWidget.QWidget)
|
bucketDataTab__objectName := qt.NewQAnyStringView3("bucketDataTab")
|
||||||
ui.bucketDataTab.SetObjectName("bucketDataTab")
|
ui.bucketDataTab.SetObjectName(*bucketDataTab__objectName)
|
||||||
|
bucketDataTab__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_6 = qt.NewQGridLayout(ui.bucketDataTab)
|
ui.gridLayout_6 = qt.NewQGridLayout(ui.bucketDataTab)
|
||||||
ui.gridLayout_6.SetObjectName("gridLayout_6")
|
gridLayout_6__objectName := qt.NewQAnyStringView3("gridLayout_6")
|
||||||
|
ui.gridLayout_6.SetObjectName(*gridLayout_6__objectName)
|
||||||
|
gridLayout_6__objectName.Delete() // setter copied value
|
||||||
ui.gridLayout_6.SetContentsMargins(3, 3, 3, 3)
|
ui.gridLayout_6.SetContentsMargins(3, 3, 3, 3)
|
||||||
ui.gridLayout_6.SetSpacing(6)
|
ui.gridLayout_6.SetSpacing(6)
|
||||||
|
ui.bucketData = qt.NewQTreeWidget(ui.bucketDataTab)
|
||||||
ui.bucketData = qt.NewQTreeWidget2(ui.bucketDataTab)
|
bucketData__objectName := qt.NewQAnyStringView3("bucketData")
|
||||||
ui.bucketData.SetObjectName("bucketData")
|
ui.bucketData.SetObjectName(*bucketData__objectName)
|
||||||
|
bucketData__objectName.Delete() // setter copied value
|
||||||
ui.bucketData.SetSelectionMode(qt.QAbstractItemView__ExtendedSelection)
|
ui.bucketData.SetSelectionMode(qt.QAbstractItemView__ExtendedSelection)
|
||||||
ui.bucketData.SetIndentation(0)
|
ui.bucketData.SetIndentation(0)
|
||||||
ui.bucketData.SetRootIsDecorated(false)
|
ui.bucketData.SetRootIsDecorated(false)
|
||||||
@@ -222,18 +265,20 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
ui.bucketData.SetItemsExpandable(false)
|
ui.bucketData.SetItemsExpandable(false)
|
||||||
|
|
||||||
ui.gridLayout_6.AddWidget3(ui.bucketData.QWidget, 0, 0, 1, 3)
|
ui.gridLayout_6.AddWidget3(ui.bucketData.QWidget, 0, 0, 1, 3)
|
||||||
|
ui.AddDataButton = qt.NewQPushButton(ui.bucketDataTab)
|
||||||
ui.AddDataButton = qt.NewQPushButton4(ui.bucketDataTab)
|
AddDataButton__objectName := qt.NewQAnyStringView3("AddDataButton")
|
||||||
ui.AddDataButton.SetObjectName("AddDataButton")
|
ui.AddDataButton.SetObjectName(*AddDataButton__objectName)
|
||||||
|
AddDataButton__objectName.Delete() // setter copied value
|
||||||
icon11 := qt.NewQIcon()
|
icon11 := qt.NewQIcon()
|
||||||
icon11.AddFile4(":/rsrc/add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon11.AddFile4(":/rsrc/add.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.AddDataButton.SetIcon(icon11)
|
ui.AddDataButton.SetIcon(icon11)
|
||||||
|
|
||||||
ui.gridLayout_6.AddWidget2(ui.AddDataButton.QWidget, 1, 0)
|
ui.gridLayout_6.AddWidget2(ui.AddDataButton.QWidget, 1, 0)
|
||||||
/* miqt-uic: no handler for spacer */
|
/* miqt-uic: no handler for spacer */
|
||||||
|
ui.DeleteDataButton = qt.NewQPushButton(ui.bucketDataTab)
|
||||||
ui.DeleteDataButton = qt.NewQPushButton4(ui.bucketDataTab)
|
DeleteDataButton__objectName := qt.NewQAnyStringView3("DeleteDataButton")
|
||||||
ui.DeleteDataButton.SetObjectName("DeleteDataButton")
|
ui.DeleteDataButton.SetObjectName(*DeleteDataButton__objectName)
|
||||||
|
DeleteDataButton__objectName.Delete() // setter copied value
|
||||||
icon12 := qt.NewQIcon()
|
icon12 := qt.NewQIcon()
|
||||||
icon12.AddFile4(":/rsrc/delete.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
icon12.AddFile4(":/rsrc/delete.png", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)
|
||||||
ui.DeleteDataButton.SetIcon(icon12)
|
ui.DeleteDataButton.SetIcon(icon12)
|
||||||
@@ -249,42 +294,57 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
|
|
||||||
ui.gridLayout.AddWidget2(ui.splitter.QWidget, 0, 0)
|
ui.gridLayout.AddWidget2(ui.splitter.QWidget, 0, 0)
|
||||||
ui.MainWindow.SetCentralWidget(ui.centralWidget) // Set central widget
|
ui.MainWindow.SetCentralWidget(ui.centralWidget) // Set central widget
|
||||||
|
ui.menuBar = qt.NewQMenuBar(ui.MainWindow.QWidget)
|
||||||
ui.menuBar = qt.NewQMenuBar2(ui.MainWindow.QWidget)
|
menuBar__objectName := qt.NewQAnyStringView3("menuBar")
|
||||||
ui.menuBar.SetObjectName("menuBar")
|
ui.menuBar.SetObjectName(*menuBar__objectName)
|
||||||
ui.menuBar.Resize(668, 29)
|
menuBar__objectName.Delete() // setter copied value
|
||||||
|
ui.menuBar.Resize(668, 22)
|
||||||
ui.menuFile = qt.NewQMenu3(ui.menuBar.QWidget)
|
ui.menuFile = qt.NewQMenu(ui.menuBar.QWidget)
|
||||||
ui.menuFile.SetObjectName("menuFile")
|
menuFile__objectName := qt.NewQAnyStringView3("menuFile")
|
||||||
|
ui.menuFile.SetObjectName(*menuFile__objectName)
|
||||||
|
menuFile__objectName.Delete() // setter copied value
|
||||||
|
ui.menuConvert = qt.NewQMenu(ui.menuFile.QWidget)
|
||||||
|
menuConvert__objectName := qt.NewQAnyStringView3("menuConvert")
|
||||||
|
ui.menuConvert.SetObjectName(*menuConvert__objectName)
|
||||||
|
menuConvert__objectName.Delete() // setter copied value
|
||||||
|
ui.menuConvert.QWidget.AddAction(ui.actionExport_database_as_zip)
|
||||||
|
ui.menuConvert.QWidget.AddAction(ui.actionCreate_database_from_zip)
|
||||||
ui.menuFile.QWidget.AddAction(ui.actionNew_database)
|
ui.menuFile.QWidget.AddAction(ui.actionNew_database)
|
||||||
ui.menuFile.QWidget.AddAction(ui.actionOpen_database)
|
ui.menuFile.QWidget.AddAction(ui.actionOpen_database)
|
||||||
ui.menuFile.QWidget.AddAction(ui.actionOpen_database_as_read_only)
|
ui.menuFile.QWidget.AddAction(ui.actionOpen_database_as_read_only)
|
||||||
ui.menuFile.AddSeparator()
|
ui.menuFile.AddSeparator()
|
||||||
|
ui.menuFile.AddMenu(ui.menuConvert)
|
||||||
|
ui.menuFile.AddSeparator()
|
||||||
|
ui.menuFile.AddSeparator()
|
||||||
ui.menuFile.QWidget.AddAction(ui.actionExit)
|
ui.menuFile.QWidget.AddAction(ui.actionExit)
|
||||||
|
ui.menuHelp = qt.NewQMenu(ui.menuBar.QWidget)
|
||||||
ui.menuHelp = qt.NewQMenu3(ui.menuBar.QWidget)
|
menuHelp__objectName := qt.NewQAnyStringView3("menuHelp")
|
||||||
ui.menuHelp.SetObjectName("menuHelp")
|
ui.menuHelp.SetObjectName(*menuHelp__objectName)
|
||||||
|
menuHelp__objectName.Delete() // setter copied value
|
||||||
ui.menuHelp.QWidget.AddAction(ui.actionAbout_qbolt)
|
ui.menuHelp.QWidget.AddAction(ui.actionAbout_qbolt)
|
||||||
ui.menuHelp.QWidget.AddAction(ui.actionAbout_Qt)
|
ui.menuHelp.QWidget.AddAction(ui.actionAbout_Qt)
|
||||||
|
ui.menuView = qt.NewQMenu(ui.menuBar.QWidget)
|
||||||
ui.menuView = qt.NewQMenu3(ui.menuBar.QWidget)
|
menuView__objectName := qt.NewQAnyStringView3("menuView")
|
||||||
ui.menuView.SetObjectName("menuView")
|
ui.menuView.SetObjectName(*menuView__objectName)
|
||||||
|
menuView__objectName.Delete() // setter copied value
|
||||||
ui.menuView.QWidget.AddAction(ui.actionClear_selection)
|
ui.menuView.QWidget.AddAction(ui.actionClear_selection)
|
||||||
ui.menuBar.AddMenu(ui.menuFile)
|
ui.menuBar.AddMenu(ui.menuFile)
|
||||||
ui.menuBar.AddMenu(ui.menuView)
|
ui.menuBar.AddMenu(ui.menuView)
|
||||||
ui.menuBar.AddMenu(ui.menuHelp)
|
ui.menuBar.AddMenu(ui.menuHelp)
|
||||||
ui.MainWindow.SetMenuBar(ui.menuBar)
|
ui.MainWindow.SetMenuBar(ui.menuBar)
|
||||||
|
ui.mainToolBar = qt.NewQToolBar(ui.MainWindow.QWidget)
|
||||||
ui.mainToolBar = qt.NewQToolBar4(ui.MainWindow.QWidget)
|
mainToolBar__objectName := qt.NewQAnyStringView3("mainToolBar")
|
||||||
ui.mainToolBar.SetObjectName("mainToolBar")
|
ui.mainToolBar.SetObjectName(*mainToolBar__objectName)
|
||||||
|
mainToolBar__objectName.Delete() // setter copied value
|
||||||
ui.MainWindow.AddToolBar(qt.TopToolBarArea, ui.mainToolBar)
|
ui.MainWindow.AddToolBar(qt.TopToolBarArea, ui.mainToolBar)
|
||||||
/* miqt-uic: no handler for mainToolBar attribute 'toolBarBreak' */
|
/* miqt-uic: no handler for mainToolBar attribute 'toolBarBreak' */
|
||||||
ui.mainToolBar.QWidget.AddAction(ui.actionNew_database)
|
ui.mainToolBar.QWidget.AddAction(ui.actionNew_database)
|
||||||
ui.mainToolBar.QWidget.AddAction(ui.actionOpen_database)
|
ui.mainToolBar.QWidget.AddAction(ui.actionOpen_database)
|
||||||
ui.mainToolBar.AddSeparator()
|
ui.mainToolBar.AddSeparator()
|
||||||
|
ui.statusBar = qt.NewQStatusBar(ui.MainWindow.QWidget)
|
||||||
ui.statusBar = qt.NewQStatusBar2(ui.MainWindow.QWidget)
|
statusBar__objectName := qt.NewQAnyStringView3("statusBar")
|
||||||
ui.statusBar.SetObjectName("statusBar")
|
ui.statusBar.SetObjectName(*statusBar__objectName)
|
||||||
|
statusBar__objectName.Delete() // setter copied value
|
||||||
ui.MainWindow.SetStatusBar(ui.statusBar)
|
ui.MainWindow.SetStatusBar(ui.statusBar)
|
||||||
|
|
||||||
ui.Retranslate()
|
ui.Retranslate()
|
||||||
@@ -299,6 +359,7 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
// Retranslate reapplies all text translations.
|
// Retranslate reapplies all text translations.
|
||||||
func (ui *MainWindowUi) Retranslate() {
|
func (ui *MainWindowUi) Retranslate() {
|
||||||
ui.actionAbout_qbolt.SetText(qt.QMainWindow_Tr("&About QBolt"))
|
ui.actionAbout_qbolt.SetText(qt.QMainWindow_Tr("&About QBolt"))
|
||||||
|
ui.actionAbout_qbolt.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("F1")))
|
||||||
ui.actionAbout_Qt.SetText(qt.QMainWindow_Tr("About &Qt"))
|
ui.actionAbout_Qt.SetText(qt.QMainWindow_Tr("About &Qt"))
|
||||||
ui.actionOpen_database.SetText(qt.QMainWindow_Tr("&Open database..."))
|
ui.actionOpen_database.SetText(qt.QMainWindow_Tr("&Open database..."))
|
||||||
ui.actionOpen_database.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("Ctrl+O")))
|
ui.actionOpen_database.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("Ctrl+O")))
|
||||||
@@ -306,10 +367,13 @@ func (ui *MainWindowUi) Retranslate() {
|
|||||||
ui.actionDisconnect.SetText(qt.QMainWindow_Tr("Disconnect"))
|
ui.actionDisconnect.SetText(qt.QMainWindow_Tr("Disconnect"))
|
||||||
ui.actionDelete_bucket.SetText(qt.QMainWindow_Tr("Delete bucket"))
|
ui.actionDelete_bucket.SetText(qt.QMainWindow_Tr("Delete bucket"))
|
||||||
ui.actionRefresh_buckets.SetText(qt.QMainWindow_Tr("Refresh buckets"))
|
ui.actionRefresh_buckets.SetText(qt.QMainWindow_Tr("Refresh buckets"))
|
||||||
|
ui.actionRefresh_buckets.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("F5")))
|
||||||
ui.actionClear_selection.SetText(qt.QMainWindow_Tr("&Clear selection"))
|
ui.actionClear_selection.SetText(qt.QMainWindow_Tr("&Clear selection"))
|
||||||
ui.actionNew_database.SetText(qt.QMainWindow_Tr("&New database..."))
|
ui.actionNew_database.SetText(qt.QMainWindow_Tr("&New database..."))
|
||||||
ui.actionAdd_bucket.SetText(qt.QMainWindow_Tr("Add bucket..."))
|
ui.actionAdd_bucket.SetText(qt.QMainWindow_Tr("Add bucket..."))
|
||||||
ui.actionOpen_database_as_read_only.SetText(qt.QMainWindow_Tr("Open database as read-only..."))
|
ui.actionOpen_database_as_read_only.SetText(qt.QMainWindow_Tr("Open database as read-only..."))
|
||||||
|
ui.actionExport_database_as_zip.SetText(qt.QMainWindow_Tr("Export database as zip"))
|
||||||
|
ui.actionCreate_database_from_zip.SetText(qt.QMainWindow_Tr("Create database from zip"))
|
||||||
ui.bucketTree.HeaderItem().SetText(0, qt.QTreeWidget_Tr("Bucket"))
|
ui.bucketTree.HeaderItem().SetText(0, qt.QTreeWidget_Tr("Bucket"))
|
||||||
ui.databaseTabWidget.SetTabText(ui.databaseTabWidget.IndexOf(ui.databasePropertiesTab), qt.QTabWidget_Tr("Database"))
|
ui.databaseTabWidget.SetTabText(ui.databaseTabWidget.IndexOf(ui.databasePropertiesTab), qt.QTabWidget_Tr("Database"))
|
||||||
ui.databasePropertiesArea.SetPlainText(qt.QWidget_Tr("No selection"))
|
ui.databasePropertiesArea.SetPlainText(qt.QWidget_Tr("No selection"))
|
||||||
@@ -320,6 +384,7 @@ func (ui *MainWindowUi) Retranslate() {
|
|||||||
ui.AddDataButton.SetText(qt.QWidget_Tr("Add..."))
|
ui.AddDataButton.SetText(qt.QWidget_Tr("Add..."))
|
||||||
ui.DeleteDataButton.SetText(qt.QWidget_Tr("Delete..."))
|
ui.DeleteDataButton.SetText(qt.QWidget_Tr("Delete..."))
|
||||||
ui.menuFile.SetTitle(qt.QMenuBar_Tr("&File"))
|
ui.menuFile.SetTitle(qt.QMenuBar_Tr("&File"))
|
||||||
|
ui.menuConvert.SetTitle(qt.QMenu_Tr("Convert"))
|
||||||
ui.menuHelp.SetTitle(qt.QMenuBar_Tr("Help"))
|
ui.menuHelp.SetTitle(qt.QMenuBar_Tr("Help"))
|
||||||
ui.menuView.SetTitle(qt.QMenuBar_Tr("&View"))
|
ui.menuView.SetTitle(qt.QMenuBar_Tr("&View"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
//go:generate miqt-rcc.sh resources.qrc
|
//go:generate miqt-rcc -Input "resources.qrc" -OutputGo "resources.go" -OutputRcc "resources.rcc" -Qt6
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
|
|
||||||
"github.com/mappu/miqt/qt"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed resources.rcc
|
//go:embed resources.rcc
|
||||||
|
|||||||
BIN
resources.rcc
BIN
resources.rcc
Binary file not shown.
32
util.go
32
util.go
@@ -1,11 +1,18 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"strconv"
|
||||||
|
|
||||||
"github.com/mappu/miqt/qt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getDisplayName(qba []byte) string {
|
||||||
|
if len(qba) ==0 {
|
||||||
|
return "<empty>"
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := strconv.Quote(string(qba))
|
||||||
|
return ret[1 : len(ret)-1]
|
||||||
|
}
|
||||||
|
|
||||||
// ReverseSlice reverses a slice.
|
// ReverseSlice reverses a slice.
|
||||||
// @ref https://stackoverflow.com/a/28058324
|
// @ref https://stackoverflow.com/a/28058324
|
||||||
func ReverseSlice[S ~[]E, E any](s S) {
|
func ReverseSlice[S ~[]E, E any](s S) {
|
||||||
@@ -14,11 +21,20 @@ func ReverseSlice[S ~[]E, E any](s S) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeQByteArray(s string) *qt.QByteArray {
|
// CopySliceAdd copies a slice and adds one more thing on the end.
|
||||||
return qt.NewQByteArray7(s, len(s))
|
func CopySliceAdd[T comparable](base []T, and T) []T {
|
||||||
|
ret := make([]T, len(base)+1)
|
||||||
|
copy(ret, base)
|
||||||
|
ret[len(ret)-1] = and
|
||||||
|
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromQByteArray(qba *qt.QByteArray) string {
|
// Apply creates a new slice where every element of the input arr is transformed.
|
||||||
var rawData []byte = unsafe.Slice((*byte)(qba.Data()), qba.Length())
|
func Apply[T comparable](arr []T, transform func(T) T) []T {
|
||||||
return string(rawData) // copy
|
ret := make([]T, len(arr))
|
||||||
|
for i := 0; i < len(arr); i++ {
|
||||||
|
ret[i] = transform(arr[i])
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user