Merge pull request #957 from AttorneyOnline/kaleidoscope
The Kaleidoscope - Hell, it's about time.
@ -1,5 +1,73 @@
 | 
			
		||||
Language: Cpp
 | 
			
		||||
BasedOnStyle: LLVM
 | 
			
		||||
BreakBeforeBraces: Stroustrup
 | 
			
		||||
AllowShortIfStatementsOnASingleLine: true
 | 
			
		||||
NamespaceIndentation: All
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
AccessModifierOffset: -2
 | 
			
		||||
AlignConsecutiveAssignments: false
 | 
			
		||||
AlignConsecutiveDeclarations: false
 | 
			
		||||
AlignEscapedNewlines: Left
 | 
			
		||||
AlignTrailingComments: true
 | 
			
		||||
AllowShortBlocksOnASingleLine: Empty
 | 
			
		||||
AllowShortEnumsOnASingleLine: false
 | 
			
		||||
AllowShortFunctionsOnASingleLine: InlineOnly
 | 
			
		||||
AllowShortIfStatementsOnASingleLine : Never
 | 
			
		||||
AllowShortLambdasOnASingleLine: Inline
 | 
			
		||||
AllowShortLoopsOnASingleLine: false
 | 
			
		||||
AlwaysBreakAfterReturnType: None
 | 
			
		||||
AlwaysBreakTemplateDeclarations: Yes
 | 
			
		||||
BinPackArguments: false
 | 
			
		||||
BinPackParameters: false
 | 
			
		||||
BreakBeforeConceptDeclarations: Always
 | 
			
		||||
BreakBeforeTernaryOperators: true
 | 
			
		||||
BreakConstructorInitializers: BeforeComma
 | 
			
		||||
ColumnLimit: 486
 | 
			
		||||
CompactNamespaces: false
 | 
			
		||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
 | 
			
		||||
FixNamespaceComments: true
 | 
			
		||||
IncludeBlocks: Preserve
 | 
			
		||||
IndentCaseBlocks: false
 | 
			
		||||
IndentCaseLabels: false
 | 
			
		||||
IndentRequiresClause: false
 | 
			
		||||
IndentWidth: 2
 | 
			
		||||
InsertTrailingCommas: Wrapped
 | 
			
		||||
KeepEmptyLinesAtTheStartOfBlocks: false
 | 
			
		||||
LambdaBodyIndentation: OuterScope
 | 
			
		||||
MaxEmptyLinesToKeep: 1
 | 
			
		||||
NamespaceIndentation: None
 | 
			
		||||
PackConstructorInitializers: Never
 | 
			
		||||
PointerAlignment: Right
 | 
			
		||||
QualifierAlignment: Left
 | 
			
		||||
RequiresExpressionIndentation: OuterScope
 | 
			
		||||
ShortNamespaceLines: 0
 | 
			
		||||
SortUsingDeclarations: true
 | 
			
		||||
SpaceAfterCStyleCast: false
 | 
			
		||||
SpaceAfterTemplateKeyword: true
 | 
			
		||||
SpaceBeforeAssignmentOperators: true
 | 
			
		||||
SpaceBeforeCpp11BracedList: false
 | 
			
		||||
SpaceBeforeCtorInitializerColon: true
 | 
			
		||||
SpaceBeforeInheritanceColon: true
 | 
			
		||||
SpaceBeforeParens: ControlStatements
 | 
			
		||||
SpaceBeforeRangeBasedForLoopColon: true
 | 
			
		||||
SpaceInEmptyParentheses: false
 | 
			
		||||
SpacesInAngles: false
 | 
			
		||||
SpacesInCStyleCastParentheses: false
 | 
			
		||||
SpacesInContainerLiterals: false
 | 
			
		||||
SpacesInParentheses: false
 | 
			
		||||
SpacesInSquareBrackets: false
 | 
			
		||||
 | 
			
		||||
BreakBeforeBraces: Custom
 | 
			
		||||
BraceWrapping:
 | 
			
		||||
    AfterCaseLabel: true
 | 
			
		||||
    AfterClass: true
 | 
			
		||||
    AfterControlStatement: true
 | 
			
		||||
    AfterEnum: true
 | 
			
		||||
    AfterFunction: true
 | 
			
		||||
    AfterNamespace: true
 | 
			
		||||
    AfterStruct: true
 | 
			
		||||
    AfterUnion: true
 | 
			
		||||
    AfterExternBlock: true
 | 
			
		||||
    BeforeCatch: true
 | 
			
		||||
    BeforeElse: true
 | 
			
		||||
    IndentBraces: false
 | 
			
		||||
    SplitEmptyFunction: false
 | 
			
		||||
    SplitEmptyRecord: false
 | 
			
		||||
    SplitEmptyNamespace: false
 | 
			
		||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						@ -39,3 +39,4 @@ object_script*
 | 
			
		||||
/attorney_online_*_plugin_import.cpp
 | 
			
		||||
server/__pycache__
 | 
			
		||||
discord/
 | 
			
		||||
*.TMP
 | 
			
		||||
 | 
			
		||||
@ -1,79 +0,0 @@
 | 
			
		||||
QT += core gui widgets network websockets uitools
 | 
			
		||||
 | 
			
		||||
TARGET = Attorney_Online
 | 
			
		||||
TEMPLATE = app
 | 
			
		||||
 | 
			
		||||
VERSION = 2.10.1.0
 | 
			
		||||
 | 
			
		||||
INCLUDEPATH += $$PWD/include
 | 
			
		||||
DESTDIR = $$PWD/bin
 | 
			
		||||
OBJECTS_DIR = $$PWD/build
 | 
			
		||||
MOC_DIR = $$PWD/build
 | 
			
		||||
 | 
			
		||||
SOURCES += $$files($$PWD/src/*.cpp, true)
 | 
			
		||||
HEADERS += $$files($$PWD/include/*.h, true)
 | 
			
		||||
 | 
			
		||||
FORMS += $$files($$PWD/resource/ui/*.ui)
 | 
			
		||||
 | 
			
		||||
LIBS += -L$$PWD/lib
 | 
			
		||||
QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN/lib'"
 | 
			
		||||
QMAKE_CXXFLAGS += "-fno-sized-deallocation"
 | 
			
		||||
 | 
			
		||||
# Uncomment for verbose network logging
 | 
			
		||||
# DEFINES += DEBUG_NETWORK
 | 
			
		||||
 | 
			
		||||
# Uncomment for verbose animation logging
 | 
			
		||||
# DEFINES += DEBUG_MOVIE
 | 
			
		||||
 | 
			
		||||
# Uncomment for building with debug symbols
 | 
			
		||||
# CONFIG += debug
 | 
			
		||||
 | 
			
		||||
# Uncomment to enable Discord Rich Presence
 | 
			
		||||
# DEFINES += DISCORD
 | 
			
		||||
 | 
			
		||||
contains(DEFINES, DISCORD) {
 | 
			
		||||
  win32:LIBS            += -ldiscord-rpc
 | 
			
		||||
  linux:!android:LIBS   += -ldiscord-rpc
 | 
			
		||||
  mac:LIBS              += -ldiscord-rpc
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# As of 2.8.5, BASS and BASSOPUS are required for all platforms. Qt Multimedia
 | 
			
		||||
# is no longer an option due to outdated code and lack of versatility.
 | 
			
		||||
# Download at un4seen.com and place the DLLs in the "lib" and "bin" folders.
 | 
			
		||||
DEFINES += BASSAUDIO
 | 
			
		||||
LIBS += -lbass
 | 
			
		||||
LIBS += -lbassopus
 | 
			
		||||
LIBS += -lbassmidi
 | 
			
		||||
 | 
			
		||||
macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
 | 
			
		||||
 | 
			
		||||
win32:LIBS += -ladvapi32
 | 
			
		||||
 | 
			
		||||
CONFIG += c++17
 | 
			
		||||
 | 
			
		||||
RESOURCES += resources.qrc
 | 
			
		||||
 | 
			
		||||
TRANSLATIONS = resource/translations/ao_en.ts \
 | 
			
		||||
               resource/translations/ao_jp.ts \
 | 
			
		||||
               resource/translations/ao_de.ts \
 | 
			
		||||
               resource/translations/ao_ru.ts \
 | 
			
		||||
               resource/translations/ao_es.ts \
 | 
			
		||||
               resource/translations/ao_pt.ts \
 | 
			
		||||
               resource/translations/ao_pl.ts \
 | 
			
		||||
               resource/translations/ao_it.ts \
 | 
			
		||||
               ressource/ui/
 | 
			
		||||
 | 
			
		||||
win32:RC_ICONS = resource/logo_ao2.ico
 | 
			
		||||
macx:ICON = resource/logo_ao2.icns
 | 
			
		||||
 | 
			
		||||
android:QT += androidextras
 | 
			
		||||
 | 
			
		||||
android:DISTFILES += \
 | 
			
		||||
    android/AndroidManifest.xml \
 | 
			
		||||
    android/gradle.properties \
 | 
			
		||||
    android/gradle/wrapper/gradle-wrapper.jar \
 | 
			
		||||
    android/gradle/wrapper/gradle-wrapper.properties \
 | 
			
		||||
    android/gradlew \
 | 
			
		||||
    android/gradlew.bat
 | 
			
		||||
 | 
			
		||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
 | 
			
		||||
							
								
								
									
										137
									
								
								CMakeLists.txt
									
									
									
									
									
								
							
							
						
						@ -1,8 +1,6 @@
 | 
			
		||||
# Configure cmake
 | 
			
		||||
cmake_minimum_required(VERSION 3.1.0)
 | 
			
		||||
cmake_policy(SET CMP0076 NEW) # silence warning
 | 
			
		||||
cmake_minimum_required(VERSION 3.7.0)
 | 
			
		||||
 | 
			
		||||
project(AttorneyOnline)
 | 
			
		||||
project(AttorneyOnline VERSION 2.11.0.0 LANGUAGES CXX C)
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CXX_STANDARD 20)
 | 
			
		||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 | 
			
		||||
@ -11,39 +9,118 @@ set(CMAKE_AUTOMOC ON)
 | 
			
		||||
set(CMAKE_AUTORCC ON)
 | 
			
		||||
set(CMAKE_AUTOUIC ON)
 | 
			
		||||
 | 
			
		||||
if(CMAKE_VERSION VERSION_LESS "3.7.0")
 | 
			
		||||
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
 | 
			
		||||
endif()
 | 
			
		||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
 | 
			
		||||
 | 
			
		||||
# AO
 | 
			
		||||
add_executable(Attorney_Online resources.qrc)
 | 
			
		||||
option(AO_BUILD_TESTS "Build test programs" ON)
 | 
			
		||||
option(AO_ENABLE_DISCORD_RPC "Enable Discord Rich Presence" ON)
 | 
			
		||||
 | 
			
		||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
 | 
			
		||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Network Widgets Concurrent WebSockets UiTools)
 | 
			
		||||
 | 
			
		||||
add_executable(Attorney_Online
 | 
			
		||||
  src/aoapplication.cpp
 | 
			
		||||
  src/aoapplication.h
 | 
			
		||||
  src/aoblipplayer.cpp
 | 
			
		||||
  src/aoblipplayer.h
 | 
			
		||||
  src/aobutton.cpp
 | 
			
		||||
  src/aobutton.h
 | 
			
		||||
  src/aocharbutton.cpp
 | 
			
		||||
  src/aocharbutton.h
 | 
			
		||||
  src/aoclocklabel.cpp
 | 
			
		||||
  src/aoclocklabel.h
 | 
			
		||||
  src/aoemotebutton.cpp
 | 
			
		||||
  src/aoemotebutton.h
 | 
			
		||||
  src/aoemotepreview.cpp
 | 
			
		||||
  src/aoemotepreview.h
 | 
			
		||||
  src/aoevidencebutton.cpp
 | 
			
		||||
  src/aoevidencebutton.h
 | 
			
		||||
  src/aoevidencedisplay.cpp
 | 
			
		||||
  src/aoevidencedisplay.h
 | 
			
		||||
  src/aoimage.cpp
 | 
			
		||||
  src/aoimage.h
 | 
			
		||||
  src/aolayer.cpp
 | 
			
		||||
  src/aolayer.h
 | 
			
		||||
  src/aomusicplayer.cpp
 | 
			
		||||
  src/aomusicplayer.h
 | 
			
		||||
  src/aopacket.cpp
 | 
			
		||||
  src/aopacket.h
 | 
			
		||||
  src/aosfxplayer.cpp
 | 
			
		||||
  src/aosfxplayer.h
 | 
			
		||||
  src/aotextarea.cpp
 | 
			
		||||
  src/aotextarea.h
 | 
			
		||||
  src/aotextboxwidgets.cpp
 | 
			
		||||
  src/aotextboxwidgets.h
 | 
			
		||||
  src/aoutils.cpp
 | 
			
		||||
  src/aoutils.h
 | 
			
		||||
  src/charselect.cpp
 | 
			
		||||
  src/chatlogpiece.cpp
 | 
			
		||||
  src/chatlogpiece.h
 | 
			
		||||
  src/courtroom.cpp
 | 
			
		||||
  src/courtroom.h
 | 
			
		||||
  src/datatypes.h
 | 
			
		||||
  src/debug_functions.cpp
 | 
			
		||||
  src/debug_functions.h
 | 
			
		||||
  src/demoserver.cpp
 | 
			
		||||
  src/demoserver.h
 | 
			
		||||
  src/discord_rich_presence.cpp
 | 
			
		||||
  src/discord_rich_presence.h
 | 
			
		||||
  src/emotes.cpp
 | 
			
		||||
  src/eventfilters.cpp
 | 
			
		||||
  src/eventfilters.h
 | 
			
		||||
  src/evidence.cpp
 | 
			
		||||
  src/file_functions.cpp
 | 
			
		||||
  src/file_functions.h
 | 
			
		||||
  src/gui_utils.h
 | 
			
		||||
  src/hardware_functions.cpp
 | 
			
		||||
  src/hardware_functions.h
 | 
			
		||||
  src/lobby.cpp
 | 
			
		||||
  src/lobby.h
 | 
			
		||||
  src/main.cpp
 | 
			
		||||
  src/net/netconnection.cpp
 | 
			
		||||
  src/net/netconnection.h
 | 
			
		||||
  src/net/nettcpconnection.cpp
 | 
			
		||||
  src/net/nettcpconnection.h
 | 
			
		||||
  src/net/netwebsocketconnection.cpp
 | 
			
		||||
  src/net/netwebsocketconnection.h
 | 
			
		||||
  src/networkmanager.cpp
 | 
			
		||||
  src/networkmanager.h
 | 
			
		||||
  src/options.cpp
 | 
			
		||||
  src/options.h
 | 
			
		||||
  src/packet_distribution.cpp
 | 
			
		||||
  src/path_functions.cpp
 | 
			
		||||
  src/scrolltext.cpp
 | 
			
		||||
  src/scrolltext.h
 | 
			
		||||
  src/serverdata.cpp
 | 
			
		||||
  src/serverdata.h
 | 
			
		||||
  src/text_file_functions.cpp
 | 
			
		||||
  src/widgets/aooptionsdialog.cpp
 | 
			
		||||
  src/widgets/aooptionsdialog.h
 | 
			
		||||
  src/widgets/direct_connect_dialog.cpp
 | 
			
		||||
  src/widgets/direct_connect_dialog.h
 | 
			
		||||
  src/widgets/server_editor_dialog.cpp
 | 
			
		||||
  src/widgets/server_editor_dialog.h
 | 
			
		||||
  data.qrc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set_target_properties(Attorney_Online PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
 | 
			
		||||
 | 
			
		||||
# WIN32
 | 
			
		||||
if(WIN32)
 | 
			
		||||
    if(CMAKE_BUILD_TYPE STREQUAL "Release")
 | 
			
		||||
        set_property(TARGET Attorney_Online PROPERTY WIN32_EXECUTABLE true)
 | 
			
		||||
        set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/resource/logo_ao2.rc")
 | 
			
		||||
        target_sources(Attorney_Online PRIVATE ${APP_ICON_RESOURCE_WINDOWS})
 | 
			
		||||
    endif()
 | 
			
		||||
  if(CMAKE_BUILD_TYPE STREQUAL "Release")
 | 
			
		||||
    set_property(TARGET Attorney_Online PROPERTY WIN32_EXECUTABLE true)
 | 
			
		||||
    set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/data/logo-client.rc")
 | 
			
		||||
    target_sources(Attorney_Online PRIVATE ${APP_ICON_RESOURCE_WINDOWS})
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Target Include
 | 
			
		||||
target_include_directories(Attorney_Online PRIVATE include)
 | 
			
		||||
 | 
			
		||||
# Target Lib
 | 
			
		||||
find_package(Qt5 COMPONENTS Core Gui Network Widgets Concurrent WebSockets REQUIRED)
 | 
			
		||||
target_include_directories(Attorney_Online PRIVATE src lib)
 | 
			
		||||
target_link_directories(Attorney_Online PRIVATE lib)
 | 
			
		||||
target_link_libraries(Attorney_Online PRIVATE Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets Qt5::Concurrent
 | 
			
		||||
    Qt5::WebSockets bass bassmidi bassopus discord-rpc)
 | 
			
		||||
target_compile_definitions(Attorney_Online PRIVATE DISCORD)
 | 
			
		||||
target_link_libraries(Attorney_Online PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::WebSockets Qt${QT_VERSION_MAJOR}::UiTools bass bassopus bassmidi)
 | 
			
		||||
 | 
			
		||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 | 
			
		||||
    target_link_libraries(Attorney_Online PRIVATE "-framework CoreFoundation" "-framework Foundation" "-framework CoreServices")
 | 
			
		||||
if(AO_ENABLE_DISCORD_RPC)
 | 
			
		||||
  target_compile_definitions(Attorney_Online PRIVATE AO_ENABLE_DISCORD_RPC)
 | 
			
		||||
  target_link_libraries(Attorney_Online PRIVATE discord-rpc)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Subdirectories
 | 
			
		||||
if (AO_BUILD_TESTS)
 | 
			
		||||
    add_subdirectory(test)
 | 
			
		||||
if(AO_BUILD_TESTS)
 | 
			
		||||
  add_subdirectory(test)
 | 
			
		||||
endif()
 | 
			
		||||
add_subdirectory(src)
 | 
			
		||||
add_subdirectory(include)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								data.qrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,19 @@
 | 
			
		||||
<RCC>
 | 
			
		||||
    <qresource prefix="/">
 | 
			
		||||
        <file>data/fonts/Ace-Attorney.ttf</file>
 | 
			
		||||
        <file>data/logo-client.png</file>
 | 
			
		||||
        <file>data/translations/ao_de.qm</file>
 | 
			
		||||
        <file>data/translations/ao_en.qm</file>
 | 
			
		||||
        <file>data/translations/ao_es.qm</file>
 | 
			
		||||
        <file>data/translations/ao_jp.qm</file>
 | 
			
		||||
        <file>data/translations/ao_pl.qm</file>
 | 
			
		||||
        <file>data/translations/ao_pt.qm</file>
 | 
			
		||||
        <file>data/translations/ao_ru.qm</file>
 | 
			
		||||
        <file>data/ui/options_dialog.ui</file>
 | 
			
		||||
        <file>data/ui/favorite_server_dialog.ui</file>
 | 
			
		||||
        <file>data/ui/direct_connect_dialog.ui</file>
 | 
			
		||||
        <file>data/ui/lobby.ui</file>
 | 
			
		||||
        <file>data/ui/lobby_assets/down-arrow.png</file>
 | 
			
		||||
        <file>data/ui/lobby_assets/up-arrow.png</file>
 | 
			
		||||
    </qresource>
 | 
			
		||||
</RCC>
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB  | 
| 
		 Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB  | 
							
								
								
									
										1
									
								
								data/logo-client.rc
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1 @@
 | 
			
		||||
IDI_ICON1               ICON    "logo-client.ico"
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 382 KiB  | 
| 
		 Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB  | 
| 
		 Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB  | 
| 
		 Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB  | 
| 
		 Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB  | 
| 
		 Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB  | 
| 
		 Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 169 KiB  | 
| 
		 Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 169 KiB  | 
| 
		 Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 382 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB  | 
@ -23,17 +23,17 @@
 | 
			
		||||
   <item row="2" column="0">
 | 
			
		||||
    <layout class="QHBoxLayout" name="server_legacy_layout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="server_legacy_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Legacy Entry :</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLineEdit" name="server_legacy_edit"/>
 | 
			
		||||
      <widget class="QLineEdit" name="legacy_edit"/>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QPushButton" name="server_legacy_load_button">
 | 
			
		||||
      <widget class="QPushButton" name="parse_legacy">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Convert</string>
 | 
			
		||||
       </property>
 | 
			
		||||
@ -44,48 +44,48 @@
 | 
			
		||||
   <item row="0" column="0">
 | 
			
		||||
    <layout class="QFormLayout" name="server_new_layout">
 | 
			
		||||
     <item row="0" column="0">
 | 
			
		||||
      <widget class="QLabel" name="server_display_name_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label_3">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Display Name:</string>
 | 
			
		||||
        <string>Name:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="0" column="1">
 | 
			
		||||
      <widget class="QLineEdit" name="server_display_name_edit"/>
 | 
			
		||||
      <widget class="QLineEdit" name="name"/>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="1" column="0">
 | 
			
		||||
      <widget class="QLabel" name="server_hostname_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label_4">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Hostname :</string>
 | 
			
		||||
        <string>Hostname:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="1" column="1">
 | 
			
		||||
      <widget class="QLineEdit" name="server_hostname_edit"/>
 | 
			
		||||
      <widget class="QLineEdit" name="hostname"/>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="2" column="0">
 | 
			
		||||
      <widget class="QLabel" name="server_port_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label_5">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Port:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="2" column="1">
 | 
			
		||||
      <widget class="QSpinBox" name="server_port_box">
 | 
			
		||||
      <widget class="QSpinBox" name="port">
 | 
			
		||||
       <property name="maximum">
 | 
			
		||||
        <number>65535</number>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="3" column="0">
 | 
			
		||||
      <widget class="QLabel" name="server_protocol_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label_6">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Protocol :</string>
 | 
			
		||||
        <string>Protocol:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="3" column="1">
 | 
			
		||||
      <widget class="QComboBox" name="server_protocol_box">
 | 
			
		||||
      <widget class="QComboBox" name="protocol">
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>TCP</string>
 | 
			
		||||
@ -99,14 +99,14 @@
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="4" column="0">
 | 
			
		||||
      <widget class="QLabel" name="server_description_lbl">
 | 
			
		||||
      <widget class="QLabel" name="label_2">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Description:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="4" column="1">
 | 
			
		||||
      <widget class="QPlainTextEdit" name="server_description_edit">
 | 
			
		||||
      <widget class="QPlainTextEdit" name="description">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
 | 
			
		||||
         <horstretch>0</horstretch>
 | 
			
		||||
@ -118,7 +118,7 @@
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="1" column="0">
 | 
			
		||||
    <widget class="Line" name="server_legacy_bar">
 | 
			
		||||
    <widget class="Line" name="line">
 | 
			
		||||
     <property name="frameShadow">
 | 
			
		||||
      <enum>QFrame::Plain</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
@ -128,7 +128,7 @@
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="3" column="0">
 | 
			
		||||
    <widget class="QDialogButtonBox" name="server_dialog_button">
 | 
			
		||||
    <widget class="QDialogButtonBox" name="button_box">
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
 | 
			
		||||
     </property>
 | 
			
		||||
@ -107,12 +107,12 @@ QHeaderView::section:pressed {
 | 
			
		||||
 | 
			
		||||
QHeaderView::up-arrow
 | 
			
		||||
{
 | 
			
		||||
    image: url(":/resource/ui/lobby_assets/up-arrow.png");
 | 
			
		||||
    image: url(":/data/ui/lobby_assets/up-arrow.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QHeaderView::down-arrow
 | 
			
		||||
{
 | 
			
		||||
    image: url(":/resource/ui/lobby_assets/down-arrow.png");
 | 
			
		||||
    image: url(":/data/ui/lobby_assets/down-arrow.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QScrollBar:vertical {
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B  | 
| 
		 Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B  | 
@ -1,40 +0,0 @@
 | 
			
		||||
target_sources(Attorney_Online PRIVATE
 | 
			
		||||
aoapplication.h
 | 
			
		||||
aoblipplayer.h
 | 
			
		||||
aobutton.h
 | 
			
		||||
aocaseannouncerdialog.h
 | 
			
		||||
aocharbutton.h
 | 
			
		||||
aoclocklabel.h
 | 
			
		||||
aoemotebutton.h
 | 
			
		||||
aoemotepreview.h
 | 
			
		||||
aoevidencebutton.h
 | 
			
		||||
aoevidencedisplay.h
 | 
			
		||||
aoimage.h
 | 
			
		||||
aolayer.h
 | 
			
		||||
aomusicplayer.h
 | 
			
		||||
aooptionsdialog.h
 | 
			
		||||
aopacket.h
 | 
			
		||||
aosfxplayer.h
 | 
			
		||||
aotextarea.h
 | 
			
		||||
aoutils.h
 | 
			
		||||
bass.h
 | 
			
		||||
bassmidi.h
 | 
			
		||||
bassopus.h
 | 
			
		||||
chatlogpiece.h
 | 
			
		||||
courtroom.h
 | 
			
		||||
datatypes.h
 | 
			
		||||
debug_functions.h
 | 
			
		||||
demoserver.h
 | 
			
		||||
discord-rpc.h
 | 
			
		||||
discord_register.h
 | 
			
		||||
discord_rich_presence.h
 | 
			
		||||
discord_rpc.h
 | 
			
		||||
eventfilters.h
 | 
			
		||||
file_functions.h
 | 
			
		||||
hardware_functions.h
 | 
			
		||||
lobby.h
 | 
			
		||||
misc_functions.h
 | 
			
		||||
networkmanager.h
 | 
			
		||||
scrolltext.h
 | 
			
		||||
text_file_functions.h
 | 
			
		||||
)
 | 
			
		||||
@ -1,37 +0,0 @@
 | 
			
		||||
#ifndef AOBLIPPLAYER_H
 | 
			
		||||
#define AOBLIPPLAYER_H
 | 
			
		||||
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
#include "bassopus.h"
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QElapsedTimer>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
class AOBlipPlayer {
 | 
			
		||||
public:
 | 
			
		||||
  AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
 | 
			
		||||
  void set_blips(QString p_sfx);
 | 
			
		||||
  void blip_tick();
 | 
			
		||||
  void set_volume(int p_volume);
 | 
			
		||||
  void set_muted(bool toggle);
 | 
			
		||||
 | 
			
		||||
  int m_cycle = 0;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  qreal m_volume;
 | 
			
		||||
 | 
			
		||||
  bool m_muted = false;
 | 
			
		||||
 | 
			
		||||
  void set_volume_internal(qreal p_volume);
 | 
			
		||||
 | 
			
		||||
  HSTREAM m_stream_list[5];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOBLIPPLAYER_H
 | 
			
		||||
@ -1,23 +0,0 @@
 | 
			
		||||
#ifndef AOBUTTON_H
 | 
			
		||||
#define AOBUTTON_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
 | 
			
		||||
class AOButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOButton(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
  ~AOButton();
 | 
			
		||||
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QMovie *movie;
 | 
			
		||||
 | 
			
		||||
  void set_image(QString p_image, QString p_misc="");
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOBUTTON_H
 | 
			
		||||
@ -1,49 +0,0 @@
 | 
			
		||||
#ifndef AOCHARBUTTON_H
 | 
			
		||||
#define AOCHARBUTTON_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QEnterEvent>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
class AOCharButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos,
 | 
			
		||||
               bool is_taken);
 | 
			
		||||
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  void refresh();
 | 
			
		||||
  void reset();
 | 
			
		||||
  void set_taken(bool is_taken);
 | 
			
		||||
  void set_passworded();
 | 
			
		||||
 | 
			
		||||
  void apply_taken_image();
 | 
			
		||||
 | 
			
		||||
  void set_image(QString p_character);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  bool taken;
 | 
			
		||||
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
 | 
			
		||||
  AOImage *ui_taken;
 | 
			
		||||
  AOImage *ui_passworded;
 | 
			
		||||
  AOImage *ui_selector;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
  void enterEvent(QEvent *e) override;
 | 
			
		||||
#else
 | 
			
		||||
  void enterEvent(QEnterEvent *e) override;
 | 
			
		||||
#endif
 | 
			
		||||
  void leaveEvent(QEvent *e) override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOCHARBUTTON_H
 | 
			
		||||
@ -1,38 +0,0 @@
 | 
			
		||||
#ifndef AOEMOTEBUTTON_H
 | 
			
		||||
#define AOEMOTEBUTTON_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include <QPainter>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
 | 
			
		||||
class AOEmoteButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y,
 | 
			
		||||
                int p_w, int p_h);
 | 
			
		||||
 | 
			
		||||
  void set_image(QString p_image, QString p_emote_comment);
 | 
			
		||||
  void set_char_image(QString p_char, int p_emote, bool on);
 | 
			
		||||
 | 
			
		||||
  void set_selected_image(QString p_image);
 | 
			
		||||
 | 
			
		||||
  void set_id(int p_id) { m_id = p_id; }
 | 
			
		||||
  int get_id() { return m_id; }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *parent;
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QLabel *ui_selected = nullptr;
 | 
			
		||||
 | 
			
		||||
  int m_id = 0;
 | 
			
		||||
signals:
 | 
			
		||||
  void emote_clicked(int p_id);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void on_clicked();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOEMOTEBUTTON_H
 | 
			
		||||
@ -1,32 +0,0 @@
 | 
			
		||||
#ifndef AOEMOTEPREVIEW_H
 | 
			
		||||
#define AOEMOTEPREVIEW_H
 | 
			
		||||
 | 
			
		||||
#include "aolayer.h"
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
class AOEmotePreview : public QWidget
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  AOEmotePreview(QWidget *parent = nullptr,
 | 
			
		||||
                 AOApplication *p_ao_app = nullptr);
 | 
			
		||||
 | 
			
		||||
  void set_widgets();
 | 
			
		||||
  void play(QString emote, QString char_name, bool flipped = false, int self_offset = 0, int self_offset_v = 0);
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QWidget *ui_viewport;
 | 
			
		||||
  BackgroundLayer *ui_vp_background;
 | 
			
		||||
  SplashLayer *ui_vp_speedlines;
 | 
			
		||||
  CharLayer *ui_vp_player_char;
 | 
			
		||||
  BackgroundLayer *ui_vp_desk;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_size_label;
 | 
			
		||||
 | 
			
		||||
  QString m_emote = "";
 | 
			
		||||
  QString m_char = "";
 | 
			
		||||
protected:
 | 
			
		||||
  void resizeEvent(QResizeEvent *);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOEMOTEPREVIEW_H
 | 
			
		||||
@ -1,56 +0,0 @@
 | 
			
		||||
#ifndef AOEVIDENCEBUTTON_H
 | 
			
		||||
#define AOEVIDENCEBUTTON_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QEnterEvent>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class AOEvidenceButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y,
 | 
			
		||||
                   int p_w, int p_h);
 | 
			
		||||
 | 
			
		||||
  void set_image(QString p_image);
 | 
			
		||||
  void set_theme_image(QString p_image);
 | 
			
		||||
  void set_id(int p_id) { m_id = p_id; }
 | 
			
		||||
 | 
			
		||||
  void set_selected(bool p_selected);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
 | 
			
		||||
  AOImage *ui_selected;
 | 
			
		||||
  AOImage *ui_selector;
 | 
			
		||||
 | 
			
		||||
  int m_id = 0;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
  void enterEvent(QEvent *e) override;
 | 
			
		||||
#else
 | 
			
		||||
  void enterEvent(QEnterEvent *e) override;
 | 
			
		||||
#endif
 | 
			
		||||
  void leaveEvent(QEvent *e) override;
 | 
			
		||||
  void mouseDoubleClickEvent(QMouseEvent *e) override;
 | 
			
		||||
  /*
 | 
			
		||||
void dragLeaveEvent(QMouseEvent *e);
 | 
			
		||||
void dragEnterEvent(QMouseEvent *e);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
  void evidence_clicked(int p_id);
 | 
			
		||||
  void evidence_double_clicked(int p_id);
 | 
			
		||||
  void on_hover(int p_id, bool p_state);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void on_clicked();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOEVIDENCEBUTTON_H
 | 
			
		||||
@ -1,31 +0,0 @@
 | 
			
		||||
// This class represents a static theme-dependent image
 | 
			
		||||
 | 
			
		||||
#ifndef AOIMAGE_H
 | 
			
		||||
#define AOIMAGE_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
 | 
			
		||||
class AOImage : public QLabel {
 | 
			
		||||
public:
 | 
			
		||||
  AOImage(QWidget *parent, AOApplication *p_ao_app, bool make_static = false);
 | 
			
		||||
  ~AOImage();
 | 
			
		||||
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QMovie *movie;
 | 
			
		||||
 | 
			
		||||
  QString path;
 | 
			
		||||
 | 
			
		||||
  bool is_static = false;
 | 
			
		||||
 | 
			
		||||
  bool masked = false;
 | 
			
		||||
 | 
			
		||||
  bool set_image(QString p_image, QString p_misc = "");
 | 
			
		||||
  void set_size_and_pos(QString identifier);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOIMAGE_H
 | 
			
		||||
@ -1,53 +0,0 @@
 | 
			
		||||
#ifndef AOMUSICPLAYER_H
 | 
			
		||||
#define AOMUSICPLAYER_H
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <QFuture>
 | 
			
		||||
#include <QFutureWatcher>
 | 
			
		||||
 | 
			
		||||
class AOMusicPlayer {
 | 
			
		||||
public:
 | 
			
		||||
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
  virtual ~AOMusicPlayer();
 | 
			
		||||
  void set_volume(int p_value, int channel = -1);
 | 
			
		||||
  void set_looping(bool loop_song, int channel = 0);
 | 
			
		||||
  void set_muted(bool toggle);
 | 
			
		||||
 | 
			
		||||
  const int m_channelmax = 4;
 | 
			
		||||
 | 
			
		||||
  QFutureWatcher<QString> music_watcher;
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  QString play(QString p_song, int channel = 0, bool loop = false,
 | 
			
		||||
            int effect_flags = 0);
 | 
			
		||||
  void stop(int channel = 0);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  bool m_muted = false;
 | 
			
		||||
  int m_volume[4] = {0, 0, 0, 0};
 | 
			
		||||
 | 
			
		||||
  // Channel 0 = music
 | 
			
		||||
  // Channel 1 = ambience
 | 
			
		||||
  // Channel 2 = extra
 | 
			
		||||
  // Channel 3 = extra
 | 
			
		||||
  HSTREAM m_stream_list[4];
 | 
			
		||||
  HSYNC loop_sync[4];
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @brief The starting sample of the AB-Loop.
 | 
			
		||||
   */
 | 
			
		||||
  unsigned int loop_start[4] = {0, 0, 0, 0};
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @brief The end sample of the AB-Loop.
 | 
			
		||||
   */
 | 
			
		||||
  unsigned int loop_end[4] = {0, 0, 0, 0};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOMUSICPLAYER_H
 | 
			
		||||
@ -1,28 +0,0 @@
 | 
			
		||||
#ifndef AOPACKET_H
 | 
			
		||||
#define AOPACKET_H
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
 | 
			
		||||
class AOPacket {
 | 
			
		||||
public:
 | 
			
		||||
  AOPacket(QString header) : m_header(header){}
 | 
			
		||||
  AOPacket(QString header, QStringList p_contents) : m_header(header), m_contents(p_contents){}
 | 
			
		||||
 | 
			
		||||
  QString get_header() { return m_header; }
 | 
			
		||||
  QStringList &get_contents() { return m_contents; }
 | 
			
		||||
  QString to_string(bool encoded = false);
 | 
			
		||||
 | 
			
		||||
  void net_encode();
 | 
			
		||||
  void net_decode();
 | 
			
		||||
 | 
			
		||||
  static void escape(QStringList &contents);
 | 
			
		||||
  static void unescape(QStringList &contents);
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
  QString m_header;
 | 
			
		||||
  QStringList m_contents;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOPACKET_H
 | 
			
		||||
@ -1,40 +0,0 @@
 | 
			
		||||
#ifndef AOSFXPLAYER_H
 | 
			
		||||
#define AOSFXPLAYER_H
 | 
			
		||||
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
#include "bassopus.h"
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
class AOSfxPlayer {
 | 
			
		||||
public:
 | 
			
		||||
  AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
 | 
			
		||||
  void clear();
 | 
			
		||||
  void loop_clear();
 | 
			
		||||
  void play(QString p_sfx, QString p_char = "", QString shout = "");
 | 
			
		||||
  void stop(int channel = -1);
 | 
			
		||||
  void set_volume(qreal p_volume);
 | 
			
		||||
  void set_looping(bool toggle, int channel = -1);
 | 
			
		||||
  void set_muted(bool toggle);
 | 
			
		||||
  int m_channel = 0;
 | 
			
		||||
  int get_volume() { return m_volume * 100; };
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *m_parent;
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  qreal m_volume = 0;
 | 
			
		||||
 | 
			
		||||
  bool m_looping = true;
 | 
			
		||||
  bool m_muted = false;
 | 
			
		||||
  void set_volume_internal(qreal p_volume);
 | 
			
		||||
 | 
			
		||||
  const int m_channelmax = 5;
 | 
			
		||||
 | 
			
		||||
  HSTREAM m_stream_list[5];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOSFXPLAYER_H
 | 
			
		||||
@ -1,26 +0,0 @@
 | 
			
		||||
#ifndef AOTEXTAREA_H
 | 
			
		||||
#define AOTEXTAREA_H
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QRegularExpression>
 | 
			
		||||
#include <QScrollBar>
 | 
			
		||||
#include <QTextBrowser>
 | 
			
		||||
#include <QTextCursor>
 | 
			
		||||
 | 
			
		||||
class AOTextArea : public QTextBrowser {
 | 
			
		||||
public:
 | 
			
		||||
  AOTextArea(QWidget *p_parent = nullptr, int p_log_length = 5000);
 | 
			
		||||
 | 
			
		||||
  void append_linked(QString p_message);
 | 
			
		||||
  void append_chatmessage(QString p_name, QString p_message,
 | 
			
		||||
                          QString p_name_colour, QString p_color = QString());
 | 
			
		||||
  void append_error(QString p_message);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  const QRegularExpression url_parser_regex = QRegularExpression("\\b(https?://\\S+\\.\\S+)\\b");
 | 
			
		||||
 | 
			
		||||
  void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
 | 
			
		||||
                   bool is_scrolled_down);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOTEXTAREA_H
 | 
			
		||||
@ -1,32 +0,0 @@
 | 
			
		||||
#ifndef AOTEXTBOXWIDGETS_H
 | 
			
		||||
#define AOTEXTBOXWIDGETS_H
 | 
			
		||||
 | 
			
		||||
#include <QAbstractTextDocumentLayout>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QPaintEvent>
 | 
			
		||||
#include <QPainter>
 | 
			
		||||
#include <QPainterPath>
 | 
			
		||||
#include <QTextEdit>
 | 
			
		||||
 | 
			
		||||
class AOChatboxLabel : public QLabel {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOChatboxLabel(QWidget *parent);
 | 
			
		||||
  void paintEvent(QPaintEvent *event);
 | 
			
		||||
 | 
			
		||||
  void setOutlineColor(QColor color) { outline_color = color; };
 | 
			
		||||
  void setOutlineWidth(int width) { outline_width = width; };
 | 
			
		||||
  void setTextColor(QColor color) { text_color = color; };
 | 
			
		||||
  void setIsOutlined(bool outlined) { is_outlined = outlined; };
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
private:
 | 
			
		||||
  QColor outline_color;
 | 
			
		||||
  QColor text_color;
 | 
			
		||||
  int outline_width = 1;
 | 
			
		||||
  bool is_outlined = false;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOTEXTBOXWIDGETS_H
 | 
			
		||||
							
								
								
									
										1227
									
								
								include/bass.h
									
									
									
									
									
								
							
							
						
						@ -1,380 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
	BASSMIDI 2.4 C/C++ header file
 | 
			
		||||
	Copyright (c) 2006-2020 Un4seen Developments Ltd.
 | 
			
		||||
 | 
			
		||||
	See the BASSMIDI.CHM file for more detailed documentation
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef BASSMIDI_H
 | 
			
		||||
#define BASSMIDI_H
 | 
			
		||||
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
 | 
			
		||||
#if BASSVERSION!=0x204
 | 
			
		||||
#error conflicting BASS and BASSMIDI versions
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef BASSMIDIDEF
 | 
			
		||||
#define BASSMIDIDEF(f) WINAPI f
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef DWORD HSOUNDFONT;	// soundfont handle
 | 
			
		||||
 | 
			
		||||
// Additional error codes returned by BASS_ErrorGetCode
 | 
			
		||||
#define BASS_ERROR_MIDI_INCLUDE		7000	// SFZ include file could not be opened
 | 
			
		||||
 | 
			
		||||
// Additional BASS_SetConfig options
 | 
			
		||||
#define BASS_CONFIG_MIDI_COMPACT	0x10400
 | 
			
		||||
#define BASS_CONFIG_MIDI_VOICES		0x10401
 | 
			
		||||
#define BASS_CONFIG_MIDI_AUTOFONT	0x10402
 | 
			
		||||
#define BASS_CONFIG_MIDI_IN_PORTS	0x10404
 | 
			
		||||
#define BASS_CONFIG_MIDI_SAMPLETHREADS 0x10406
 | 
			
		||||
#define BASS_CONFIG_MIDI_SAMPLEMEM	0x10407
 | 
			
		||||
#define BASS_CONFIG_MIDI_SAMPLEREAD	0x10408
 | 
			
		||||
 | 
			
		||||
// Additional BASS_SetConfigPtr options
 | 
			
		||||
#define BASS_CONFIG_MIDI_DEFFONT	0x10403
 | 
			
		||||
#define BASS_CONFIG_MIDI_SFZHEAD	0x10408
 | 
			
		||||
 | 
			
		||||
// Additional sync types
 | 
			
		||||
#define BASS_SYNC_MIDI_MARK		0x10000
 | 
			
		||||
#define BASS_SYNC_MIDI_MARKER	0x10000
 | 
			
		||||
#define BASS_SYNC_MIDI_CUE		0x10001
 | 
			
		||||
#define BASS_SYNC_MIDI_LYRIC	0x10002
 | 
			
		||||
#define BASS_SYNC_MIDI_TEXT		0x10003
 | 
			
		||||
#define BASS_SYNC_MIDI_EVENT	0x10004
 | 
			
		||||
#define BASS_SYNC_MIDI_TICK		0x10005
 | 
			
		||||
#define BASS_SYNC_MIDI_TIMESIG	0x10006
 | 
			
		||||
#define BASS_SYNC_MIDI_KEYSIG	0x10007
 | 
			
		||||
 | 
			
		||||
// Additional BASS_MIDI_StreamCreateFile/etc flags
 | 
			
		||||
#define BASS_MIDI_NOSYSRESET	0x800
 | 
			
		||||
#define BASS_MIDI_DECAYEND		0x1000
 | 
			
		||||
#define BASS_MIDI_NOFX			0x2000
 | 
			
		||||
#define BASS_MIDI_DECAYSEEK		0x4000
 | 
			
		||||
#define BASS_MIDI_NOCROP		0x8000
 | 
			
		||||
#define BASS_MIDI_NOTEOFF1		0x10000
 | 
			
		||||
#define BASS_MIDI_SINCINTER		0x800000
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_FontInit flags
 | 
			
		||||
#define BASS_MIDI_FONT_MEM		0x10000
 | 
			
		||||
#define BASS_MIDI_FONT_MMAP		0x20000
 | 
			
		||||
#define BASS_MIDI_FONT_XGDRUMS	0x40000
 | 
			
		||||
#define BASS_MIDI_FONT_NOFX		0x80000
 | 
			
		||||
#define BASS_MIDI_FONT_LINATTMOD	0x100000
 | 
			
		||||
#define BASS_MIDI_FONT_LINDECVOL	0x200000
 | 
			
		||||
#define BASS_MIDI_FONT_NORAMPIN		0x400000
 | 
			
		||||
#define BASS_MIDI_FONT_NOLIMITS		0x800000
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	HSOUNDFONT font;	// soundfont
 | 
			
		||||
	int preset;			// preset number (-1=all)
 | 
			
		||||
	int bank;
 | 
			
		||||
} BASS_MIDI_FONT;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	HSOUNDFONT font;	// soundfont
 | 
			
		||||
	int spreset;		// source preset number
 | 
			
		||||
	int sbank;			// source bank number
 | 
			
		||||
	int dpreset;		// destination preset/program number
 | 
			
		||||
	int dbank;			// destination bank number
 | 
			
		||||
	int dbanklsb;		// destination bank number LSB
 | 
			
		||||
} BASS_MIDI_FONTEX;
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_StreamSet/GetFonts flag
 | 
			
		||||
#define BASS_MIDI_FONT_EX		0x1000000	// BASS_MIDI_FONTEX
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	const char *name;
 | 
			
		||||
	const char *copyright;
 | 
			
		||||
	const char *comment;
 | 
			
		||||
	DWORD presets;		// number of presets/instruments
 | 
			
		||||
	DWORD samsize;		// total size (in bytes) of the sample data
 | 
			
		||||
	DWORD samload;		// amount of sample data currently loaded
 | 
			
		||||
	DWORD samtype;		// sample format (CTYPE) if packed
 | 
			
		||||
} BASS_MIDI_FONTINFO;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	DWORD track;		// track containing marker
 | 
			
		||||
	DWORD pos;			// marker position
 | 
			
		||||
	const char *text;	// marker text
 | 
			
		||||
} BASS_MIDI_MARK;
 | 
			
		||||
 | 
			
		||||
// Marker types
 | 
			
		||||
#define BASS_MIDI_MARK_MARKER	0	// marker
 | 
			
		||||
#define BASS_MIDI_MARK_CUE		1	// cue point
 | 
			
		||||
#define BASS_MIDI_MARK_LYRIC	2	// lyric
 | 
			
		||||
#define BASS_MIDI_MARK_TEXT		3	// text
 | 
			
		||||
#define BASS_MIDI_MARK_TIMESIG	4	// time signature
 | 
			
		||||
#define BASS_MIDI_MARK_KEYSIG	5	// key signature
 | 
			
		||||
#define BASS_MIDI_MARK_COPY		6	// copyright notice
 | 
			
		||||
#define BASS_MIDI_MARK_TRACK	7	// track name
 | 
			
		||||
#define BASS_MIDI_MARK_INST		8	// instrument name
 | 
			
		||||
#define BASS_MIDI_MARK_TRACKSTART	9	// track start (SMF2)
 | 
			
		||||
#define BASS_MIDI_MARK_TICK		0x10000 // flag: get position in ticks (otherwise bytes)
 | 
			
		||||
 | 
			
		||||
// MIDI events
 | 
			
		||||
#define MIDI_EVENT_NOTE				1
 | 
			
		||||
#define MIDI_EVENT_PROGRAM			2
 | 
			
		||||
#define MIDI_EVENT_CHANPRES			3
 | 
			
		||||
#define MIDI_EVENT_PITCH			4
 | 
			
		||||
#define MIDI_EVENT_PITCHRANGE		5
 | 
			
		||||
#define MIDI_EVENT_DRUMS			6
 | 
			
		||||
#define MIDI_EVENT_FINETUNE			7
 | 
			
		||||
#define MIDI_EVENT_COARSETUNE		8
 | 
			
		||||
#define MIDI_EVENT_MASTERVOL		9
 | 
			
		||||
#define MIDI_EVENT_BANK				10
 | 
			
		||||
#define MIDI_EVENT_MODULATION		11
 | 
			
		||||
#define MIDI_EVENT_VOLUME			12
 | 
			
		||||
#define MIDI_EVENT_PAN				13
 | 
			
		||||
#define MIDI_EVENT_EXPRESSION		14
 | 
			
		||||
#define MIDI_EVENT_SUSTAIN			15
 | 
			
		||||
#define MIDI_EVENT_SOUNDOFF			16
 | 
			
		||||
#define MIDI_EVENT_RESET			17
 | 
			
		||||
#define MIDI_EVENT_NOTESOFF			18
 | 
			
		||||
#define MIDI_EVENT_PORTAMENTO		19
 | 
			
		||||
#define MIDI_EVENT_PORTATIME		20
 | 
			
		||||
#define MIDI_EVENT_PORTANOTE		21
 | 
			
		||||
#define MIDI_EVENT_MODE				22
 | 
			
		||||
#define MIDI_EVENT_REVERB			23
 | 
			
		||||
#define MIDI_EVENT_CHORUS			24
 | 
			
		||||
#define MIDI_EVENT_CUTOFF			25
 | 
			
		||||
#define MIDI_EVENT_RESONANCE		26
 | 
			
		||||
#define MIDI_EVENT_RELEASE			27
 | 
			
		||||
#define MIDI_EVENT_ATTACK			28
 | 
			
		||||
#define MIDI_EVENT_DECAY			29
 | 
			
		||||
#define MIDI_EVENT_REVERB_MACRO		30
 | 
			
		||||
#define MIDI_EVENT_CHORUS_MACRO		31
 | 
			
		||||
#define MIDI_EVENT_REVERB_TIME		32
 | 
			
		||||
#define MIDI_EVENT_REVERB_DELAY		33
 | 
			
		||||
#define MIDI_EVENT_REVERB_LOCUTOFF	34
 | 
			
		||||
#define MIDI_EVENT_REVERB_HICUTOFF	35
 | 
			
		||||
#define MIDI_EVENT_REVERB_LEVEL		36
 | 
			
		||||
#define MIDI_EVENT_CHORUS_DELAY		37
 | 
			
		||||
#define MIDI_EVENT_CHORUS_DEPTH		38
 | 
			
		||||
#define MIDI_EVENT_CHORUS_RATE		39
 | 
			
		||||
#define MIDI_EVENT_CHORUS_FEEDBACK	40
 | 
			
		||||
#define MIDI_EVENT_CHORUS_LEVEL		41
 | 
			
		||||
#define MIDI_EVENT_CHORUS_REVERB	42
 | 
			
		||||
#define MIDI_EVENT_USERFX			43
 | 
			
		||||
#define MIDI_EVENT_USERFX_LEVEL		44
 | 
			
		||||
#define MIDI_EVENT_USERFX_REVERB	45
 | 
			
		||||
#define MIDI_EVENT_USERFX_CHORUS	46
 | 
			
		||||
#define MIDI_EVENT_DRUM_FINETUNE	50
 | 
			
		||||
#define MIDI_EVENT_DRUM_COARSETUNE	51
 | 
			
		||||
#define MIDI_EVENT_DRUM_PAN			52
 | 
			
		||||
#define MIDI_EVENT_DRUM_REVERB		53
 | 
			
		||||
#define MIDI_EVENT_DRUM_CHORUS		54
 | 
			
		||||
#define MIDI_EVENT_DRUM_CUTOFF		55
 | 
			
		||||
#define MIDI_EVENT_DRUM_RESONANCE	56
 | 
			
		||||
#define MIDI_EVENT_DRUM_LEVEL		57
 | 
			
		||||
#define MIDI_EVENT_DRUM_USERFX		58
 | 
			
		||||
#define MIDI_EVENT_SOFT				60
 | 
			
		||||
#define MIDI_EVENT_SYSTEM			61
 | 
			
		||||
#define MIDI_EVENT_TEMPO			62
 | 
			
		||||
#define MIDI_EVENT_SCALETUNING		63
 | 
			
		||||
#define MIDI_EVENT_CONTROL			64
 | 
			
		||||
#define MIDI_EVENT_CHANPRES_VIBRATO	65
 | 
			
		||||
#define MIDI_EVENT_CHANPRES_PITCH	66
 | 
			
		||||
#define MIDI_EVENT_CHANPRES_FILTER	67
 | 
			
		||||
#define MIDI_EVENT_CHANPRES_VOLUME	68
 | 
			
		||||
#define MIDI_EVENT_MOD_VIBRATO		69
 | 
			
		||||
#define MIDI_EVENT_MODRANGE			69
 | 
			
		||||
#define MIDI_EVENT_BANK_LSB			70
 | 
			
		||||
#define MIDI_EVENT_KEYPRES			71
 | 
			
		||||
#define MIDI_EVENT_KEYPRES_VIBRATO	72
 | 
			
		||||
#define MIDI_EVENT_KEYPRES_PITCH	73
 | 
			
		||||
#define MIDI_EVENT_KEYPRES_FILTER	74
 | 
			
		||||
#define MIDI_EVENT_KEYPRES_VOLUME	75
 | 
			
		||||
#define MIDI_EVENT_SOSTENUTO		76
 | 
			
		||||
#define MIDI_EVENT_MOD_PITCH		77
 | 
			
		||||
#define MIDI_EVENT_MOD_FILTER		78
 | 
			
		||||
#define MIDI_EVENT_MOD_VOLUME		79
 | 
			
		||||
#define MIDI_EVENT_VIBRATO_RATE		80
 | 
			
		||||
#define MIDI_EVENT_VIBRATO_DEPTH	81
 | 
			
		||||
#define MIDI_EVENT_VIBRATO_DELAY	82
 | 
			
		||||
#define MIDI_EVENT_MIXLEVEL			0x10000
 | 
			
		||||
#define MIDI_EVENT_TRANSPOSE		0x10001
 | 
			
		||||
#define MIDI_EVENT_SYSTEMEX			0x10002
 | 
			
		||||
#define MIDI_EVENT_SPEED			0x10004
 | 
			
		||||
 | 
			
		||||
#define MIDI_EVENT_END				0
 | 
			
		||||
#define MIDI_EVENT_END_TRACK		0x10003
 | 
			
		||||
 | 
			
		||||
#define MIDI_EVENT_NOTES			0x20000
 | 
			
		||||
#define MIDI_EVENT_VOICES			0x20001
 | 
			
		||||
 | 
			
		||||
#define MIDI_SYSTEM_DEFAULT			0
 | 
			
		||||
#define MIDI_SYSTEM_GM1				1
 | 
			
		||||
#define MIDI_SYSTEM_GM2				2
 | 
			
		||||
#define MIDI_SYSTEM_XG				3
 | 
			
		||||
#define MIDI_SYSTEM_GS				4
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	DWORD event;		// MIDI_EVENT_xxx
 | 
			
		||||
	DWORD param;
 | 
			
		||||
	DWORD chan;
 | 
			
		||||
	DWORD tick;			// event position (ticks)
 | 
			
		||||
	DWORD pos;			// event position (bytes)
 | 
			
		||||
} BASS_MIDI_EVENT;
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_StreamEvents modes
 | 
			
		||||
#define BASS_MIDI_EVENTS_STRUCT		0 // BASS_MIDI_EVENT structures
 | 
			
		||||
#define BASS_MIDI_EVENTS_RAW		0x10000 // raw MIDI event data
 | 
			
		||||
#define BASS_MIDI_EVENTS_SYNC		0x1000000 // flag: trigger event syncs
 | 
			
		||||
#define BASS_MIDI_EVENTS_NORSTATUS	0x2000000 // flag: no running status
 | 
			
		||||
#define BASS_MIDI_EVENTS_CANCEL		0x4000000 // flag: cancel pending events
 | 
			
		||||
#define BASS_MIDI_EVENTS_TIME		0x8000000 // flag: delta-time info is present
 | 
			
		||||
#define BASS_MIDI_EVENTS_ABSTIME	0x10000000 // flag: absolute time info is present
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_StreamGetChannel special channels
 | 
			
		||||
#define BASS_MIDI_CHAN_CHORUS		(DWORD)-1
 | 
			
		||||
#define BASS_MIDI_CHAN_REVERB		(DWORD)-2
 | 
			
		||||
#define BASS_MIDI_CHAN_USERFX		(DWORD)-3
 | 
			
		||||
 | 
			
		||||
// BASS_CHANNELINFO type
 | 
			
		||||
#define BASS_CTYPE_STREAM_MIDI	0x10d00
 | 
			
		||||
 | 
			
		||||
// Additional attributes
 | 
			
		||||
#define BASS_ATTRIB_MIDI_PPQN		0x12000
 | 
			
		||||
#define BASS_ATTRIB_MIDI_CPU		0x12001
 | 
			
		||||
#define BASS_ATTRIB_MIDI_CHANS		0x12002
 | 
			
		||||
#define BASS_ATTRIB_MIDI_VOICES		0x12003
 | 
			
		||||
#define BASS_ATTRIB_MIDI_VOICES_ACTIVE 0x12004
 | 
			
		||||
#define BASS_ATTRIB_MIDI_STATE		0x12005
 | 
			
		||||
#define BASS_ATTRIB_MIDI_SRC		0x12006
 | 
			
		||||
#define BASS_ATTRIB_MIDI_KILL		0x12007
 | 
			
		||||
#define BASS_ATTRIB_MIDI_SPEED		0x12008
 | 
			
		||||
#define BASS_ATTRIB_MIDI_REVERB		0x12009
 | 
			
		||||
#define BASS_ATTRIB_MIDI_VOL		0x1200a
 | 
			
		||||
#define BASS_ATTRIB_MIDI_TRACK_VOL	0x12100 // + track #
 | 
			
		||||
 | 
			
		||||
// Additional tag type
 | 
			
		||||
#define BASS_TAG_MIDI_TRACK	0x11000	// + track #, track text : array of null-terminated ANSI strings
 | 
			
		||||
 | 
			
		||||
// BASS_ChannelGetLength/GetPosition/SetPosition mode
 | 
			
		||||
#define BASS_POS_MIDI_TICK		2		// tick position
 | 
			
		||||
 | 
			
		||||
typedef BOOL (CALLBACK MIDIFILTERPROC)(HSTREAM handle, DWORD track, BASS_MIDI_EVENT *event, BOOL seeking, void *user);
 | 
			
		||||
/* Event filtering callback function.
 | 
			
		||||
handle : MIDI stream handle
 | 
			
		||||
track  : Track containing the event
 | 
			
		||||
event  : The event
 | 
			
		||||
seeking: TRUE = the event is being processed while seeking, FALSE = it is being played
 | 
			
		||||
user   : The 'user' parameter value given when calling BASS_MIDI_StreamSetFilter
 | 
			
		||||
RETURN : TRUE = process the event, FALSE = drop the event */
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_FontLoadEx flags
 | 
			
		||||
#define BASS_MIDI_FONTLOAD_NOWAIT	1	// don't want for the samples to load
 | 
			
		||||
#define BASS_MIDI_FONTLOAD_COMPACT	2	// compact samples
 | 
			
		||||
#define BASS_MIDI_FONTLOAD_NOLOAD	4	// don't load (only compact)
 | 
			
		||||
#define BASS_MIDI_FONTLOAD_TIME		8	// length is in milliseconds
 | 
			
		||||
#define BASS_MIDI_FONTLOAD_KEEPDEC	16	// keep decoders
 | 
			
		||||
 | 
			
		||||
// BASS_MIDI_FontPack flags
 | 
			
		||||
#define BASS_MIDI_PACK_NOHEAD		1	// don't send a WAV header to the encoder
 | 
			
		||||
#define BASS_MIDI_PACK_16BIT		2	// discard low 8 bits of 24-bit sample data
 | 
			
		||||
#define BASS_MIDI_PACK_48KHZ		4	// set encoding rate to 48000 Hz (else 44100 Hz)
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	const char *name;	// description
 | 
			
		||||
	DWORD id;
 | 
			
		||||
	DWORD flags;
 | 
			
		||||
} BASS_MIDI_DEVICEINFO;
 | 
			
		||||
 | 
			
		||||
typedef void (CALLBACK MIDIINPROC)(DWORD device, double time, const BYTE *buffer, DWORD length, void *user);
 | 
			
		||||
/* MIDI input callback function.
 | 
			
		||||
device : MIDI input device
 | 
			
		||||
time   : Timestamp
 | 
			
		||||
buffer : Buffer containing MIDI data
 | 
			
		||||
length : Number of bytes of data
 | 
			
		||||
user   : The 'user' parameter value given when calling BASS_MIDI_InInit */
 | 
			
		||||
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreate)(DWORD channels, DWORD flags, DWORD freq);
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags, DWORD freq);
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user, DWORD freq);
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user, DWORD freq);
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateEvents)(const BASS_MIDI_EVENT *events, DWORD ppqn, DWORD flags, DWORD freq);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamGetMark)(HSTREAM handle, DWORD type, DWORD index, BASS_MIDI_MARK *mark);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamGetMarks)(HSTREAM handle, int track, DWORD type, BASS_MIDI_MARK *marks);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamSetFonts)(HSTREAM handle, const void *fonts, DWORD count);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamGetFonts)(HSTREAM handle, void *fonts, DWORD count);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamLoadSamples)(HSTREAM handle);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamEvent)(HSTREAM handle, DWORD chan, DWORD event, DWORD param);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamEvents)(HSTREAM handle, DWORD mode, const void *events, DWORD length);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEvent)(HSTREAM handle, DWORD chan, DWORD event);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEvents)(HSTREAM handle, int track, DWORD filter, BASS_MIDI_EVENT *events);
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEventsEx)(HSTREAM handle, int track, DWORD filter, BASS_MIDI_EVENT *events, DWORD start, DWORD count);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamGetPreset)(HSTREAM handle, DWORD chan, BASS_MIDI_FONT *font);
 | 
			
		||||
HSTREAM BASSMIDIDEF(BASS_MIDI_StreamGetChannel)(HSTREAM handle, DWORD chan);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_StreamSetFilter)(HSTREAM handle, BOOL seeking, MIDIFILTERPROC *proc, void *user);
 | 
			
		||||
 | 
			
		||||
HSOUNDFONT BASSMIDIDEF(BASS_MIDI_FontInit)(const void *file, DWORD flags);
 | 
			
		||||
HSOUNDFONT BASSMIDIDEF(BASS_MIDI_FontInitUser)(const BASS_FILEPROCS *procs, void *user, DWORD flags);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontFree)(HSOUNDFONT handle);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontGetInfo)(HSOUNDFONT handle, BASS_MIDI_FONTINFO *info);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontGetPresets)(HSOUNDFONT handle, DWORD *presets);
 | 
			
		||||
const char *BASSMIDIDEF(BASS_MIDI_FontGetPreset)(HSOUNDFONT handle, int preset, int bank);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontLoad)(HSOUNDFONT handle, int preset, int bank);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontLoadEx)(HSOUNDFONT handle, int preset, int bank, DWORD length, DWORD flags);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontUnload)(HSOUNDFONT handle, int preset, int bank);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontCompact)(HSOUNDFONT handle);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontPack)(HSOUNDFONT handle, const void *outfile, const void *encoder, DWORD flags);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontUnpack)(HSOUNDFONT handle, const void *outfile, DWORD flags);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_FontSetVolume)(HSOUNDFONT handle, float volume);
 | 
			
		||||
float BASSMIDIDEF(BASS_MIDI_FontGetVolume)(HSOUNDFONT handle);
 | 
			
		||||
 | 
			
		||||
DWORD BASSMIDIDEF(BASS_MIDI_ConvertEvents)(const BYTE *data, DWORD length, BASS_MIDI_EVENT *events, DWORD count, DWORD flags);
 | 
			
		||||
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_InGetDeviceInfo)(DWORD device, BASS_MIDI_DEVICEINFO *info);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_InInit)(DWORD device, MIDIINPROC *proc, void *user);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_InFree)(DWORD device);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_InStart)(DWORD device);
 | 
			
		||||
BOOL BASSMIDIDEF(BASS_MIDI_InStop)(DWORD device);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline BOOL BASS_MIDI_StreamSetFonts(HSTREAM handle, const BASS_MIDI_FONTEX *fonts, DWORD count)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_StreamSetFonts(handle, (const void*)fonts, count|BASS_MIDI_FONT_EX);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline DWORD BASS_MIDI_StreamGetFonts(HSTREAM handle, BASS_MIDI_FONTEX *fonts, DWORD count)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_StreamGetFonts(handle, (void*)fonts, count|BASS_MIDI_FONT_EX);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
static inline HSTREAM BASS_MIDI_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags, DWORD freq)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline HSTREAM BASS_MIDI_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user, DWORD freq)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user, freq);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline HSOUNDFONT BASS_MIDI_FontInit(const WCHAR *file, DWORD flags)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_FontInit((const void*)file, flags|BASS_UNICODE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline BOOL BASS_MIDI_FontPack(HSOUNDFONT handle, const WCHAR *outfile, const WCHAR *encoder, DWORD flags)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_FontPack(handle, (const void*)outfile, (const void*)encoder, flags|BASS_UNICODE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline BOOL BASS_MIDI_FontUnpack(HSOUNDFONT handle, const WCHAR *outfile, DWORD flags)
 | 
			
		||||
{
 | 
			
		||||
	return BASS_MIDI_FontUnpack(handle, (const void*)outfile, flags|BASS_UNICODE);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,64 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
        BASSOPUS 2.4 C/C++ header file
 | 
			
		||||
        Copyright (c) 2012-2015 Un4seen Developments Ltd.
 | 
			
		||||
 | 
			
		||||
        See the BASSOPUS.CHM file for more detailed documentation
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef BASSOPUS_H
 | 
			
		||||
#define BASSOPUS_H
 | 
			
		||||
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
 | 
			
		||||
#if BASSVERSION != 0x204
 | 
			
		||||
#error conflicting BASS and BASSOPUS versions
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef BASSOPUSDEF
 | 
			
		||||
#define BASSOPUSDEF(f) WINAPI f
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// BASS_CHANNELINFO type
 | 
			
		||||
#define BASS_CTYPE_STREAM_OPUS 0x11200
 | 
			
		||||
 | 
			
		||||
// Additional attributes
 | 
			
		||||
#define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000
 | 
			
		||||
#define BASS_ATTRIB_OPUS_GAIN 0x13001
 | 
			
		||||
 | 
			
		||||
HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file,
 | 
			
		||||
                                                QWORD offset, QWORD length,
 | 
			
		||||
                                                DWORD flags);
 | 
			
		||||
HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset,
 | 
			
		||||
                                               DWORD flags, DOWNLOADPROC *proc,
 | 
			
		||||
                                               void *user);
 | 
			
		||||
HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags,
 | 
			
		||||
                                                    const BASS_FILEPROCS *procs,
 | 
			
		||||
                                                    void *user);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && !defined(NOBASSOVERLOADS)
 | 
			
		||||
static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file,
 | 
			
		||||
                                                 QWORD offset, QWORD length,
 | 
			
		||||
                                                 DWORD flags)
 | 
			
		||||
{
 | 
			
		||||
  return BASS_OPUS_StreamCreateFile(mem, (const void *)file, offset, length,
 | 
			
		||||
                                    flags | BASS_UNICODE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset,
 | 
			
		||||
                                                DWORD flags, DOWNLOADPROC *proc,
 | 
			
		||||
                                                void *user)
 | 
			
		||||
{
 | 
			
		||||
  return BASS_OPUS_StreamCreateURL((const char *)url, offset,
 | 
			
		||||
                                   flags | BASS_UNICODE, proc, user);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,37 +0,0 @@
 | 
			
		||||
#ifndef CHATLOGPIECE_H
 | 
			
		||||
#define CHATLOGPIECE_H
 | 
			
		||||
 | 
			
		||||
#include <QtWidgets/QApplication>
 | 
			
		||||
#include <QDateTime>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class chatlogpiece {
 | 
			
		||||
    Q_DECLARE_TR_FUNCTIONS(chatlogpiece)
 | 
			
		||||
public:
 | 
			
		||||
  chatlogpiece();
 | 
			
		||||
  chatlogpiece(QString p_name, QString p_showname, QString p_message,
 | 
			
		||||
               QString p_action,int color, bool selfname);
 | 
			
		||||
  chatlogpiece(QString p_name, QString p_showname, QString p_message,
 | 
			
		||||
               QString p_action, int color, bool selfname, QDateTime p_datetime);
 | 
			
		||||
 | 
			
		||||
  QString get_name() { return name; };
 | 
			
		||||
  QString get_showname() { return showname; };
 | 
			
		||||
  QString get_message() { return message; };
 | 
			
		||||
  QString get_action() { return action; };
 | 
			
		||||
  bool get_selfname() const { return selfname; };
 | 
			
		||||
  QDateTime get_datetime() { return datetime; };
 | 
			
		||||
  QString get_datetime_as_string() { return datetime.toString(); };
 | 
			
		||||
  int get_chat_color() const { return color; };
 | 
			
		||||
  QString get_full();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString showname;
 | 
			
		||||
  QString message;
 | 
			
		||||
  QString action;
 | 
			
		||||
  bool selfname;
 | 
			
		||||
  QDateTime datetime;
 | 
			
		||||
  int color;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // CHATLOGPIECE_H
 | 
			
		||||
@ -1,137 +0,0 @@
 | 
			
		||||
#ifndef DATATYPES_H
 | 
			
		||||
#define DATATYPES_H
 | 
			
		||||
 | 
			
		||||
#include <QMap>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
enum connection_type {
 | 
			
		||||
  TCP,
 | 
			
		||||
  WEBSOCKETS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static QMap<QString, connection_type> to_connection_type = {
 | 
			
		||||
    {"tcp", connection_type::TCP},
 | 
			
		||||
    {"ws", connection_type::WEBSOCKETS}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct server_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString desc;
 | 
			
		||||
  QString ip;
 | 
			
		||||
  int port;
 | 
			
		||||
  connection_type socket_type;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct emote_type {
 | 
			
		||||
  QString comment;
 | 
			
		||||
  QString preanim;
 | 
			
		||||
  QString anim;
 | 
			
		||||
  int mod;
 | 
			
		||||
  QString sfx_name;
 | 
			
		||||
  int sfx_delay;
 | 
			
		||||
  int sfx_duration;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct char_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString description;
 | 
			
		||||
  QString evidence_string;
 | 
			
		||||
  bool taken;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct evi_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString description;
 | 
			
		||||
  QString image;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct chatmessage_type {
 | 
			
		||||
  QString message;
 | 
			
		||||
  QString character;
 | 
			
		||||
  QString side;
 | 
			
		||||
  QString sfx_name;
 | 
			
		||||
  QString pre_emote;
 | 
			
		||||
  QString emote;
 | 
			
		||||
  int emote_modifier;
 | 
			
		||||
  int objection_modifier;
 | 
			
		||||
  int realization;
 | 
			
		||||
  int text_color;
 | 
			
		||||
  int evidence;
 | 
			
		||||
  int cid;
 | 
			
		||||
  int sfx_delay;
 | 
			
		||||
  int flip;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct area_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString background;
 | 
			
		||||
  bool passworded;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pos_type {
 | 
			
		||||
  int x;
 | 
			
		||||
  int y;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pos_size_type {
 | 
			
		||||
  int x = 0;
 | 
			
		||||
  int y = 0;
 | 
			
		||||
  int width = 0;
 | 
			
		||||
  int height = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum CHAT_MESSAGE {
 | 
			
		||||
  DESK_MOD = 0,
 | 
			
		||||
  PRE_EMOTE,
 | 
			
		||||
  CHAR_NAME,
 | 
			
		||||
  EMOTE,
 | 
			
		||||
  MESSAGE,
 | 
			
		||||
  SIDE,
 | 
			
		||||
  SFX_NAME,
 | 
			
		||||
  EMOTE_MOD,
 | 
			
		||||
  CHAR_ID,
 | 
			
		||||
  SFX_DELAY,
 | 
			
		||||
  OBJECTION_MOD,
 | 
			
		||||
  EVIDENCE_ID,
 | 
			
		||||
  FLIP,
 | 
			
		||||
  REALIZATION,
 | 
			
		||||
  TEXT_COLOR,
 | 
			
		||||
  SHOWNAME,
 | 
			
		||||
  OTHER_CHARID,
 | 
			
		||||
  OTHER_NAME,
 | 
			
		||||
  OTHER_EMOTE,
 | 
			
		||||
  SELF_OFFSET,
 | 
			
		||||
  OTHER_OFFSET,
 | 
			
		||||
  OTHER_FLIP,
 | 
			
		||||
  IMMEDIATE,
 | 
			
		||||
  LOOPING_SFX,
 | 
			
		||||
  SCREENSHAKE,
 | 
			
		||||
  FRAME_SCREENSHAKE,
 | 
			
		||||
  FRAME_REALIZATION,
 | 
			
		||||
  FRAME_SFX,
 | 
			
		||||
  ADDITIVE,
 | 
			
		||||
  EFFECTS,
 | 
			
		||||
  BLIPNAME,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum EMOTE_MOD_TYPE {
 | 
			
		||||
  IDLE = 0,
 | 
			
		||||
  PREANIM = 1,
 | 
			
		||||
  ZOOM = 5,
 | 
			
		||||
  PREANIM_ZOOM = 6,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum DESK_MOD_TYPE {
 | 
			
		||||
  DESK_HIDE = 0,
 | 
			
		||||
  DESK_SHOW,
 | 
			
		||||
  DESK_EMOTE_ONLY,
 | 
			
		||||
  DESK_PRE_ONLY,
 | 
			
		||||
  DESK_EMOTE_ONLY_EX,
 | 
			
		||||
  DESK_PRE_ONLY_EX,
 | 
			
		||||
  //"EX" for "expanded"
 | 
			
		||||
  //dumb, i know, but throw the first stone if you have a better idea
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 };
 | 
			
		||||
 | 
			
		||||
#endif // DATATYPES_H
 | 
			
		||||
@ -1,10 +0,0 @@
 | 
			
		||||
#ifndef DEBUG_FUNCTIONS_H
 | 
			
		||||
#define DEBUG_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
void call_error(QString message);
 | 
			
		||||
void call_notice(QString message);
 | 
			
		||||
 | 
			
		||||
#endif // DEBUG_FUNCTIONS_H
 | 
			
		||||
@ -1,60 +0,0 @@
 | 
			
		||||
#ifndef DEMOSERVER_H
 | 
			
		||||
#define DEMOSERVER_H
 | 
			
		||||
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QQueue>
 | 
			
		||||
#include <QTcpServer>
 | 
			
		||||
#include <QTcpSocket>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
class DemoServer : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit DemoServer(QObject *parent = nullptr);
 | 
			
		||||
 | 
			
		||||
    bool server_started = false;
 | 
			
		||||
    int port = 27088;
 | 
			
		||||
    int max_wait = -1;
 | 
			
		||||
 | 
			
		||||
    void set_demo_file(QString filepath);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void handle_packet(AOPacket *packet);
 | 
			
		||||
    void load_demo(QString filename);
 | 
			
		||||
    void reset_state();
 | 
			
		||||
 | 
			
		||||
    QTcpServer* tcp_server;
 | 
			
		||||
    QTcpSocket* client_sock = nullptr;
 | 
			
		||||
    bool client_connected = false;
 | 
			
		||||
    bool partial_packet = false;
 | 
			
		||||
    bool debug_mode = false;
 | 
			
		||||
    QString temp_packet = "";
 | 
			
		||||
    QQueue<QString> demo_data;
 | 
			
		||||
    QString sc_packet;
 | 
			
		||||
    int num_chars = 0;
 | 
			
		||||
    QString p_path;
 | 
			
		||||
    QTimer *timer;
 | 
			
		||||
    int elapsed_time = 0;
 | 
			
		||||
    QString filename;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void accept_connection();
 | 
			
		||||
    void destroy_connection();
 | 
			
		||||
    void recv_data();
 | 
			
		||||
    void client_disconnect();
 | 
			
		||||
    void playback();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void start_server();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void skip_timers(qint64 msecs);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // DEMOSERVER_H
 | 
			
		||||
@ -1,87 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
 | 
			
		||||
#if defined(DISCORD_DYNAMIC_LIB)
 | 
			
		||||
#  if defined(_WIN32)
 | 
			
		||||
#    if defined(DISCORD_BUILDING_SDK)
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllexport)
 | 
			
		||||
#    else
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllimport)
 | 
			
		||||
#    endif
 | 
			
		||||
#  else
 | 
			
		||||
#    define DISCORD_EXPORT __attribute__((visibility("default")))
 | 
			
		||||
#  endif
 | 
			
		||||
#else
 | 
			
		||||
#  define DISCORD_EXPORT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordRichPresence {
 | 
			
		||||
  const char *state;   /* max 128 bytes */
 | 
			
		||||
  const char *details; /* max 128 bytes */
 | 
			
		||||
  int64_t startTimestamp;
 | 
			
		||||
  int64_t endTimestamp;
 | 
			
		||||
  const char *largeImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *largeImageText; /* max 128 bytes */
 | 
			
		||||
  const char *smallImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *smallImageText; /* max 128 bytes */
 | 
			
		||||
  const char *partyId;        /* max 128 bytes */
 | 
			
		||||
  int partySize;
 | 
			
		||||
  int partyMax;
 | 
			
		||||
  const char *matchSecret;    /* max 128 bytes */
 | 
			
		||||
  const char *joinSecret;     /* max 128 bytes */
 | 
			
		||||
  const char *spectateSecret; /* max 128 bytes */
 | 
			
		||||
  int8_t instance;
 | 
			
		||||
} DiscordRichPresence;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordJoinRequest {
 | 
			
		||||
  const char *userId;
 | 
			
		||||
  const char *username;
 | 
			
		||||
  const char *discriminator;
 | 
			
		||||
  const char *avatar;
 | 
			
		||||
} DiscordJoinRequest;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordEventHandlers {
 | 
			
		||||
  void (*ready)(void);
 | 
			
		||||
  void (*disconnected)(int errorCode, const char *message);
 | 
			
		||||
  void (*errored)(int errorCode, const char *message);
 | 
			
		||||
  void (*joinGame)(const char *joinSecret);
 | 
			
		||||
  void (*spectateGame)(const char *spectateSecret);
 | 
			
		||||
  void (*joinRequest)(const DiscordJoinRequest *request);
 | 
			
		||||
} DiscordEventHandlers;
 | 
			
		||||
 | 
			
		||||
#define DISCORD_REPLY_NO 0
 | 
			
		||||
#define DISCORD_REPLY_YES 1
 | 
			
		||||
#define DISCORD_REPLY_IGNORE 2
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
 | 
			
		||||
                                       DiscordEventHandlers *handlers,
 | 
			
		||||
                                       int autoRegister,
 | 
			
		||||
                                       const char *optionalSteamId);
 | 
			
		||||
DISCORD_EXPORT void Discord_Shutdown(void);
 | 
			
		||||
 | 
			
		||||
/* checks for incoming messages, dispatches callbacks */
 | 
			
		||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
 | 
			
		||||
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this
 | 
			
		||||
 * from your own */
 | 
			
		||||
#ifdef DISCORD_DISABLE_IO_THREAD
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_ClearPresence(void);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char *userid,
 | 
			
		||||
                                    /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
} /* extern "C" */
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,28 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#if defined(DISCORD_DYNAMIC_LIB)
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
#if defined(DISCORD_BUILDING_SDK)
 | 
			
		||||
#define DISCORD_EXPORT __declspec(dllexport)
 | 
			
		||||
#else
 | 
			
		||||
#define DISCORD_EXPORT __declspec(dllimport)
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#define DISCORD_EXPORT __attribute__((visibility("default")))
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#define DISCORD_EXPORT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Register(const char *applicationId,
 | 
			
		||||
                                     const char *command);
 | 
			
		||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId,
 | 
			
		||||
                                              const char *steamId);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,89 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
 | 
			
		||||
#if defined(DISCORD_DYNAMIC_LIB)
 | 
			
		||||
#  if defined(_WIN32)
 | 
			
		||||
#    if defined(DISCORD_BUILDING_SDK)
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllexport)
 | 
			
		||||
#    else
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllimport)
 | 
			
		||||
#    endif
 | 
			
		||||
#  else
 | 
			
		||||
#    define DISCORD_EXPORT __attribute__((visibility("default")))
 | 
			
		||||
#  endif
 | 
			
		||||
#else
 | 
			
		||||
#  define DISCORD_EXPORT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordRichPresence {
 | 
			
		||||
  const char *state;   /* max 128 bytes */
 | 
			
		||||
  const char *details; /* max 128 bytes */
 | 
			
		||||
  int64_t startTimestamp;
 | 
			
		||||
  int64_t endTimestamp;
 | 
			
		||||
  const char *largeImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *largeImageText; /* max 128 bytes */
 | 
			
		||||
  const char *smallImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *smallImageText; /* max 128 bytes */
 | 
			
		||||
  const char *partyId;        /* max 128 bytes */
 | 
			
		||||
  int partySize;
 | 
			
		||||
  int partyMax;
 | 
			
		||||
  const char *matchSecret;    /* max 128 bytes */
 | 
			
		||||
  const char *joinSecret;     /* max 128 bytes */
 | 
			
		||||
  const char *spectateSecret; /* max 128 bytes */
 | 
			
		||||
  int8_t instance;
 | 
			
		||||
} DiscordRichPresence;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordUser {
 | 
			
		||||
  const char *userId;
 | 
			
		||||
  const char *username;
 | 
			
		||||
  const char *discriminator;
 | 
			
		||||
  const char *avatar;
 | 
			
		||||
} DiscordUser;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordEventHandlers {
 | 
			
		||||
  void (*ready)(const DiscordUser *request);
 | 
			
		||||
  void (*disconnected)(int errorCode, const char *message);
 | 
			
		||||
  void (*errored)(int errorCode, const char *message);
 | 
			
		||||
  void (*joinGame)(const char *joinSecret);
 | 
			
		||||
  void (*spectateGame)(const char *spectateSecret);
 | 
			
		||||
  void (*joinRequest)(const DiscordUser *request);
 | 
			
		||||
} DiscordEventHandlers;
 | 
			
		||||
 | 
			
		||||
#define DISCORD_REPLY_NO 0
 | 
			
		||||
#define DISCORD_REPLY_YES 1
 | 
			
		||||
#define DISCORD_REPLY_IGNORE 2
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
 | 
			
		||||
                                       DiscordEventHandlers *handlers,
 | 
			
		||||
                                       int autoRegister,
 | 
			
		||||
                                       const char *optionalSteamId);
 | 
			
		||||
DISCORD_EXPORT void Discord_Shutdown(void);
 | 
			
		||||
 | 
			
		||||
/* checks for incoming messages, dispatches callbacks */
 | 
			
		||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
 | 
			
		||||
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this
 | 
			
		||||
 * from your own */
 | 
			
		||||
#ifdef DISCORD_DISABLE_IO_THREAD
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_ClearPresence(void);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char *userid,
 | 
			
		||||
                                    /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
} /* extern "C" */
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,36 +0,0 @@
 | 
			
		||||
#ifndef EVENTFILTERS_H
 | 
			
		||||
#define EVENTFILTERS_H
 | 
			
		||||
 | 
			
		||||
#include <QEvent>
 | 
			
		||||
#include <QLineEdit>
 | 
			
		||||
 | 
			
		||||
class AOLineEditFilter : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    bool preserve_selection = false;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    bool eventFilter(QObject *obj, QEvent *event) override {
 | 
			
		||||
        QLineEdit *lineEdit = qobject_cast<QLineEdit *>(obj);
 | 
			
		||||
       if (event->type() == QEvent::FocusOut && lineEdit != nullptr && preserve_selection) { // lost focus
 | 
			
		||||
            int start = lineEdit->selectionStart();
 | 
			
		||||
          #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
 | 
			
		||||
            int len = lineEdit->selectionLength();
 | 
			
		||||
          #else
 | 
			
		||||
            int len = lineEdit->selectedText().length();
 | 
			
		||||
          #endif
 | 
			
		||||
            if (start != -1 && len != -1) {
 | 
			
		||||
              lineEdit->setSelection(start, len);\
 | 
			
		||||
              return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
signals:
 | 
			
		||||
    void double_clicked();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif // EVENTFILTERS_H
 | 
			
		||||
@ -1,14 +0,0 @@
 | 
			
		||||
#ifndef HARDWARE_FUNCTIONS_H
 | 
			
		||||
#define HARDWARE_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID
 | 
			
		||||
#include <QtAndroidExtras/QtAndroid>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
QString get_hdid();
 | 
			
		||||
 | 
			
		||||
#endif // HARDWARE_FUNCTIONS_H
 | 
			
		||||
@ -1,21 +0,0 @@
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#ifndef AO_UI_FAVORITESERVERDIALOG
 | 
			
		||||
#define AO_UI_FAVORITESRRVERDIALOG
 | 
			
		||||
namespace AttorneyOnline {
 | 
			
		||||
  namespace UI {
 | 
			
		||||
    class FavoriteServerDialog : public QDialog {
 | 
			
		||||
    public:
 | 
			
		||||
      FavoriteServerDialog() = default;
 | 
			
		||||
      ~FavoriteServerDialog() = default;
 | 
			
		||||
 | 
			
		||||
      const QString DEFAULT_UI = "favorite_server_dialog.ui";
 | 
			
		||||
      const int TCP_INDEX = 0;
 | 
			
		||||
    private slots:
 | 
			
		||||
      virtual void onSavePressed() = 0;
 | 
			
		||||
      virtual void onCancelPressed() = 0;
 | 
			
		||||
    };
 | 
			
		||||
  } // namespace UI
 | 
			
		||||
} // namespace AttorneyOnline
 | 
			
		||||
#endif // AO_UI_FAVORITESERVERDIALOG
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
#ifndef MISC_FUNCTIONS_H
 | 
			
		||||
#define MISC_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
 | 
			
		||||
void delay(int p_milliseconds);
 | 
			
		||||
 | 
			
		||||
#endif // MISC_FUNCTIONS_H
 | 
			
		||||
@ -1,76 +0,0 @@
 | 
			
		||||
#ifndef NETWORKMANAGER_H
 | 
			
		||||
#define NETWORKMANAGER_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
 | 
			
		||||
#include <QDnsLookup>
 | 
			
		||||
#include <QNetworkAccessManager>
 | 
			
		||||
#include <QtWebSockets/QWebSocket>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
 | 
			
		||||
#include <cstring>
 | 
			
		||||
 | 
			
		||||
enum MSDocumentType {
 | 
			
		||||
  PrivacyPolicy,
 | 
			
		||||
  Motd,
 | 
			
		||||
  ClientVersion
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class NetworkManager : public QObject {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  QNetworkAccessManager *http;
 | 
			
		||||
 | 
			
		||||
  union {
 | 
			
		||||
    QWebSocket *ws;
 | 
			
		||||
    QTcpSocket *tcp;
 | 
			
		||||
  } server_socket;
 | 
			
		||||
  connection_type active_connection_type;
 | 
			
		||||
  bool connected = false;
 | 
			
		||||
 | 
			
		||||
  QTimer *heartbeat_timer;
 | 
			
		||||
 | 
			
		||||
  const QString DEFAULT_MS_BASEURL = "http://servers.aceattorneyonline.com";
 | 
			
		||||
  QString ms_baseurl = DEFAULT_MS_BASEURL;
 | 
			
		||||
 | 
			
		||||
  const int heartbeat_interval = 60 * 5 * 1000;
 | 
			
		||||
 | 
			
		||||
  bool partial_packet = false;
 | 
			
		||||
  QString temp_packet = "";
 | 
			
		||||
 | 
			
		||||
  unsigned int s_decryptor = 5;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  explicit NetworkManager(AOApplication *parent);
 | 
			
		||||
  ~NetworkManager() = default;
 | 
			
		||||
 | 
			
		||||
  void connect_to_server(server_type p_server);
 | 
			
		||||
  void disconnect_from_server();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
  void server_connected(bool state);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void get_server_list();
 | 
			
		||||
  void ship_server_packet(QString p_packet);
 | 
			
		||||
  void join_to_server();
 | 
			
		||||
  void handle_server_packet(const QString& p_data);
 | 
			
		||||
 | 
			
		||||
  void request_document(MSDocumentType document_type,
 | 
			
		||||
                        const std::function<void(QString)> &cb);
 | 
			
		||||
  void send_heartbeat();
 | 
			
		||||
private slots:
 | 
			
		||||
  void ms_request_finished(QNetworkReply *reply);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QString get_user_agent() const {
 | 
			
		||||
    return QStringLiteral("AttorneyOnline/%1 (Desktop)")
 | 
			
		||||
        .arg(ao_app->get_version_string());
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // NETWORKMANAGER_H
 | 
			
		||||
@ -1,153 +0,0 @@
 | 
			
		||||
#ifndef SERVERDATA_H
 | 
			
		||||
#define SERVERDATA_H
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
 | 
			
		||||
namespace server {
 | 
			
		||||
  Q_NAMESPACE
 | 
			
		||||
 | 
			
		||||
  /// The base feature set that almost all servers are supposed to support.
 | 
			
		||||
  enum class BASE_FEATURE_SET {
 | 
			
		||||
    YELLOWTEXT,       ///< Yellow text in in-character messages.
 | 
			
		||||
                      ///< @since 2.1.0
 | 
			
		||||
    FLIPPING,         ///< The ability to mirror a character in-game.
 | 
			
		||||
                      ///< @since 2.1.0
 | 
			
		||||
    CUSTOMOBJECTIONS, ///< Enables the use of a single custom objection named
 | 
			
		||||
                      ///< `custom`.
 | 
			
		||||
                      ///< @since 2.1.0
 | 
			
		||||
    FASTLOADING,  ///< Enables the use of "fast loading" instead of the legacy
 | 
			
		||||
                  ///< loading protocol.
 | 
			
		||||
                  ///< @since 2.1.0
 | 
			
		||||
    NOENCRYPTION, ///< Disables "FantaCrypt" for the remainder of  the session.
 | 
			
		||||
                  ///< @since 2.1.0
 | 
			
		||||
    DESKMOD,  ///< Allows forcing the appearance or disappearance of the desk.
 | 
			
		||||
              ///< @since 2.3 to 2.5
 | 
			
		||||
    EVIDENCE, ///< Allows creating and presenting evidence.
 | 
			
		||||
              ///< @since 2.3 to 2.5
 | 
			
		||||
    CCCC_IC_SUPPORT, ///< The ability to pair up with another user's character,
 | 
			
		||||
                     ///< the ability to change one's displayed name
 | 
			
		||||
                     ///< in-character ("showname"), and the ability to perform
 | 
			
		||||
                     ///< "immediate" preanimations (ones that happen alongside
 | 
			
		||||
                     ///< text display).
 | 
			
		||||
                     ///< @since 2.6.0
 | 
			
		||||
    ARUP, ///< Areas have more data about them than just their name (including
 | 
			
		||||
          ///< their status, their "lockedness", and who is the Case Master in
 | 
			
		||||
          ///< the area), and sets the client up to receive and send ARUP
 | 
			
		||||
          ///< packets.
 | 
			
		||||
          ///< @since 2.6.0
 | 
			
		||||
    CASING_ALERTS, ///< The client gains a new window to announce cases with,
 | 
			
		||||
                   ///< and the settings to set itself up to receive case alerts
 | 
			
		||||
                   ///< based on casing preferences. No longer used.
 | 
			
		||||
                   ///< @since 2.6.0
 | 
			
		||||
    MODCALL_REASON, ///< Enables entering a custom reason for calling
 | 
			
		||||
                    ///< moderators.
 | 
			
		||||
                    ///< @since 2.6.0
 | 
			
		||||
    LOOPING_SFX,    ///< Enables looping SFX extensions for the in-character
 | 
			
		||||
                    ///< command.
 | 
			
		||||
                    ///< @since 2.8.0
 | 
			
		||||
    ADDITIVE, ///< Enables "additive" text that allows in-character messages to
 | 
			
		||||
              ///< concatenate to the previous one sent by the same character.
 | 
			
		||||
              ///< @since 2.8.0
 | 
			
		||||
    EFFECTS,  ///< Enables effect overlays.
 | 
			
		||||
              ///< @since 2.8.0
 | 
			
		||||
    Y_OFFSET, ///< Enables support for vertical offsets.
 | 
			
		||||
              ///< @since 2.9.0
 | 
			
		||||
    EXPANDED_DESK_MODS, ///< Enables desk modifiers 2 through 5.
 | 
			
		||||
                        ///< @since 2.9.0
 | 
			
		||||
    AUTH_PACKET,        ///< Enables the use of the AUTH packet.
 | 
			
		||||
                        ///< @since 2.9.1
 | 
			
		||||
    PREZOOM,            ///< Preanim zoom.
 | 
			
		||||
    CUSTOM_BLIPS ///< Allows the in-character messages to contain data about
 | 
			
		||||
                 ///< what blips to use for the character's current message.
 | 
			
		||||
  };
 | 
			
		||||
  Q_ENUM_NS(BASE_FEATURE_SET)
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @brief Arranges data about the server the client is connected to.
 | 
			
		||||
   */
 | 
			
		||||
  class ServerData {
 | 
			
		||||
  public:
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Returns true if one of the standard features exists on the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @details Internally, this calls get_feature(const QString &f_feature)
 | 
			
		||||
     * with the enum's value converted to string.
 | 
			
		||||
     *
 | 
			
		||||
     * @param f_feature The feature to check for.
 | 
			
		||||
     *
 | 
			
		||||
     * @return True if the feature exists on the server.
 | 
			
		||||
     */
 | 
			
		||||
    bool get_feature(const BASE_FEATURE_SET &f_feature) const;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Returns true if the feature exists on the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @param f_feature The feature to check for. Case insensitive.
 | 
			
		||||
     *
 | 
			
		||||
     * @return True if the feature exists on the server.
 | 
			
		||||
     */
 | 
			
		||||
    bool get_feature(const QString &f_feature) const;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Sets the feature list, overwriting the existing one.
 | 
			
		||||
     *
 | 
			
		||||
     * @param f_feature_list The new feature list of the server.
 | 
			
		||||
     */
 | 
			
		||||
    void set_features(const QStringList &f_feature_list);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Self-explanatory: gets the software the server is running on.
 | 
			
		||||
     *
 | 
			
		||||
     * @return As brief description.
 | 
			
		||||
     */
 | 
			
		||||
    QString get_server_software() const;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Self-explanatory: setter for server software.
 | 
			
		||||
     *
 | 
			
		||||
     * @param f_software The new server software.
 | 
			
		||||
     */
 | 
			
		||||
    void set_server_software(const QString &f_software);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Getter for the server's asset URL.
 | 
			
		||||
     *
 | 
			
		||||
     * @return As brief description.
 | 
			
		||||
     *
 | 
			
		||||
     * @see m_asset_url
 | 
			
		||||
     */
 | 
			
		||||
    QString get_asset_url() const;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Attempts to set the new asset URL for the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @details The function converts the sole parameter into UTF-8, then
 | 
			
		||||
     * attempts to percent decode it. The  URL is only set if all these steps
 | 
			
		||||
     * successfully happen.
 | 
			
		||||
     *
 | 
			
		||||
     * @param f_asset_url A QString that contains the URL.
 | 
			
		||||
     */
 | 
			
		||||
    void set_asset_url(const QString &f_asset_url);
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
    /// The features available on the server. Determines what
 | 
			
		||||
    QStringList m_features;
 | 
			
		||||
 | 
			
		||||
    /// The software the server is running.
 | 
			
		||||
    QString m_server_software;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief A QString of an URL that defines the content repository
 | 
			
		||||
     *        send by the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @details Introduced in Version 2.9.2.
 | 
			
		||||
     *        Addresses the issue of contenturl devlivery for WebAO
 | 
			
		||||
     *        without relying on someone adding the link manually.
 | 
			
		||||
     */
 | 
			
		||||
    QString m_asset_url;
 | 
			
		||||
  };
 | 
			
		||||
} // namespace server
 | 
			
		||||
 | 
			
		||||
#endif // SERVERDATA_H
 | 
			
		||||
@ -1,13 +0,0 @@
 | 
			
		||||
#ifndef TEXT_FILE_FUNCTIONS_H
 | 
			
		||||
#define TEXT_FILE_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
 | 
			
		||||
#endif // TEXT_FILE_FUNCTIONS_H
 | 
			
		||||
@ -1,44 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#ifndef ADD_SERVER_DIALOG_H
 | 
			
		||||
#define ADD_SERVER_DIALOG_H
 | 
			
		||||
 | 
			
		||||
#include "interfaces/server_dialog.h"
 | 
			
		||||
 | 
			
		||||
class QComboBox;
 | 
			
		||||
class QDialogButton;
 | 
			
		||||
class QDialogButtonBox;
 | 
			
		||||
class QLabel;
 | 
			
		||||
class QLineEdit;
 | 
			
		||||
class QPlainTextEdit;
 | 
			
		||||
class QPushButton;
 | 
			
		||||
class QSpinBox;
 | 
			
		||||
 | 
			
		||||
class AddServerDialog : public AttorneyOnline::UI::FavoriteServerDialog {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  AddServerDialog();
 | 
			
		||||
  ~AddServerDialog() = default;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *ui_widget;
 | 
			
		||||
 | 
			
		||||
  QLineEdit *ui_server_display_name_edit;
 | 
			
		||||
  QLineEdit *ui_server_hostname_edit;
 | 
			
		||||
  QSpinBox *ui_server_port_box;
 | 
			
		||||
  QComboBox *ui_server_protocol_box;
 | 
			
		||||
  QPlainTextEdit *ui_server_description_edit;
 | 
			
		||||
  QDialogButtonBox *ui_server_dialog_button;
 | 
			
		||||
 | 
			
		||||
  // Legacy Server UI
 | 
			
		||||
  QLabel *ui_server_legacy_lbl;
 | 
			
		||||
  QLineEdit *ui_server_legacy_edit;
 | 
			
		||||
  QPushButton *ui_server_legacy_load_button;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void onSavePressed() override;
 | 
			
		||||
  void onCancelPressed() override;
 | 
			
		||||
  void parseLegacyServerEntry();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ADD_SERVER_DIALOG_H
 | 
			
		||||
@ -1,46 +0,0 @@
 | 
			
		||||
#ifndef DIRECT_CONNECT_DIALOG_H
 | 
			
		||||
#define DIRECT_CONNECT_DIALOG_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QRegularExpression>
 | 
			
		||||
 | 
			
		||||
class QLabel;
 | 
			
		||||
class QSpinBox;
 | 
			
		||||
class QLineEdit;
 | 
			
		||||
class QPushButton;
 | 
			
		||||
class QComboBox;
 | 
			
		||||
class QLabel;
 | 
			
		||||
class NetworkManager;
 | 
			
		||||
 | 
			
		||||
class DirectConnectDialog : public QDialog {
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    DirectConnectDialog(NetworkManager* p_net_manager);
 | 
			
		||||
    ~DirectConnectDialog() = default;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void onConnectPressed();
 | 
			
		||||
    void onServerConnected();
 | 
			
		||||
    void onConnectTimeout();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    NetworkManager* net_manager;
 | 
			
		||||
 | 
			
		||||
    QLineEdit* ui_direct_hostname_edit;
 | 
			
		||||
 | 
			
		||||
    QLabel* ui_direct_connection_status_lbl;
 | 
			
		||||
    QPushButton* ui_direct_connect_button;
 | 
			
		||||
    QPushButton* ui_direct_cancel_button;
 | 
			
		||||
 | 
			
		||||
    QWidget* ui_widget;
 | 
			
		||||
    QTimer connect_timeout;
 | 
			
		||||
 | 
			
		||||
    const int TCP_INDEX = 0;
 | 
			
		||||
    const QRegularExpression SCHEME_PATTERN{"^\\w+://.+$"};
 | 
			
		||||
    const int CONNECT_TIMEOUT = 5 * 1000;
 | 
			
		||||
    const QString DEFAULT_UI = "direct_connect_dialog.ui";;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // DIRECT_CONNECT_DIALOG_H
 | 
			
		||||
@ -1,46 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#ifndef EDIT_SERVER_DIALOG_H
 | 
			
		||||
#define EDIT_SERVER_DIALOG_H
 | 
			
		||||
 | 
			
		||||
#include "interfaces/server_dialog.h"
 | 
			
		||||
 | 
			
		||||
class QPushButton;
 | 
			
		||||
class QDialogButton;
 | 
			
		||||
class QLabel;
 | 
			
		||||
class QLineEdit;
 | 
			
		||||
class QComboBox;
 | 
			
		||||
class QSpinBox;
 | 
			
		||||
class QPlainTextEdit;
 | 
			
		||||
class QDialogButtonBox;
 | 
			
		||||
 | 
			
		||||
class EditServerDialog : public AttorneyOnline::UI::FavoriteServerDialog {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    EditServerDialog(int index);
 | 
			
		||||
    ~EditServerDialog() = default;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *ui_widget;
 | 
			
		||||
 | 
			
		||||
  QLineEdit *ui_server_display_name_edit;
 | 
			
		||||
  QLineEdit *ui_server_hostname_edit;
 | 
			
		||||
  QSpinBox *ui_server_port_box;
 | 
			
		||||
  QComboBox *ui_server_protocol_box;
 | 
			
		||||
  QPlainTextEdit *ui_server_description_edit;
 | 
			
		||||
  QDialogButtonBox *ui_server_dialog_button;
 | 
			
		||||
 | 
			
		||||
  // Legacy Server UI
 | 
			
		||||
  QLabel *ui_server_legacy_lbl;
 | 
			
		||||
  QLineEdit *ui_server_legacy_edit;
 | 
			
		||||
  QPushButton *ui_server_legacy_load_button;
 | 
			
		||||
 | 
			
		||||
  int index;
 | 
			
		||||
  void loadEntry();
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void onSavePressed() override;
 | 
			
		||||
  void onCancelPressed() override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // EDIT_SERVER_DIALOG_H
 | 
			
		||||
@ -1 +0,0 @@
 | 
			
		||||
IDI_ICON1               ICON    "logo_ao2.ico"
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 97 KiB  | 
| 
		 Before Width: | Height: | Size: 22 KiB  | 
@ -1,19 +0,0 @@
 | 
			
		||||
<RCC>
 | 
			
		||||
    <qresource prefix="/">
 | 
			
		||||
        <file>resource/fonts/Ace-Attorney.ttf</file>
 | 
			
		||||
        <file>resource/logo_ao2.png</file>
 | 
			
		||||
        <file>resource/translations/ao_de.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_en.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_es.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_jp.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_pl.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_pt.qm</file>
 | 
			
		||||
        <file>resource/translations/ao_ru.qm</file>
 | 
			
		||||
        <file>resource/ui/options_dialog.ui</file>
 | 
			
		||||
        <file>resource/ui/favorite_server_dialog.ui</file>
 | 
			
		||||
        <file>resource/ui/direct_connect_dialog.ui</file>
 | 
			
		||||
        <file>resource/ui/lobby.ui</file>
 | 
			
		||||
        <file>resource/ui/lobby_assets/down-arrow.png</file>
 | 
			
		||||
        <file>resource/ui/lobby_assets/up-arrow.png</file>
 | 
			
		||||
    </qresource>
 | 
			
		||||
</RCC>
 | 
			
		||||
@ -1,39 +0,0 @@
 | 
			
		||||
target_sources(Attorney_Online PRIVATE
 | 
			
		||||
aoapplication.cpp
 | 
			
		||||
aoblipplayer.cpp
 | 
			
		||||
aobutton.cpp
 | 
			
		||||
aocaseannouncerdialog.cpp
 | 
			
		||||
aocharbutton.cpp
 | 
			
		||||
aoclocklabel.cpp
 | 
			
		||||
aoemotebutton.cpp
 | 
			
		||||
aoemotepreview.cpp
 | 
			
		||||
aoevidencebutton.cpp
 | 
			
		||||
aoevidencedisplay.cpp
 | 
			
		||||
aoimage.cpp
 | 
			
		||||
aolayer.cpp
 | 
			
		||||
aomusicplayer.cpp
 | 
			
		||||
aooptionsdialog.cpp
 | 
			
		||||
aoclocklabel.cpp
 | 
			
		||||
aopacket.cpp
 | 
			
		||||
aosfxplayer.cpp
 | 
			
		||||
aotextarea.cpp
 | 
			
		||||
aoutils.cpp
 | 
			
		||||
charselect.cpp
 | 
			
		||||
chatlogpiece.cpp
 | 
			
		||||
courtroom.cpp
 | 
			
		||||
debug_functions.cpp
 | 
			
		||||
demoserver.cpp
 | 
			
		||||
discord_rich_presence.cpp
 | 
			
		||||
emotes.cpp
 | 
			
		||||
evidence.cpp
 | 
			
		||||
file_functions.cpp
 | 
			
		||||
hardware_functions.cpp
 | 
			
		||||
lobby.cpp
 | 
			
		||||
main.cpp
 | 
			
		||||
misc_functions.cpp
 | 
			
		||||
networkmanager.cpp
 | 
			
		||||
packet_distribution.cpp
 | 
			
		||||
path_functions.cpp
 | 
			
		||||
scrolltext.cpp
 | 
			
		||||
text_file_functions.cpp
 | 
			
		||||
)
 | 
			
		||||
@ -1,24 +1,24 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include "bassmidi.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include "options.h"
 | 
			
		||||
 | 
			
		||||
#include "widgets/aooptionsdialog.h"
 | 
			
		||||
 | 
			
		||||
#include <bassmidi.h>
 | 
			
		||||
 | 
			
		||||
static QtMessageHandler original_message_handler;
 | 
			
		||||
static AOApplication *message_handler_context;
 | 
			
		||||
void message_handler(QtMsgType type, const QMessageLogContext &context,
 | 
			
		||||
                     const QString &msg)
 | 
			
		||||
void message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
 | 
			
		||||
{
 | 
			
		||||
  emit message_handler_context->qt_log_message(type, context, msg);
 | 
			
		||||
  Q_EMIT message_handler_context->qt_log_message(type, context, msg);
 | 
			
		||||
  original_message_handler(type, context, msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
 | 
			
		||||
AOApplication::AOApplication(int &argc, char **argv)
 | 
			
		||||
    : QApplication(argc, argv)
 | 
			
		||||
{
 | 
			
		||||
  net_manager = new NetworkManager(this);
 | 
			
		||||
  discord = new AttorneyOnline::Discord();
 | 
			
		||||
@ -40,15 +40,20 @@ AOApplication::~AOApplication()
 | 
			
		||||
  qInstallMessageHandler(original_message_handler);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AOApplication::is_lobby_constructed()
 | 
			
		||||
{
 | 
			
		||||
  return w_lobby;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::construct_lobby()
 | 
			
		||||
{
 | 
			
		||||
  if (lobby_constructed) {
 | 
			
		||||
  if (is_lobby_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    qWarning() << "lobby was attempted constructed when it already exists";
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  w_lobby = new Lobby(this, net_manager);
 | 
			
		||||
  lobby_constructed = true;
 | 
			
		||||
 | 
			
		||||
  QRect geometry = QGuiApplication::primaryScreen()->geometry();
 | 
			
		||||
  int x = (geometry.width() - w_lobby->width()) / 2;
 | 
			
		||||
@ -56,72 +61,85 @@ void AOApplication::construct_lobby()
 | 
			
		||||
  w_lobby->move(x, y);
 | 
			
		||||
 | 
			
		||||
  if (Options::getInstance().discordEnabled())
 | 
			
		||||
  {
 | 
			
		||||
    discord->state_lobby();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (demo_server)
 | 
			
		||||
      demo_server->deleteLater();
 | 
			
		||||
  {
 | 
			
		||||
    demo_server->deleteLater();
 | 
			
		||||
  }
 | 
			
		||||
  demo_server = new DemoServer(this);
 | 
			
		||||
  w_lobby->show();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::destruct_lobby()
 | 
			
		||||
{
 | 
			
		||||
  if (!lobby_constructed) {
 | 
			
		||||
  if (!is_lobby_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    qWarning() << "lobby was attempted destructed when it did not exist";
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  delete w_lobby;
 | 
			
		||||
  w_lobby = nullptr;
 | 
			
		||||
  lobby_constructed = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AOApplication::is_courtroom_constructed()
 | 
			
		||||
{
 | 
			
		||||
  return w_courtroom;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::construct_courtroom()
 | 
			
		||||
{
 | 
			
		||||
  if (courtroom_constructed) {
 | 
			
		||||
  if (is_courtroom_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    qWarning() << "courtroom was attempted constructed when it already exists";
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  w_courtroom = new Courtroom(this);
 | 
			
		||||
  courtroom_constructed = true;
 | 
			
		||||
 | 
			
		||||
  QRect geometry = QGuiApplication::primaryScreen()->geometry();
 | 
			
		||||
  int x = (geometry.width() - w_courtroom->width()) / 2;
 | 
			
		||||
  int y = (geometry.height() - w_courtroom->height()) / 2;
 | 
			
		||||
  w_courtroom->move(x, y);
 | 
			
		||||
 | 
			
		||||
  if (demo_server != nullptr) {
 | 
			
		||||
    QObject::connect(demo_server, &DemoServer::skip_timers,
 | 
			
		||||
                     w_courtroom, &Courtroom::skip_clocks);
 | 
			
		||||
  if (demo_server != nullptr)
 | 
			
		||||
  {
 | 
			
		||||
    QObject::connect(demo_server, &DemoServer::skip_timers, w_courtroom, &Courtroom::skip_clocks);
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    qWarning() << "demo server did not exist during courtroom construction";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::destruct_courtroom()
 | 
			
		||||
{
 | 
			
		||||
  if (!courtroom_constructed) {
 | 
			
		||||
  if (!is_courtroom_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    qWarning() << "courtroom was attempted destructed when it did not exist";
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  delete w_courtroom;
 | 
			
		||||
  w_courtroom = nullptr;
 | 
			
		||||
  courtroom_constructed = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_version_string()
 | 
			
		||||
{
 | 
			
		||||
  return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." +
 | 
			
		||||
         QString::number(MINOR_VERSION);
 | 
			
		||||
  return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::server_disconnected()
 | 
			
		||||
{
 | 
			
		||||
  if (courtroom_constructed) {
 | 
			
		||||
    call_notice(tr("Disconnected from server."));
 | 
			
		||||
  if (is_courtroom_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    if (w_courtroom->isVisible())
 | 
			
		||||
    {
 | 
			
		||||
      call_notice(tr("Disconnected from server."));
 | 
			
		||||
    }
 | 
			
		||||
    construct_lobby();
 | 
			
		||||
    destruct_courtroom();
 | 
			
		||||
  }
 | 
			
		||||
@ -135,22 +153,21 @@ void AOApplication::loading_cancelled()
 | 
			
		||||
 | 
			
		||||
void AOApplication::call_settings_menu()
 | 
			
		||||
{
 | 
			
		||||
    AOOptionsDialog* l_dialog = new AOOptionsDialog(nullptr, this);
 | 
			
		||||
    if (courtroom_constructed) {
 | 
			
		||||
        connect(l_dialog, &AOOptionsDialog::reloadThemeRequest,
 | 
			
		||||
                w_courtroom, &Courtroom::on_reload_theme_clicked);
 | 
			
		||||
    }
 | 
			
		||||
  AOOptionsDialog *l_dialog = new AOOptionsDialog(this);
 | 
			
		||||
  if (is_courtroom_constructed())
 | 
			
		||||
  {
 | 
			
		||||
    connect(l_dialog, &AOOptionsDialog::reloadThemeRequest, w_courtroom, &Courtroom::on_reload_theme_clicked);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    if(lobby_constructed) {
 | 
			
		||||
    }
 | 
			
		||||
    l_dialog->exec();
 | 
			
		||||
    delete l_dialog;
 | 
			
		||||
  if (is_lobby_constructed())
 | 
			
		||||
  {}
 | 
			
		||||
  l_dialog->exec();
 | 
			
		||||
  delete l_dialog;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Callback for when BASS device is lost
 | 
			
		||||
// Only actually used for music syncs
 | 
			
		||||
void CALLBACK AOApplication::BASSreset(HSTREAM handle, DWORD channel,
 | 
			
		||||
                                       DWORD data, void *user)
 | 
			
		||||
void CALLBACK AOApplication::BASSreset(HSTREAM handle, DWORD channel, DWORD data, void *user)
 | 
			
		||||
{
 | 
			
		||||
  Q_UNUSED(handle);
 | 
			
		||||
  Q_UNUSED(channel);
 | 
			
		||||
@ -175,16 +192,19 @@ void AOApplication::initBASS()
 | 
			
		||||
  unsigned int a = 0;
 | 
			
		||||
  BASS_DEVICEINFO info;
 | 
			
		||||
 | 
			
		||||
  if (Options::getInstance().audioOutputDevice() == "default") {
 | 
			
		||||
  if (Options::getInstance().audioOutputDevice() == "default")
 | 
			
		||||
  {
 | 
			
		||||
    BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
 | 
			
		||||
    load_bass_plugins();
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
 | 
			
		||||
      if (Options::getInstance().audioOutputDevice() == info.name) {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
			
		||||
    {
 | 
			
		||||
      if (Options::getInstance().audioOutputDevice() == info.name)
 | 
			
		||||
      {
 | 
			
		||||
        BASS_SetDevice(a);
 | 
			
		||||
        BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr,
 | 
			
		||||
                  nullptr);
 | 
			
		||||
        BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
 | 
			
		||||
        load_bass_plugins();
 | 
			
		||||
        qInfo() << info.name << "was set as the default audio output device.";
 | 
			
		||||
        BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, QString(get_base_path() + "soundfont.sf2").toStdString().c_str());
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,4 @@
 | 
			
		||||
#ifndef AOAPPLICATION_H
 | 
			
		||||
#define AOAPPLICATION_H
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
@ -8,46 +7,40 @@
 | 
			
		||||
#include "serverdata.h"
 | 
			
		||||
#include "widgets/aooptionsdialog.h"
 | 
			
		||||
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
#include <bass.h>
 | 
			
		||||
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QRect>
 | 
			
		||||
 | 
			
		||||
#include <QCryptographicHash>
 | 
			
		||||
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QCryptographicHash>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QElapsedTimer>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QRect>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
 | 
			
		||||
#include <QElapsedTimer>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
 | 
			
		||||
class NetworkManager;
 | 
			
		||||
class Lobby;
 | 
			
		||||
class Courtroom;
 | 
			
		||||
class Options;
 | 
			
		||||
 | 
			
		||||
class VPath : QString {
 | 
			
		||||
class VPath : QString
 | 
			
		||||
{
 | 
			
		||||
  using QString::QString;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  explicit VPath(const QString &str) : QString(str) {}
 | 
			
		||||
  inline QString const &toQString() const { return *this; }
 | 
			
		||||
  inline bool operator==(const VPath &str) const {
 | 
			
		||||
    return this->toQString() == str.toQString();
 | 
			
		||||
  }
 | 
			
		||||
  inline VPath operator+(const VPath &str) const {
 | 
			
		||||
    return VPath(this->toQString() + str.toQString());
 | 
			
		||||
  }
 | 
			
		||||
  explicit VPath(const QString &str)
 | 
			
		||||
      : QString(str)
 | 
			
		||||
  {}
 | 
			
		||||
  inline const QString &toQString() const { return *this; }
 | 
			
		||||
  inline bool operator==(const VPath &str) const { return this->toQString() == str.toQString(); }
 | 
			
		||||
  inline VPath operator+(const VPath &str) const { return VPath(this->toQString() + str.toQString()); }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline uint qHash(const VPath &key, uint seed = qGlobalQHashSeed())
 | 
			
		||||
@ -55,7 +48,8 @@ inline uint qHash(const VPath &key, uint seed = qGlobalQHashSeed())
 | 
			
		||||
  return qHash(key.toQString(), seed);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class AOApplication : public QApplication {
 | 
			
		||||
class AOApplication : public QApplication
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
@ -63,27 +57,25 @@ public:
 | 
			
		||||
  ~AOApplication();
 | 
			
		||||
 | 
			
		||||
  NetworkManager *net_manager;
 | 
			
		||||
  Lobby *w_lobby;
 | 
			
		||||
  Courtroom *w_courtroom;
 | 
			
		||||
  Lobby *w_lobby = nullptr;
 | 
			
		||||
  Courtroom *w_courtroom = nullptr;
 | 
			
		||||
  AttorneyOnline::Discord *discord;
 | 
			
		||||
 | 
			
		||||
  QFont default_font;
 | 
			
		||||
 | 
			
		||||
  bool lobby_constructed = false;
 | 
			
		||||
  bool courtroom_constructed = false;
 | 
			
		||||
 | 
			
		||||
  bool is_lobby_constructed();
 | 
			
		||||
  void construct_lobby();
 | 
			
		||||
  void destruct_lobby();
 | 
			
		||||
 | 
			
		||||
  bool is_courtroom_constructed();
 | 
			
		||||
  void construct_courtroom();
 | 
			
		||||
  void destruct_courtroom();
 | 
			
		||||
 | 
			
		||||
  void server_packet_received(AOPacket *p_packet);
 | 
			
		||||
  void server_packet_received(AOPacket p_packet);
 | 
			
		||||
 | 
			
		||||
  void send_server_packet(AOPacket *p_packet);
 | 
			
		||||
  void send_server_packet(AOPacket p_packet);
 | 
			
		||||
 | 
			
		||||
  void call_settings_menu();
 | 
			
		||||
  void call_announce_menu(Courtroom *court);
 | 
			
		||||
 | 
			
		||||
  qint64 latency = 0;
 | 
			
		||||
  QString window_title;
 | 
			
		||||
@ -114,18 +106,11 @@ public:
 | 
			
		||||
  static const int MAJOR_VERSION = 10;
 | 
			
		||||
  static const int MINOR_VERSION = 1;
 | 
			
		||||
 | 
			
		||||
  // Adds the server to favorite_servers.ini
 | 
			
		||||
  void add_favorite_server(int p_server);
 | 
			
		||||
  void remove_favorite_server(int p_server);
 | 
			
		||||
 | 
			
		||||
  void set_server_list(QVector<server_type> &servers) { server_list = servers; }
 | 
			
		||||
  QVector<server_type> &get_server_list() { return server_list; }
 | 
			
		||||
 | 
			
		||||
  // Returns the character the player has currently selected
 | 
			
		||||
  QString get_current_char();
 | 
			
		||||
  void set_server_list(QVector<ServerInfo> &servers) { server_list = servers; }
 | 
			
		||||
  QVector<ServerInfo> &get_server_list() { return server_list; }
 | 
			
		||||
 | 
			
		||||
  // implementation in path_functions.cpp
 | 
			
		||||
  VPath get_theme_path(QString p_file, QString p_theme="");
 | 
			
		||||
  VPath get_theme_path(QString p_file, QString p_theme = QString());
 | 
			
		||||
  VPath get_character_path(QString p_char, QString p_file);
 | 
			
		||||
  VPath get_misc_path(QString p_misc, QString p_file);
 | 
			
		||||
  VPath get_sounds_path(QString p_file);
 | 
			
		||||
@ -133,18 +118,17 @@ public:
 | 
			
		||||
  VPath get_background_path(QString p_file);
 | 
			
		||||
  VPath get_default_background_path(QString p_file);
 | 
			
		||||
  VPath get_evidence_path(QString p_file);
 | 
			
		||||
  QVector<VPath> get_asset_paths(QString p_element, QString p_theme="", QString p_subtheme="", QString p_default_theme="", QString p_misc="", QString p_character="", QString p_placeholder="");
 | 
			
		||||
  QVector<VPath> get_asset_paths(QString p_element, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString(), QString p_character = QString(), QString p_placeholder = QString());
 | 
			
		||||
  QString get_asset_path(QVector<VPath> pathlist);
 | 
			
		||||
  QString get_image_path(QVector<VPath> pathlist, bool static_image=false);
 | 
			
		||||
  QString get_image_path(QVector<VPath> pathlist, bool static_image = false);
 | 
			
		||||
  QString get_sfx_path(QVector<VPath> pathlist);
 | 
			
		||||
  QString get_config_value(QString p_identifier, QString p_config, QString p_theme="", QString p_subtheme="", QString p_default_theme="", QString p_misc="");
 | 
			
		||||
  QString get_asset(QString p_element, QString p_theme="", QString p_subtheme="", QString p_default_theme="", QString p_misc="", QString p_character="", QString p_placeholder="");
 | 
			
		||||
  QString get_image(QString p_element, QString p_theme="", QString p_subtheme="", QString p_default_theme="", QString p_misc="", QString p_character="", QString p_placeholder="", bool static_image=false);
 | 
			
		||||
  QString get_sfx(QString p_sfx, QString p_misc="", QString p_character="");
 | 
			
		||||
  QString get_pos_path(const QString& pos, bool desk = false);
 | 
			
		||||
  QString get_config_value(QString p_identifier, QString p_config, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString());
 | 
			
		||||
  QString get_asset(QString p_element, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString(), QString p_character = QString(), QString p_placeholder = QString());
 | 
			
		||||
  QString get_image(QString p_element, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString(), QString p_character = QString(), QString p_placeholder = QString(), bool static_image = false);
 | 
			
		||||
  QString get_sfx(QString p_sfx, QString p_misc = QString(), QString p_character = QString());
 | 
			
		||||
  QString get_pos_path(const QString &pos, bool desk = false);
 | 
			
		||||
  QString get_case_sensitive_path(QString p_file);
 | 
			
		||||
  QString get_real_path(const VPath &vpath, const QStringList &suffixes={""});
 | 
			
		||||
  void invalidate_lookup_cache();
 | 
			
		||||
  QString get_real_path(const VPath &vpath, const QStringList &suffixes = {""});
 | 
			
		||||
 | 
			
		||||
  ////// Functions for reading and writing files //////
 | 
			
		||||
  // Implementations file_functions.cpp
 | 
			
		||||
@ -188,15 +172,10 @@ public:
 | 
			
		||||
  QPoint get_button_spacing(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the dimensions of widget with specified identifier from p_file
 | 
			
		||||
  pos_size_type get_element_dimensions(QString p_identifier, QString p_file,
 | 
			
		||||
                                       QString p_misc = "");
 | 
			
		||||
  pos_size_type get_element_dimensions(QString p_identifier, QString p_file, QString p_misc = QString());
 | 
			
		||||
 | 
			
		||||
  // Returns the value to you
 | 
			
		||||
  QString get_design_element(QString p_identifier, QString p_file,
 | 
			
		||||
                             QString p_misc = "");
 | 
			
		||||
 | 
			
		||||
  // Returns the value of font_size with p_identifier from p_file
 | 
			
		||||
  int get_font_size(QString p_identifier, QString p_file);
 | 
			
		||||
  QString get_design_element(QString p_identifier, QString p_file, QString p_misc = QString());
 | 
			
		||||
 | 
			
		||||
  // Returns the color with p_identifier from p_file
 | 
			
		||||
  QColor get_color(QString p_identifier, QString p_file);
 | 
			
		||||
@ -212,32 +191,24 @@ public:
 | 
			
		||||
  QString get_penalty_value(QString p_identifier);
 | 
			
		||||
 | 
			
		||||
  // Returns the sfx with p_identifier from courtroom_sounds.ini in the current theme path
 | 
			
		||||
  QString get_court_sfx(QString p_identifier, QString p_misc="");
 | 
			
		||||
  QString get_court_sfx(QString p_identifier, QString p_misc = QString());
 | 
			
		||||
 | 
			
		||||
  // Figure out if we can opus this or if we should fall back to wav
 | 
			
		||||
  QString get_sfx_suffix(VPath sound_to_check);
 | 
			
		||||
 | 
			
		||||
  // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to
 | 
			
		||||
  // PNG.
 | 
			
		||||
  QString get_image_suffix(VPath path_to_check, bool static_image=false);
 | 
			
		||||
  QString get_image_suffix(VPath path_to_check, bool static_image = false);
 | 
			
		||||
 | 
			
		||||
  // Returns the value of p_search_line within target_tag and terminator_tag
 | 
			
		||||
  QString read_char_ini(QString p_char, QString p_search_line,
 | 
			
		||||
                        QString target_tag);
 | 
			
		||||
  QString read_char_ini(QString p_char, QString p_search_line, QString target_tag);
 | 
			
		||||
 | 
			
		||||
  // Returns a QStringList of all key=value definitions on a given tag.
 | 
			
		||||
  QStringList read_ini_tags(VPath p_file, QString target_tag = "");
 | 
			
		||||
 | 
			
		||||
  // Sets the char.ini p_search_line key under tag target_tag to value.
 | 
			
		||||
  void set_char_ini(QString p_char, QString value, QString p_search_line,
 | 
			
		||||
                    QString target_tag);
 | 
			
		||||
  QStringList read_ini_tags(VPath p_file, QString target_tag = QString());
 | 
			
		||||
 | 
			
		||||
  // Returns the text between target_tag and terminator_tag in p_file
 | 
			
		||||
  QString get_stylesheet(QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the text between target_tag and terminator_tag in p_file
 | 
			
		||||
  QString get_tagged_stylesheet(QString target_tag, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the side of the p_char character from that characters ini file
 | 
			
		||||
  QString get_char_side(QString p_char);
 | 
			
		||||
 | 
			
		||||
@ -294,9 +265,6 @@ public:
 | 
			
		||||
  // Returns the sfx of p_char's p_emote
 | 
			
		||||
  QString get_sfx_name(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the blipsound of p_char's p_emote
 | 
			
		||||
  QString get_emote_blip(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns if the sfx is defined as looping in char.ini
 | 
			
		||||
  QString get_sfx_looping(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
@ -340,7 +308,7 @@ public:
 | 
			
		||||
  // Currently defined subtheme
 | 
			
		||||
  QString subtheme;
 | 
			
		||||
 | 
			
		||||
  //Default is always default.
 | 
			
		||||
  // Default is always default.
 | 
			
		||||
  const QString default_theme = "default";
 | 
			
		||||
 | 
			
		||||
  // The file name of the log file in base/logs.
 | 
			
		||||
@ -348,26 +316,22 @@ public:
 | 
			
		||||
 | 
			
		||||
  void initBASS();
 | 
			
		||||
  static void load_bass_plugins();
 | 
			
		||||
  static void CALLBACK BASSreset(HSTREAM handle, DWORD channel, DWORD data,
 | 
			
		||||
                                 void *user);
 | 
			
		||||
  static void CALLBACK BASSreset(HSTREAM handle, DWORD channel, DWORD data, void *user);
 | 
			
		||||
  static void doBASSreset();
 | 
			
		||||
 | 
			
		||||
  QElapsedTimer demo_timer;
 | 
			
		||||
  DemoServer* demo_server = nullptr;
 | 
			
		||||
  DemoServer *demo_server = nullptr;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QVector<server_type> server_list;
 | 
			
		||||
  QVector<ServerInfo> server_list;
 | 
			
		||||
  QHash<uint, QString> asset_lookup_cache;
 | 
			
		||||
  QHash<uint, QString> dir_listing_cache;
 | 
			
		||||
  QSet<uint> dir_listing_exist_cache;
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
public Q_SLOTS:
 | 
			
		||||
  void server_disconnected();
 | 
			
		||||
  void loading_cancelled();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
  void qt_log_message(QtMsgType type, const QMessageLogContext &context,
 | 
			
		||||
                      const QString &msg);
 | 
			
		||||
Q_SIGNALS:
 | 
			
		||||
  void qt_log_message(QtMsgType type, const QMessageLogContext &context, const QString &msg);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOAPPLICATION_H
 | 
			
		||||
@ -1,60 +1,54 @@
 | 
			
		||||
#include "aoblipplayer.h"
 | 
			
		||||
 | 
			
		||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
AOBlipPlayer::AOBlipPlayer(AOApplication *ao_app)
 | 
			
		||||
    : ao_app(ao_app)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::setVolume(int value)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  m_volume = value;
 | 
			
		||||
  updateInternalVolume();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_blips(QString p_sfx)
 | 
			
		||||
void AOBlipPlayer::setMuted(bool enabled)
 | 
			
		||||
{
 | 
			
		||||
  QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx));
 | 
			
		||||
  m_muted = enabled;
 | 
			
		||||
  updateInternalVolume();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  for (int n_stream = 0; n_stream < 5; ++n_stream) {
 | 
			
		||||
    BASS_StreamFree(m_stream_list[n_stream]);
 | 
			
		||||
void AOBlipPlayer::setBlip(QString blip)
 | 
			
		||||
{
 | 
			
		||||
  QString path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(blip));
 | 
			
		||||
  for (int i = 0; i < STREAM_COUNT; ++i)
 | 
			
		||||
  {
 | 
			
		||||
    BASS_StreamFree(m_stream[i]);
 | 
			
		||||
 | 
			
		||||
    if (f_path.endsWith(".opus"))
 | 
			
		||||
      m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(
 | 
			
		||||
          FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
    if (path.endsWith(".opus"))
 | 
			
		||||
    {
 | 
			
		||||
      m_stream[i] = BASS_OPUS_StreamCreateFile(FALSE, path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      m_stream_list[n_stream] = BASS_StreamCreateFile(
 | 
			
		||||
          FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
    {
 | 
			
		||||
      m_stream[i] = BASS_StreamCreateFile(FALSE, path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
  updateInternalVolume();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::blip_tick()
 | 
			
		||||
void AOBlipPlayer::playBlip()
 | 
			
		||||
{
 | 
			
		||||
  int f_cycle = m_cycle++;
 | 
			
		||||
 | 
			
		||||
  if (m_cycle == 5)
 | 
			
		||||
    m_cycle = 0;
 | 
			
		||||
 | 
			
		||||
  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(f_stream, false);
 | 
			
		||||
  HSTREAM stream = m_stream[m_cycle];
 | 
			
		||||
  BASS_ChannelSetDevice(stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(stream, false);
 | 
			
		||||
  m_cycle = ++m_cycle % STREAM_COUNT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_muted(bool toggle)
 | 
			
		||||
void AOBlipPlayer::updateInternalVolume()
 | 
			
		||||
{
 | 
			
		||||
  m_muted = toggle;
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_volume(int p_value)
 | 
			
		||||
{
 | 
			
		||||
  m_volume = static_cast<qreal>(p_value) / 100;
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
  // If muted, volume will always be 0
 | 
			
		||||
  float volume = static_cast<float>(p_value) * !m_muted;
 | 
			
		||||
 | 
			
		||||
  for (int n_stream = 0; n_stream < 5; ++n_stream) {
 | 
			
		||||
    BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
 | 
			
		||||
  float volume = m_muted ? 0.0f : (m_volume * 0.01);
 | 
			
		||||
  for (int i = 0; i < STREAM_COUNT; ++i)
 | 
			
		||||
  {
 | 
			
		||||
    BASS_ChannelSetAttribute(m_stream[i], BASS_ATTRIB_VOL, volume);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										37
									
								
								src/aoblipplayer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,37 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <bass.h>
 | 
			
		||||
#include <bassopus.h>
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QElapsedTimer>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
class AOBlipPlayer
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
  static constexpr int STREAM_COUNT = 5;
 | 
			
		||||
 | 
			
		||||
  AOBlipPlayer(AOApplication *ao_app);
 | 
			
		||||
 | 
			
		||||
  void setVolume(int value);
 | 
			
		||||
  void setMuted(bool enabled);
 | 
			
		||||
 | 
			
		||||
  void setBlip(QString blip);
 | 
			
		||||
 | 
			
		||||
  void playBlip();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  int m_volume = 0;
 | 
			
		||||
  bool m_muted = false;
 | 
			
		||||
  HSTREAM m_stream[STREAM_COUNT]{};
 | 
			
		||||
  int m_cycle = 0;
 | 
			
		||||
 | 
			
		||||
  void updateInternalVolume();
 | 
			
		||||
};
 | 
			
		||||
@ -1,44 +1,75 @@
 | 
			
		||||
#include "aobutton.h"
 | 
			
		||||
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "options.h"
 | 
			
		||||
 | 
			
		||||
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
AOButton::AOButton(AOApplication *ao_app, QWidget *parent)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
    , ao_app(ao_app)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  movie = new QMovie(this);
 | 
			
		||||
  connect(movie, &QMovie::frameChanged, [this]{
 | 
			
		||||
    this->setIcon(movie->currentPixmap().scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
  m_movie = new QMovie(this);
 | 
			
		||||
 | 
			
		||||
  connect(m_movie, &QMovie::frameChanged, this, [this] {
 | 
			
		||||
    this->setIcon(m_movie->currentPixmap().scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
    this->setIconSize(QSize(this->width(), this->height()));
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOButton::~AOButton() {}
 | 
			
		||||
 | 
			
		||||
void AOButton::set_image(QString p_path, QString p_misc)
 | 
			
		||||
AOButton::~AOButton()
 | 
			
		||||
{
 | 
			
		||||
  movie->stop();
 | 
			
		||||
  QString p_image;
 | 
			
		||||
  p_image = ao_app->get_image(p_path, Options::getInstance().theme(), Options::getInstance().subTheme(),
 | 
			
		||||
                              ao_app->default_theme, p_misc, "", "", !Options::getInstance().animatedThemeEnabled());
 | 
			
		||||
  if (p_image.isEmpty()) {
 | 
			
		||||
      this->setIcon(QIcon());
 | 
			
		||||
      this->setIconSize(this->size());
 | 
			
		||||
      this->setStyleSheet("");
 | 
			
		||||
      return;
 | 
			
		||||
  deleteMovie();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOButton::setImage(QString image_name)
 | 
			
		||||
{
 | 
			
		||||
  deleteMovie();
 | 
			
		||||
 | 
			
		||||
  QString file_path = ao_app->get_image(image_name, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, QString(), QString(), QString(), !Options::getInstance().animatedThemeEnabled());
 | 
			
		||||
  if (file_path.isEmpty())
 | 
			
		||||
  {
 | 
			
		||||
    setStyleSheet(QString());
 | 
			
		||||
    setIcon(QIcon());
 | 
			
		||||
  }
 | 
			
		||||
  this->setText("");
 | 
			
		||||
  this->setStyleSheet("QPushButton { background-color: transparent; border: 0px }");
 | 
			
		||||
  movie->setFileName(p_image);
 | 
			
		||||
  // We double-check if the user wants animated themes, so even if an animated image slipped through,
 | 
			
		||||
  // we still set it static
 | 
			
		||||
  if (Options::getInstance().animatedThemeEnabled() && movie->frameCount() > 1) {
 | 
			
		||||
    movie->start();
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    this->setIcon(QPixmap(p_image).scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
    this->setIconSize(this->size());
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    setText(QString());
 | 
			
		||||
    setStyleSheet("QPushButton { background-color: transparent; border: 0px }");
 | 
			
		||||
 | 
			
		||||
    if (Options::getInstance().animatedThemeEnabled())
 | 
			
		||||
    {
 | 
			
		||||
      m_movie = new QMovie;
 | 
			
		||||
      m_movie->setFileName(file_path);
 | 
			
		||||
 | 
			
		||||
      connect(m_movie, &QMovie::frameChanged, this, &AOButton::handleNextFrame);
 | 
			
		||||
 | 
			
		||||
      m_movie->start();
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      updateIcon(QPixmap(file_path));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOButton::deleteMovie()
 | 
			
		||||
{
 | 
			
		||||
  if (m_movie)
 | 
			
		||||
  {
 | 
			
		||||
    disconnect(m_movie, &QMovie::frameChanged, this, &AOButton::handleNextFrame);
 | 
			
		||||
 | 
			
		||||
    m_movie->stop();
 | 
			
		||||
    m_movie->deleteLater();
 | 
			
		||||
    m_movie = nullptr;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOButton::handleNextFrame()
 | 
			
		||||
{
 | 
			
		||||
  updateIcon(m_movie->currentPixmap());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOButton::updateIcon(QPixmap icon)
 | 
			
		||||
{
 | 
			
		||||
  const QSize current_size = size();
 | 
			
		||||
  setIcon(icon.scaled(current_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
  setIconSize(current_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										29
									
								
								src/aobutton.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,29 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
 | 
			
		||||
class AOButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  explicit AOButton(AOApplication *ao_app, QWidget *parent = nullptr);
 | 
			
		||||
  virtual ~AOButton();
 | 
			
		||||
 | 
			
		||||
  void setImage(QString image_name);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  QMovie *m_movie = nullptr;
 | 
			
		||||
 | 
			
		||||
  void deleteMovie();
 | 
			
		||||
 | 
			
		||||
private Q_SLOTS:
 | 
			
		||||
  void handleNextFrame();
 | 
			
		||||
 | 
			
		||||
  void updateIcon(QPixmap icon);
 | 
			
		||||
};
 | 
			
		||||
@ -2,103 +2,82 @@
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
 | 
			
		||||
                           int y_pos, bool is_taken)
 | 
			
		||||
AOCharButton::AOCharButton(AOApplication *ao_app, QWidget *parent)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
    , ao_app(ao_app)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  taken = is_taken;
 | 
			
		||||
 | 
			
		||||
  int size = 60 * Options::getInstance().themeScalingFactor();
 | 
			
		||||
  int selector_size = 62 * Options::getInstance().themeScalingFactor();
 | 
			
		||||
 | 
			
		||||
  this->resize(size, size);
 | 
			
		||||
  this->move(x_pos, y_pos);
 | 
			
		||||
  resize(size, size);
 | 
			
		||||
 | 
			
		||||
  ui_taken = new AOImage(this, ao_app, true);
 | 
			
		||||
  ui_taken->resize(size, size);
 | 
			
		||||
  ui_taken->set_image("char_taken");
 | 
			
		||||
  ui_taken = new AOImage(ao_app, this);
 | 
			
		||||
  ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_taken->resize(size, size);
 | 
			
		||||
  ui_taken->setImage("char_taken");
 | 
			
		||||
  ui_taken->hide();
 | 
			
		||||
 | 
			
		||||
  ui_passworded = new AOImage(this, ao_app, true);
 | 
			
		||||
  ui_passworded->resize(size, size);
 | 
			
		||||
  ui_passworded->set_image("char_passworded");
 | 
			
		||||
  ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_passworded->hide();
 | 
			
		||||
 | 
			
		||||
  ui_selector = new AOImage(parent, ao_app, true);
 | 
			
		||||
  ui_selector->resize(selector_size, selector_size);
 | 
			
		||||
  int offset = Options::getInstance().themeScalingFactor();
 | 
			
		||||
  ui_selector->move(x_pos - offset, y_pos - offset);
 | 
			
		||||
  ui_selector->set_image("char_selector");
 | 
			
		||||
  ui_selector = new AOImage(ao_app, parent);
 | 
			
		||||
  ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_selector->resize(selector_size, selector_size);
 | 
			
		||||
  ui_selector->setImage("char_selector");
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::reset()
 | 
			
		||||
void AOCharButton::setTaken(bool enabled)
 | 
			
		||||
{
 | 
			
		||||
  ui_taken->hide();
 | 
			
		||||
  ui_passworded->hide();
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_taken(bool is_taken) { taken = is_taken; }
 | 
			
		||||
 | 
			
		||||
void AOCharButton::apply_taken_image()
 | 
			
		||||
{
 | 
			
		||||
  if (taken) {
 | 
			
		||||
  if (enabled)
 | 
			
		||||
  {
 | 
			
		||||
    ui_taken->move(0, 0);
 | 
			
		||||
    ui_taken->show();
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    ui_taken->hide();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_passworded() { ui_passworded->show(); }
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_image(QString p_character)
 | 
			
		||||
void AOCharButton::setCharacter(QString character)
 | 
			
		||||
{
 | 
			
		||||
  QString image_path = ao_app->get_image_suffix(
 | 
			
		||||
      ao_app->get_character_path(p_character, "char_icon"), true);
 | 
			
		||||
  QString image_path = ao_app->get_image_suffix(ao_app->get_character_path(character, "char_icon"), true);
 | 
			
		||||
 | 
			
		||||
  this->setText("");
 | 
			
		||||
  setText(QString());
 | 
			
		||||
 | 
			
		||||
  if (file_exists(image_path)) {
 | 
			
		||||
    this->setStyleSheet("QPushButton { border-image: url(\"" + image_path +
 | 
			
		||||
                        "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
                        "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                        "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  if (file_exists(image_path))
 | 
			
		||||
  {
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(\"" + image_path +
 | 
			
		||||
                  "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
                  "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                  "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    this->setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                        "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                        "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    this->setText(p_character);
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                  "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                  "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    setText(character);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
void AOCharButton::enterEvent(QEvent *e)
 | 
			
		||||
void AOCharButton::enterEvent(QEvent *event)
 | 
			
		||||
#else
 | 
			
		||||
void AOCharButton::enterEvent(QEnterEvent *e)
 | 
			
		||||
void AOCharButton::enterEvent(QEnterEvent *event)
 | 
			
		||||
#endif
 | 
			
		||||
{
 | 
			
		||||
  int offset = Options::getInstance().themeScalingFactor();
 | 
			
		||||
  ui_selector->move(this->x() - offset, this->y() - offset);
 | 
			
		||||
  ui_selector->move(x() - offset, y() - offset);
 | 
			
		||||
  ui_selector->raise();
 | 
			
		||||
  ui_selector->show();
 | 
			
		||||
 | 
			
		||||
  setFlat(false);
 | 
			
		||||
  QPushButton::enterEvent(e);
 | 
			
		||||
 | 
			
		||||
  QPushButton::enterEvent(event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::leaveEvent(QEvent *e)
 | 
			
		||||
void AOCharButton::leaveEvent(QEvent *event)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
  QPushButton::leaveEvent(e);
 | 
			
		||||
 | 
			
		||||
  QPushButton::leaveEvent(event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										36
									
								
								src/aocharbutton.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,36 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QEnterEvent>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
class AOCharButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOCharButton(AOApplication *ao_app, QWidget *parent);
 | 
			
		||||
 | 
			
		||||
  void setCharacter(QString character);
 | 
			
		||||
 | 
			
		||||
  void setTaken(bool enabled);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
  void enterEvent(QEvent *event) override;
 | 
			
		||||
#else
 | 
			
		||||
  void enterEvent(QEnterEvent *event) override;
 | 
			
		||||
#endif
 | 
			
		||||
  void leaveEvent(QEvent *event) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
  bool m_taken = false;
 | 
			
		||||
  AOImage *ui_taken;
 | 
			
		||||
  AOImage *ui_selector;
 | 
			
		||||
};
 | 
			
		||||
@ -1,10 +1,12 @@
 | 
			
		||||
#include "aoclocklabel.h"
 | 
			
		||||
 | 
			
		||||
AOClockLabel::AOClockLabel(QWidget *parent) : QLabel(parent) {}
 | 
			
		||||
AOClockLabel::AOClockLabel(QWidget *parent)
 | 
			
		||||
    : QLabel(parent)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::start()
 | 
			
		||||
{
 | 
			
		||||
  timer.start(1000 / 60, this);
 | 
			
		||||
  m_timer.start(1000 / 60, this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::start(qint64 msecs)
 | 
			
		||||
@ -15,16 +17,16 @@ void AOClockLabel::start(qint64 msecs)
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::set(qint64 msecs, bool update_text)
 | 
			
		||||
{
 | 
			
		||||
  target_time = QDateTime::currentDateTime().addMSecs(msecs);
 | 
			
		||||
  m_target_time = QDateTime::currentDateTime().addMSecs(msecs);
 | 
			
		||||
  if (update_text)
 | 
			
		||||
  {
 | 
			
		||||
    if (QDateTime::currentDateTime() >= target_time)
 | 
			
		||||
    if (QDateTime::currentDateTime() >= m_target_time)
 | 
			
		||||
    {
 | 
			
		||||
      this->setText("00:00:00.000");
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      qint64 ms_left = QDateTime::currentDateTime().msecsTo(target_time);
 | 
			
		||||
      qint64 ms_left = QDateTime::currentDateTime().msecsTo(m_target_time);
 | 
			
		||||
      QTime timeleft = QTime(0, 0).addMSecs(ms_left % (1000 * 3600 * 24));
 | 
			
		||||
      QString timestring = timeleft.toString("hh:mm:ss.zzz");
 | 
			
		||||
      this->setText(timestring);
 | 
			
		||||
@ -34,39 +36,42 @@ void AOClockLabel::set(qint64 msecs, bool update_text)
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::pause()
 | 
			
		||||
{
 | 
			
		||||
  timer.stop();
 | 
			
		||||
  m_timer.stop();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::stop()
 | 
			
		||||
{
 | 
			
		||||
  this->setText("00:00:00.000");
 | 
			
		||||
  timer.stop();
 | 
			
		||||
  m_timer.stop();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::skip(qint64 msecs)
 | 
			
		||||
{
 | 
			
		||||
  qint64 ms_left = QDateTime::currentDateTime().msecsTo(target_time);
 | 
			
		||||
  qint64 ms_left = QDateTime::currentDateTime().msecsTo(m_target_time);
 | 
			
		||||
  this->set(ms_left - msecs, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AOClockLabel::active()
 | 
			
		||||
{
 | 
			
		||||
  return timer.isActive();
 | 
			
		||||
  return m_timer.isActive();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClockLabel::timerEvent(QTimerEvent *event)
 | 
			
		||||
{
 | 
			
		||||
  if (event->timerId() == timer.timerId()) {
 | 
			
		||||
    if (QDateTime::currentDateTime() >= target_time)
 | 
			
		||||
  if (event->timerId() == m_timer.timerId())
 | 
			
		||||
  {
 | 
			
		||||
    if (QDateTime::currentDateTime() >= m_target_time)
 | 
			
		||||
    {
 | 
			
		||||
      this->stop();
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    qint64 ms_left = QDateTime::currentDateTime().msecsTo(target_time);
 | 
			
		||||
    qint64 ms_left = QDateTime::currentDateTime().msecsTo(m_target_time);
 | 
			
		||||
    QTime timeleft = QTime(0, 0).addMSecs(ms_left % (1000 * 3600 * 24));
 | 
			
		||||
    QString timestring = timeleft.toString("hh:mm:ss.zzz");
 | 
			
		||||
    this->setText(timestring);
 | 
			
		||||
  } else {
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    QWidget::timerEvent(event);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,18 @@
 | 
			
		||||
#ifndef AOCLOCKLABEL_H
 | 
			
		||||
#define AOCLOCKLABEL_H
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QBasicTimer>
 | 
			
		||||
#include <QTimerEvent>
 | 
			
		||||
#include <QDateTime>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QTimerEvent>
 | 
			
		||||
 | 
			
		||||
class AOClockLabel : public QLabel {
 | 
			
		||||
class AOClockLabel : public QLabel
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOClockLabel(QWidget *parent);
 | 
			
		||||
 | 
			
		||||
  void start();
 | 
			
		||||
  void start(qint64 msecs);
 | 
			
		||||
  void set(qint64 msecs, bool update_text = false);
 | 
			
		||||
@ -24,8 +25,6 @@ protected:
 | 
			
		||||
  void timerEvent(QTimerEvent *event) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    QBasicTimer timer;
 | 
			
		||||
    QDateTime target_time;
 | 
			
		||||
  QBasicTimer m_timer;
 | 
			
		||||
  QDateTime m_target_time;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOCLOCKLABEL_H
 | 
			
		||||
@ -1,78 +1,79 @@
 | 
			
		||||
#include "aoemotebutton.h"
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
 | 
			
		||||
                             int p_x, int p_y, int p_w, int p_h)
 | 
			
		||||
    : QPushButton(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  parent = p_parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
  this->move(p_x, p_y);
 | 
			
		||||
  this->resize(p_w, p_h);
 | 
			
		||||
AOEmoteButton::AOEmoteButton(int id, int width, int height, AOApplication *ao_app, QWidget *parent)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
    , ao_app(ao_app)
 | 
			
		||||
    , m_id(id)
 | 
			
		||||
{
 | 
			
		||||
  resize(width, height);
 | 
			
		||||
 | 
			
		||||
  ui_selected = new QLabel(this);
 | 
			
		||||
  ui_selected->resize(size());
 | 
			
		||||
  ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_selected->resize(width, height);
 | 
			
		||||
  ui_selected->hide();
 | 
			
		||||
 | 
			
		||||
  connect(this, &AOEmoteButton::clicked, this, &AOEmoteButton::on_clicked);
 | 
			
		||||
  connect(this, &AOEmoteButton::clicked, this, [this] { Q_EMIT emoteClicked(m_id); });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmoteButton::set_selected_image(QString p_image)
 | 
			
		||||
void AOEmoteButton::setSelectedImage(QString p_image)
 | 
			
		||||
{
 | 
			
		||||
  if (file_exists(p_image)) {
 | 
			
		||||
  if (file_exists(p_image))
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->setStyleSheet("border-image: url(\"" + p_image + "\")");
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->setStyleSheet("background-color: rgba(0, 0, 0, 128)");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmoteButton::set_image(QString p_image, QString p_emote_comment)
 | 
			
		||||
int AOEmoteButton::id()
 | 
			
		||||
{
 | 
			
		||||
  QString tmp_p_image = p_image;
 | 
			
		||||
 | 
			
		||||
  if (file_exists(p_image)) {
 | 
			
		||||
    this->setText("");
 | 
			
		||||
    this->setStyleSheet(
 | 
			
		||||
        "QPushButton { border: none; }"
 | 
			
		||||
        "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    this->setIcon(QPixmap(p_image).scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
    this->setIconSize(this->size());
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    this->setText(p_emote_comment);
 | 
			
		||||
    this->setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                        "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                        "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    this->setIcon(QIcon());
 | 
			
		||||
    this->setIconSize(this->size());
 | 
			
		||||
  }
 | 
			
		||||
  return m_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmoteButton::set_char_image(QString p_char, int p_emote, bool on)
 | 
			
		||||
void AOEmoteButton::setImage(QString character, int emoteId, bool enabled)
 | 
			
		||||
{
 | 
			
		||||
  QString emotion_number = QString::number(p_emote + 1);
 | 
			
		||||
  QStringList suffixes { "_off", "_on" };
 | 
			
		||||
  QStringList suffixedPaths;
 | 
			
		||||
  for (const QString &suffix : suffixes) {
 | 
			
		||||
    suffixedPaths.append(ao_app->get_image_suffix(ao_app->get_character_path(
 | 
			
		||||
        p_char, "emotions/button" + emotion_number + suffix)));
 | 
			
		||||
  }
 | 
			
		||||
  QString image = suffixedPaths[static_cast<int>(on)];
 | 
			
		||||
  QString emotion_number = QString::number(emoteId + 1);
 | 
			
		||||
 | 
			
		||||
  QString emoteComment = ao_app->get_emote_comment(p_char, p_emote);
 | 
			
		||||
  if (on && !file_exists(suffixedPaths[1])) {;
 | 
			
		||||
  QStringList suffixedPaths;
 | 
			
		||||
  static const QStringList SUFFIX_LIST{"_off", "_on"};
 | 
			
		||||
  for (const QString &suffix : SUFFIX_LIST)
 | 
			
		||||
  {
 | 
			
		||||
    suffixedPaths.append(ao_app->get_image_suffix(ao_app->get_character_path(character, "emotions/button" + emotion_number + suffix)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  QString image = suffixedPaths[static_cast<int>(enabled)];
 | 
			
		||||
  if (enabled && !file_exists(suffixedPaths[1]))
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->show();
 | 
			
		||||
    image = suffixedPaths[0];
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->hide();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_image(image, emoteComment);
 | 
			
		||||
  if (file_exists(image))
 | 
			
		||||
  {
 | 
			
		||||
    setText(QString());
 | 
			
		||||
    setStyleSheet("QPushButton { border: none; }"
 | 
			
		||||
                  "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    setIcon(QPixmap(image).scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 | 
			
		||||
    setIconSize(size());
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    QString emote_comment = ao_app->get_emote_comment(character, emoteId);
 | 
			
		||||
    setText(emote_comment);
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                  "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                  "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
    setIcon(QIcon());
 | 
			
		||||
    setIconSize(size());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmoteButton::on_clicked() { emit emote_clicked(m_id); }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								src/aoemotebutton.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,30 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
 | 
			
		||||
class AOEmoteButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEmoteButton(int id, int width, int height, AOApplication *ao_app, QWidget *parent = nullptr);
 | 
			
		||||
 | 
			
		||||
  int id();
 | 
			
		||||
 | 
			
		||||
  void setImage(QString character, int emoteId, bool enabled);
 | 
			
		||||
 | 
			
		||||
  void setSelectedImage(QString p_image);
 | 
			
		||||
 | 
			
		||||
Q_SIGNALS:
 | 
			
		||||
  void emoteClicked(int p_id);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  int m_id = 0;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_selected = nullptr;
 | 
			
		||||
};
 | 
			
		||||
@ -1,44 +1,45 @@
 | 
			
		||||
#include "aoemotepreview.h"
 | 
			
		||||
 | 
			
		||||
AOEmotePreview::AOEmotePreview(QWidget *parent, AOApplication *p_ao_app) : QWidget(parent)
 | 
			
		||||
AOEmotePreview::AOEmotePreview(AOApplication *ao_app, QWidget *parent)
 | 
			
		||||
    : QWidget(parent)
 | 
			
		||||
    , ao_app(ao_app)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  setWindowFlag(Qt::Tool);
 | 
			
		||||
  setWindowFlag(Qt::WindowMinMaxButtonsHint, false);
 | 
			
		||||
 | 
			
		||||
  ui_viewport = new QWidget(this);
 | 
			
		||||
  ui_vp_player_char = new CharLayer(ui_viewport, ao_app);
 | 
			
		||||
  ui_vp_player_char = new CharLayer(ao_app, ui_viewport);
 | 
			
		||||
  ui_vp_player_char->setObjectName("ui_vp_player_char");
 | 
			
		||||
  ui_vp_player_char->masked = false;
 | 
			
		||||
  ui_size_label = new QLabel(this);
 | 
			
		||||
  ui_size_label->setObjectName("ui_size_label");
 | 
			
		||||
  setWindowFlag(Qt::WindowMinMaxButtonsHint, false);
 | 
			
		||||
  setWindowFlag(Qt::Tool);
 | 
			
		||||
  this->resize(256, 192);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmotePreview::set_widgets()
 | 
			
		||||
void AOEmotePreview::updateViewportGeometry()
 | 
			
		||||
{
 | 
			
		||||
  ui_viewport->resize(this->width(), this->height());
 | 
			
		||||
  ui_viewport->resize(size());
 | 
			
		||||
 | 
			
		||||
  ui_vp_player_char->move_and_center(0, 0);
 | 
			
		||||
  ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
 | 
			
		||||
 | 
			
		||||
  ui_size_label->setText(QString::number(this->width()) + "x" + QString::number(this->height()));
 | 
			
		||||
  ui_size_label->setText(QString::number(width()) + "x" + QString::number(height()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmotePreview::play(QString emote, QString char_name, bool flipped, int self_offset, int self_offset_v)
 | 
			
		||||
void AOEmotePreview::display(QString character, QString emote, bool flipped, int xOffset, int yOffset)
 | 
			
		||||
{
 | 
			
		||||
  m_character = character;
 | 
			
		||||
  m_emote = emote;
 | 
			
		||||
  ui_vp_player_char->stop();
 | 
			
		||||
  ui_vp_player_char->set_flipped(flipped);
 | 
			
		||||
  ui_vp_player_char->move_and_center(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
 | 
			
		||||
  ui_vp_player_char->load_image(emote, char_name, 0, false);
 | 
			
		||||
  ui_vp_player_char->move_and_center(ui_viewport->width() * xOffset / 100, ui_viewport->height() * yOffset / 100);
 | 
			
		||||
  ui_vp_player_char->load_image(emote, character, 0, false);
 | 
			
		||||
  ui_vp_player_char->set_play_once(false);
 | 
			
		||||
  m_emote = emote;
 | 
			
		||||
  m_char = char_name;
 | 
			
		||||
  setWindowTitle(char_name + ": " + emote);
 | 
			
		||||
  setWindowTitle(character + ": " + emote);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmotePreview::resizeEvent(QResizeEvent *)
 | 
			
		||||
void AOEmotePreview::resizeEvent(QResizeEvent *event)
 | 
			
		||||
{
 | 
			
		||||
  set_widgets();
 | 
			
		||||
  ui_vp_player_char->load_image(m_emote, m_char, 0, false);
 | 
			
		||||
  QWidget::resizeEvent(event);
 | 
			
		||||
  updateViewportGeometry();
 | 
			
		||||
  ui_vp_player_char->load_image(m_emote, m_character, 0, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										32
									
								
								src/aoemotepreview.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,32 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aolayer.h"
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
class AOEmotePreview : public QWidget
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEmotePreview(AOApplication *ao_app, QWidget *parent = nullptr);
 | 
			
		||||
 | 
			
		||||
  void display(QString character, QString emote, bool flipped = false, int xOffset = 0, int yOffset = 0);
 | 
			
		||||
 | 
			
		||||
  void updateViewportGeometry();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  void resizeEvent(QResizeEvent *event);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  QString m_character;
 | 
			
		||||
  QString m_emote;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_viewport;
 | 
			
		||||
  BackgroundLayer *ui_vp_background;
 | 
			
		||||
  SplashLayer *ui_vp_speedlines;
 | 
			
		||||
  CharLayer *ui_vp_player_char;
 | 
			
		||||
  BackgroundLayer *ui_vp_desk;
 | 
			
		||||
  QLabel *ui_size_label;
 | 
			
		||||
};
 | 
			
		||||
@ -2,108 +2,96 @@
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
 | 
			
		||||
                                   int p_x, int p_y, int p_w, int p_h)
 | 
			
		||||
    : QPushButton(p_parent)
 | 
			
		||||
AOEvidenceButton::AOEvidenceButton(int id, int width, int height, AOApplication *ao_app, QWidget *parent)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
    , ao_app(ao_app)
 | 
			
		||||
    , m_id(id)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  m_parent = p_parent;
 | 
			
		||||
  resize(width, height);
 | 
			
		||||
 | 
			
		||||
  ui_selected = new AOImage(this, ao_app, true);
 | 
			
		||||
  ui_selected->resize(p_w, p_h);
 | 
			
		||||
  //  ui_selected->move(p_x, p_y);
 | 
			
		||||
  ui_selected->set_image("evidence_selected");
 | 
			
		||||
  ui_selected = new AOImage(ao_app, this);
 | 
			
		||||
  ui_selected->resize(width, height);
 | 
			
		||||
  ui_selected->setImage("evidence_selected");
 | 
			
		||||
  ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_selected->hide();
 | 
			
		||||
 | 
			
		||||
  ui_selector = new AOImage(this, ao_app, true);
 | 
			
		||||
  ui_selector->resize(p_w, p_h);
 | 
			
		||||
  //  ui_selector->move(p_x - 1, p_y - 1);
 | 
			
		||||
  ui_selector->set_image("evidence_selector");
 | 
			
		||||
  ui_selector = new AOImage(ao_app, this);
 | 
			
		||||
  ui_selector->resize(width, height);
 | 
			
		||||
  ui_selector->setImage("evidence_selector");
 | 
			
		||||
  ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
 | 
			
		||||
  this->move(p_x, p_y);
 | 
			
		||||
  this->resize(p_w, p_h);
 | 
			
		||||
  //  this->setAcceptDrops(true);
 | 
			
		||||
 | 
			
		||||
  connect(this, &AOEvidenceButton::clicked, this, &AOEvidenceButton::on_clicked);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::set_image(QString p_image)
 | 
			
		||||
void AOEvidenceButton::setImage(QString fileName)
 | 
			
		||||
{
 | 
			
		||||
  QString image_path = ao_app->get_real_path(ao_app->get_evidence_path(p_image));
 | 
			
		||||
  if (file_exists(p_image)) {
 | 
			
		||||
    this->setText("");
 | 
			
		||||
    this->setStyleSheet(
 | 
			
		||||
        "QPushButton { border-image: url(\"" + p_image +
 | 
			
		||||
        "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
        "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  QString image_path = ao_app->get_real_path(ao_app->get_evidence_path(fileName));
 | 
			
		||||
  if (file_exists(fileName))
 | 
			
		||||
  {
 | 
			
		||||
    setText("");
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(\"" + fileName +
 | 
			
		||||
                  "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
                  "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  }
 | 
			
		||||
  else if (file_exists(image_path)) {
 | 
			
		||||
    this->setText("");
 | 
			
		||||
    this->setStyleSheet(
 | 
			
		||||
        "QPushButton { border-image: url(\"" + image_path +
 | 
			
		||||
        "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
        "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  else if (file_exists(image_path))
 | 
			
		||||
  {
 | 
			
		||||
    setText("");
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(\"" + image_path +
 | 
			
		||||
                  "\") 0 0 0 0 stretch stretch; }"
 | 
			
		||||
                  "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    this->setText(p_image);
 | 
			
		||||
    this->setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                        "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                        "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    setText(fileName);
 | 
			
		||||
    setStyleSheet("QPushButton { border-image: url(); }"
 | 
			
		||||
                  "QToolTip { background-image: url(); color: #000000; "
 | 
			
		||||
                  "background-color: #ffffff; border: 0px; }");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::set_theme_image(QString p_image)
 | 
			
		||||
void AOEvidenceButton::setThemeImage(QString fileName)
 | 
			
		||||
{
 | 
			
		||||
  QString theme_image_path = ao_app->get_real_path(
 | 
			
		||||
        ao_app->get_theme_path(p_image));
 | 
			
		||||
  QString default_image_path = ao_app->get_real_path(
 | 
			
		||||
        ao_app->get_theme_path(p_image, ao_app->default_theme));
 | 
			
		||||
  QString theme_image_path = ao_app->get_real_path(ao_app->get_theme_path(fileName));
 | 
			
		||||
  QString default_image_path = ao_app->get_real_path(ao_app->get_theme_path(fileName, ao_app->default_theme));
 | 
			
		||||
 | 
			
		||||
  QString final_image_path;
 | 
			
		||||
 | 
			
		||||
  if (file_exists(theme_image_path))
 | 
			
		||||
  {
 | 
			
		||||
    final_image_path = theme_image_path;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    final_image_path = default_image_path;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  this->set_image(final_image_path);
 | 
			
		||||
  setImage(final_image_path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::set_selected(bool p_selected)
 | 
			
		||||
void AOEvidenceButton::setSelected(bool p_selected)
 | 
			
		||||
{
 | 
			
		||||
  if (p_selected)
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->show();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    ui_selected->hide();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::on_clicked() { emit evidence_clicked(m_id); }
 | 
			
		||||
void AOEvidenceButton::on_clicked()
 | 
			
		||||
{
 | 
			
		||||
  Q_EMIT evidenceClicked(m_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  QPushButton::mouseDoubleClickEvent(e);
 | 
			
		||||
  emit evidence_double_clicked(m_id);
 | 
			
		||||
  Q_EMIT evidenceDoubleClicked(m_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  //QWidget::dragLeaveEvent(e);
 | 
			
		||||
 | 
			
		||||
  qDebug() << "drag leave event";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  //QWidget::dragEnterEvent(e);
 | 
			
		||||
 | 
			
		||||
  qDebug() << "drag enter event";
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
void AOEvidenceButton::enterEvent(QEvent *e)
 | 
			
		||||
#else
 | 
			
		||||
@ -112,7 +100,7 @@ void AOEvidenceButton::enterEvent(QEnterEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->show();
 | 
			
		||||
 | 
			
		||||
  emit on_hover(m_id, true);
 | 
			
		||||
  Q_EMIT mouseoverUpdated(m_id, true);
 | 
			
		||||
 | 
			
		||||
  setFlat(false);
 | 
			
		||||
  QPushButton::enterEvent(e);
 | 
			
		||||
@ -122,6 +110,6 @@ void AOEvidenceButton::leaveEvent(QEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
 | 
			
		||||
  emit on_hover(m_id, false);
 | 
			
		||||
  Q_EMIT mouseoverUpdated(m_id, false);
 | 
			
		||||
  QPushButton::leaveEvent(e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										50
									
								
								src/aoevidencebutton.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,50 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QEnterEvent>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class AOEvidenceButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEvidenceButton(int id, int width, int height, AOApplication *ao_app, QWidget *parent = nullptr);
 | 
			
		||||
 | 
			
		||||
  void setImage(QString fileName);
 | 
			
		||||
 | 
			
		||||
  void setThemeImage(QString fileName);
 | 
			
		||||
 | 
			
		||||
  void setSelected(bool enabled);
 | 
			
		||||
 | 
			
		||||
Q_SIGNALS:
 | 
			
		||||
  void evidenceClicked(int id);
 | 
			
		||||
  void evidenceDoubleClicked(int id);
 | 
			
		||||
 | 
			
		||||
  void mouseoverUpdated(int id, bool state);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 | 
			
		||||
  void enterEvent(QEvent *e) override;
 | 
			
		||||
#else
 | 
			
		||||
  void enterEvent(QEnterEvent *e) override;
 | 
			
		||||
#endif
 | 
			
		||||
  void leaveEvent(QEvent *e) override;
 | 
			
		||||
 | 
			
		||||
  void mouseDoubleClickEvent(QMouseEvent *e) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  int m_id = 0;
 | 
			
		||||
 | 
			
		||||
  AOImage *ui_selected;
 | 
			
		||||
  AOImage *ui_selector;
 | 
			
		||||
 | 
			
		||||
private Q_SLOTS:
 | 
			
		||||
  void on_clicked();
 | 
			
		||||
};
 | 
			
		||||