]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
fix gtk2
authorqydysky <qydysky@foxmail.com>
Sat, 14 Nov 2020 01:57:05 +0000 (09:57 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 14 Nov 2020 01:57:05 +0000 (09:57 +0800)
.github/workflows/test.yml
Reply/F.go
Reply/Msg.go
Reply/Reply.go
Reply/qt.go [deleted file]
_msg_sample/ONLINE_RANK_V2.json
_msg_sample/ROOM_ADMINS.json [new file with mode: 0644]

index 8862ef5ad50efe92b90714ad28801e0ecd9c13ea..08a9298224fda35eebdadc8cfba3b11f975b84c9 100644 (file)
@@ -5,50 +5,49 @@ on:
     branches:
     - '**'
     - '!master'
-    paths:
-    - 'VERSION'
 
 jobs:
-
-  ubuntu_build:
-    name: ubuntu_build
+  u-build:
+    name: build_ubuntu_go${{ matrix.go }}
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go: [ '1.15' ]
     steps:
-
-    - name: Set up Go
+    - name: Set up Go${{ matrix.go }}
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.4
-      id: go
+        go-version: ${{ matrix.go }}
 
     - name: Check out code
       uses: actions/checkout@v2
-        
+    
     - name: Build
       run: |
         sudo apt-get install libgtk-3-dev libcairo2-dev libglib2.0-dev
         go get github.com/gotk3/gotk3@master
-        go build -v -buildmode=exe -o demo/demo.run -tags gtk_3_22 -i demo/main.go
+        go build -v -buildmode=exe -tags gtk_3_22 -o demo/demo.run -i demo/main.go
       
     - name: zip
-      run: zip -q -r release_ubuntu.zip *
+      run: zip -q -r ubuntu_go${{ matrix.go }}.zip *
       
     - name: Upload a Build Artifact
       uses: actions/upload-artifact@v2.2.0
       with:
-        path: ./release_ubuntu.zip
-
-  windows_build:
-    name: windows_build
+        path: ./ubuntu_go${{ matrix.go }}.zip
+        
+  w-build:
+    name: build_windows_go${{ matrix.go }}
     runs-on: windows-latest
+    strategy:
+      matrix:
+        go: [ '1.15' ]
     steps:
-
-    - name: Set up Go
+    - name: Set up Go${{ matrix.go }}
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.4
-      id: go
-
+        go-version: ${{ matrix.go }}
+      
     - name: Set up C
       run: |
         echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
@@ -63,19 +62,17 @@ jobs:
 
     - name: Check out code
       uses: actions/checkout@v2
-
-    - shell: msys2 {0}
+            
+    - name: Build
+      shell: msys2 {0}
       run: |
-        export CGO_LDFLAGS_ALLOW="-Wl.*"
-        export CGO_CFLAGS_ALLOW="-Wl.*"
-        export CGO_CXXFLAGS_ALLOW="-Wl.*"
         go get github.com/gotk3/gotk3@master
-        go build -v -buildmode=exe -o demo/demo.exe -tags gtk_3_22 -i demo/main.go
-
+        go build -v -buildmode=exe -tags gtk_3_22 -o demo/demo.exe -i demo/main.go
+        
     - name: zip
-      run: .\7za.exe a -r .\release_windows.zip ./
-
+      run: .\7za.exe a -r .\windows_go${{ matrix.go }}.zip ./
+      
     - name: Upload a Build Artifact
       uses: actions/upload-artifact@v2.2.0
       with:
-        path: ./release_windows.zip
+        path: ./windows_go${{ matrix.go }}.zip
index 1720dcd3b7950acd53235d583f4bed8bee373fc0..5e555af907545adf2b4b4b7820055339837f921d 100644 (file)
@@ -23,7 +23,6 @@ import (
 
 //功能开关
 var AllF = map[string]bool{
-       "Qtd":false,//Qt弹幕窗口
        "Gtk":false,//Gtk弹幕窗口
        "Saveflv":true,//保存直播流(默认高清,有cookie默认蓝光)
        "Ass":true,//Ass弹幕生成,由于时间对应关系,仅开启流保存时生效
@@ -122,41 +121,6 @@ func Gtkf(){
        Gtk_danmu()
 }
 
-//Qtd 弹幕Qt窗口
-type Qtd struct {
-       Qt_MaxMun int 
-       Qt_LineHeight float64 
-       Qt_BlockMargin float64 
-       Qt_FontSize int 
-       Qt_FontWeight int 
-       Qt_Background []int 
-}
-
-var qtd = Qtd {
-       Qt_MaxMun:30,//danmu max limit
-       Qt_LineHeight:90,//percent
-       Qt_BlockMargin:7,
-       Qt_FontSize:16,//pixel
-       Qt_FontWeight:57,
-       /*
-       QFont__Thin       QFont__Weight = QFont__Weight(0)
-       QFont__ExtraLight QFont__Weight = QFont__Weight(12)
-       QFont__Light      QFont__Weight = QFont__Weight(25)
-       QFont__Normal     QFont__Weight = QFont__Weight(50)
-       QFont__Medium     QFont__Weight = QFont__Weight(57)
-       QFont__DemiBold   QFont__Weight = QFont__Weight(63)
-       QFont__Bold       QFont__Weight = QFont__Weight(75)
-       QFont__ExtraBold  QFont__Weight = QFont__Weight(81)
-       QFont__Black      QFont__Weight = QFont__Weight(87)
-       */
-       Qt_Background:[]int{0, 0, 0, 140},//rgba
-}
-
-func Qtdf(){
-       if !IsOn("Qtd") {return}
-       Qtdanmu()
-}
-
 //Ass 弹幕转字幕
 type Ass struct {
        
index 8404c4d4689e57acbbe09a55a8ea19155ea00871..1944654973b40218bfb56b6761eb647995fd3068 100644 (file)
@@ -12,6 +12,9 @@ var msglog = p.Logf().New().Base(-1, "Msg.go").Open("danmu.log").Level(1)
 
 //Msg类型数据处理方法map
 var Msg_map = map[string]func(replyF, string) {
+       `ROOM_ADMINS`:nil,//房管列表
+       `room_admin_entrance`:nil,
+       `ONLINE_RANK_TOP3`:nil,
        `ONLINE_RANK_COUNT`:nil,
        `ONLINE_RANK_V2`:nil,
        "TRADING_SCORE":nil,//每日任务
index 7ce79063dc010ede1ad242337c3ae17e92483b46..5f25e4d23937b1bd9d0ae8827d190dc1be036d1d 100644 (file)
@@ -562,7 +562,6 @@ func Msg_showdanmu(auth interface{}, m ...string) {
 
 func Gui_show(m ...string){
        //m[0]:msg m[1]:uid
-       if QtOn {QtDanmuChan <- m[0]}
        if Gtk_on {
                if len(m) > 1 {
                        Gtk_danmuChan_uid <- m[1]
diff --git a/Reply/qt.go b/Reply/qt.go
deleted file mode 100644 (file)
index 9f96d5a..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package reply
-
-import (
-       "os"
-       "strconv"
-       "os/signal"
-
-       c "github.com/qydysky/bili_danmu/CV"
-       "github.com/therecipe/qt/core"
-       "github.com/therecipe/qt/gui"
-       "github.com/therecipe/qt/widgets"
-)
-
-var (
-       centralLayout       *widgets.QGridLayout
-       QtDanmuChan chan string
-       QtOn bool
-       Qt_MaxMun int = 30//danmu max limit
-       Qt_LineHeight float64 = 90//percent
-       Qt_BlockMargin float64 = 7
-       Qt_FontSize int = 18
-       Qt_FontWeight int = 63
-       Qt_Background []int = []int{0, 0, 0, 140}//rgba
-)
-
-func Qtdanmu() {
-       if QtOn {return}
-       defer func() {
-               if err := recover(); err != nil {os.Exit(0)}
-       }()
-       Qt_MaxMun = qtd.Qt_MaxMun
-       Qt_LineHeight = qtd.Qt_LineHeight
-       Qt_BlockMargin = qtd.Qt_BlockMargin
-       Qt_FontSize = qtd.Qt_FontSize
-       Qt_FontWeight = qtd.Qt_FontWeight
-       Qt_Background = qtd.Qt_Background
-
-       wq := widgets.NewQApplication(len(os.Args), os.Args)
-
-       //主窗口
-       mainWindow := widgets.NewQMainWindow(nil, 0)
-       mainWindow.SetWindowTitle("danmu")
-       mainWindow.SetSizePolicy2(widgets.QSizePolicy__Maximum, widgets.QSizePolicy__Maximum)
-       mainWindow.SetContentsMargins(0, 0, 0, 0)
-       mainWindow.SetWindowOpacity(1)
-       mainWindow.SetAttribute(core.Qt__WA_TranslucentBackground, true)
-       {
-               Qp := gui.NewQPalette()
-               Qp.SetColor2(gui.QPalette__Background, gui.NewQColor3(0, 0, 0, 0));
-               mainWindow.SetPalette(Qp)
-       }
-
-       centralWidget := widgets.NewQWidget(nil, 0)
-       centralWidget.SetContentsMargins(0, 0, 0, 0)
-       {
-               Qp := gui.NewQPalette()
-               Qp.SetColor2(gui.QPalette__Background, gui.NewQColor3(0, 0, 0, 0));
-               centralWidget.SetPalette(Qp)
-       }
-
-       
-       vbox := widgets.NewQGridLayout(centralWidget)
-       t := new(centralWidget, vbox)
-
-       centralWidget.SetLayout(vbox)
-       mainWindow.SetCentralWidget(centralWidget)
-       mainWindow.ShowNormalDefault()
-       wq.SetActiveWindow(mainWindow)
-       go func(){
-               QtDanmuChan = make(chan string, 10)
-               QtOn = true
-               // var list []string
-               t.TextCursor().InsertText("房间:" + strconv.Itoa(c.Roomid))
-               text(c.Title, t)
-               for QtOn {
-                       select{
-                       case i :=<-QtDanmuChan:
-                               text(i, t)
-                       }
-               }
-       }()
-
-       //ctrl+c退出
-       interrupt := make(chan os.Signal, 1)
-       signal.Notify(interrupt, os.Interrupt)
-       go func(w *widgets.QApplication){
-               <-interrupt
-               close(interrupt)
-               w.CloseAllWindows()
-       }(wq)
-       wq.Exec()
-       QtOn = false
-}
-
-func new(pare *widgets.QWidget, layouts *widgets.QGridLayout) (t *widgets.QTextEdit) {
-       t = widgets.NewQTextEdit(pare)
-       {
-               Qp := gui.NewQPalette()
-               q := Qt_Background
-               Qp.SetColor2(gui.QPalette__Base, gui.NewQColor3(q[0], q[1], q[2], q[3]));
-               t.SetPalette(Qp)
-       }
-       t.SetVerticalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff)
-       t.SetWordWrapMode(gui.QTextOption__WrapAnywhere)
-       // t.SetBackgroundVisible(true)
-       // t.SetMaximumBlockCount(100)
-       t.SetContentsMargins(0, 0, 0, 0)
-       // t.SetCenterOnScroll(false)
-       // t.SetTextInteractionFlags(core.Qt__TextEditable)
-       t.SetReadOnly(true)
-       {
-               t.SetTextBackgroundColor(gui.NewQColor3(0, 0, 0, 0))
-
-               f := gui.NewQFont()
-               f.SetPixelSize(Qt_FontSize)
-               f.SetWeight(Qt_FontWeight)
-               t.SetCurrentFont(f)
-       }
-       {
-               tc := t.TextCursor()
-               b := tc.BlockFormat()
-               b.SetLineHeight(Qt_LineHeight, int(gui.QTextBlockFormat__ProportionalHeight))
-               b.SetBottomMargin(Qt_BlockMargin)
-               tc.SetBlockFormat(b)
-               t.SetTextCursor(tc)
-       }
-       layouts.AddWidget2(t, layouts.RowCount(), 0, 0)
-       return
-}
-
-func text(s string, pare *widgets.QTextEdit) {
-       c := pare.TextCursor()
-       if c.HasSelection() {return}//用户选择,暂停
-       c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
-       c.InsertBlock()
-       c.BeginEditBlock()
-       c.InsertText(s)
-       c.EndEditBlock()
-       if pare.Document().BlockCount() > Qt_MaxMun {
-               c.MovePosition(gui.QTextCursor__Start, gui.QTextCursor__MoveAnchor, 1)
-               // c.BeginEditBlock()
-               c.MovePosition(gui.QTextCursor__NextBlock, gui.QTextCursor__KeepAnchor, 1)
-               // c.Select(gui.QTextCursor__BlockUnderCursor)
-               c.RemoveSelectedText()
-               // c.EndEditBlock()
-               c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
-       }
-       // t := pare.ToPlainText()
-       pare.SetTextCursor(c)
-
-       pare.EnsureCursorVisible()
-       // pare.SetPlainText(s + "\n" + t)
-}
index bed42410eac118e656b02708b5e84d26f3c6a044..ed98acbba94fde07a408d4c6233fa983a500d68a 100644 (file)
                 }
             ]
         }
+    },
+    {
+        "cmd": "ONLINE_RANK_TOP3",
+        "data": {
+            "list": [
+                {
+                    "msg": "恭喜 \u003c%子绝四毋%\u003e 成为高能榜",
+                    "rank": 3
+                }
+            ]
+        }
     }
 ]
\ No newline at end of file
diff --git a/_msg_sample/ROOM_ADMINS.json b/_msg_sample/ROOM_ADMINS.json
new file mode 100644 (file)
index 0000000..1f5e7d2
--- /dev/null
@@ -0,0 +1,41 @@
+[
+    {
+        "cmd": "room_admin_entrance",
+        "msg": "系统提示:你已被主播设为房管",
+        "uid": 182503
+    },
+    {
+        "cmd": "ROOM_ADMINS",
+        "uids": [
+            1576121,
+            111644,
+            1990717,
+            401952676,
+            1315413,
+            44463,
+            4921807,
+            2637153,
+            674789,
+            68429348,
+            4288592,
+            10800855,
+            10803266,
+            525105971,
+            2299184,
+            76207,
+            290807761,
+            534023,
+            7659954,
+            1427846,
+            11408689,
+            177014464,
+            198573,
+            42561463,
+            250162373,
+            2058981,
+            653811,
+            41796,
+            182503
+        ]
+    }
+]
\ No newline at end of file