Merge master with some older CI changes
2
.clang-format
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
BreakBeforeBraces: Stroustrup
|
7
.gitignore
vendored
@ -9,7 +9,7 @@ base_override.h
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
base-full/
|
base-full/
|
||||||
base/
|
logs/
|
||||||
bass.lib
|
bass.lib
|
||||||
|
|
||||||
bin/
|
bin/
|
||||||
@ -17,6 +17,11 @@ bins/
|
|||||||
build/
|
build/
|
||||||
release/
|
release/
|
||||||
debug/
|
debug/
|
||||||
|
base/background
|
||||||
|
base/characters
|
||||||
|
base/sounds
|
||||||
|
base/callwords.ini
|
||||||
|
base/config.ini
|
||||||
|
|
||||||
.qmake.stash
|
.qmake.stash
|
||||||
|
|
||||||
|
@ -121,10 +121,7 @@ build windows i686:
|
|||||||
# Base folder
|
# Base folder
|
||||||
.deploy_base: &deploy_base |
|
.deploy_base: &deploy_base |
|
||||||
mkdir base
|
mkdir base
|
||||||
mkdir base/themes
|
cp -a ../base/ base/
|
||||||
cp -a ../base/themes/default base/themes/
|
|
||||||
cp -a ../base/config.ini base/config.sample.ini
|
|
||||||
cp -a ../base/serverlist.txt base/serverlist.sample.txt
|
|
||||||
|
|
||||||
# Miscellaneous files
|
# Miscellaneous files
|
||||||
.deploy_misc: &deploy_misc |
|
.deploy_misc: &deploy_misc |
|
||||||
|
@ -14,7 +14,7 @@ deploy:
|
|||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
secure: mZCNwnqKeqJP5CqgYOanYnr/KHydxueGPRhvGLpY0Pop7MiH3CIHMN5dhHbtgJvE5GGMR4xUIEhPpmkCEJw7YiPREMqT4mkV4DR531ZLB3t/FizyvIwXuP6jFwzTofZ51qHfBpcurVc9sMFeD9Pw+rLTTgIiXL2sZxUUXc8U+ZZug1lYndgcO6P00fUJd6V9lyFQUGmbSca97YbG6KuCym0fEpyRnMqzKLjYsUUo8UKRBADtmD822O6z2FSldNZDn45Mkx0MYfHWyT5hzTb7WGa+DrTB/0un1HqqsNPlb/ahjrFQQNR2qd7HNGZa+Mvwi6egTDug+k15x8lbkacUoi34U1eFq9LSTYm8dSO5g23I1OvGvjTCkDj1jOLPqB99XlbAJ0E/9Jzw7wtlLaAzvFzTj/B63TQnO3IsgHBWR14CZlf05WMOFf2irwl+kL6ktspIHnlGgaiWYYrKeAt7QJAXiQOdYDz6SaWVC6TyOE/SszXRU6xFotmCjkP2irM5yGE8SUw2uIzKjD9uG0ZXtbLcdQEFD316+qglqFTCjnKsRfbtQs2u5spZPsZSdsOZCbLfNIn0GSTFRymFsK6gsvji8AD8AZo0zcOZ/7NMVC6A8RnF3Ve+vU/xljhsIOxoLZDvZPia7WozdV99xmnepWBwkuoQs/K0xmWcnLZDcb0=
|
secure: mZCNwnqKeqJP5CqgYOanYnr/KHydxueGPRhvGLpY0Pop7MiH3CIHMN5dhHbtgJvE5GGMR4xUIEhPpmkCEJw7YiPREMqT4mkV4DR531ZLB3t/FizyvIwXuP6jFwzTofZ51qHfBpcurVc9sMFeD9Pw+rLTTgIiXL2sZxUUXc8U+ZZug1lYndgcO6P00fUJd6V9lyFQUGmbSca97YbG6KuCym0fEpyRnMqzKLjYsUUo8UKRBADtmD822O6z2FSldNZDn45Mkx0MYfHWyT5hzTb7WGa+DrTB/0un1HqqsNPlb/ahjrFQQNR2qd7HNGZa+Mvwi6egTDug+k15x8lbkacUoi34U1eFq9LSTYm8dSO5g23I1OvGvjTCkDj1jOLPqB99XlbAJ0E/9Jzw7wtlLaAzvFzTj/B63TQnO3IsgHBWR14CZlf05WMOFf2irwl+kL6ktspIHnlGgaiWYYrKeAt7QJAXiQOdYDz6SaWVC6TyOE/SszXRU6xFotmCjkP2irM5yGE8SUw2uIzKjD9uG0ZXtbLcdQEFD316+qglqFTCjnKsRfbtQs2u5spZPsZSdsOZCbLfNIn0GSTFRymFsK6gsvji8AD8AZo0zcOZ/7NMVC6A8RnF3Ve+vU/xljhsIOxoLZDvZPia7WozdV99xmnepWBwkuoQs/K0xmWcnLZDcb0=
|
||||||
file: "../bin/Attorney_Online_mac_x86_64.zip"
|
file: "../bin/Attorney_Online_macOS.zip"
|
||||||
draft: true
|
draft: true
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
|
@ -3,7 +3,7 @@ QT += core gui widgets network
|
|||||||
TARGET = Attorney_Online
|
TARGET = Attorney_Online
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
VERSION = 2.7.2.0
|
VERSION = 2.8.4.0
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/include
|
INCLUDEPATH += $$PWD/include
|
||||||
DESTDIR = $$PWD/bin
|
DESTDIR = $$PWD/bin
|
||||||
@ -13,30 +13,39 @@ MOC_DIR = $$PWD/build
|
|||||||
SOURCES += $$files($$PWD/src/*.cpp)
|
SOURCES += $$files($$PWD/src/*.cpp)
|
||||||
HEADERS += $$files($$PWD/include/*.h)
|
HEADERS += $$files($$PWD/include/*.h)
|
||||||
|
|
||||||
|
|
||||||
LIBS += -L$$PWD/lib
|
LIBS += -L$$PWD/lib
|
||||||
|
|
||||||
|
# Uncomment to enable Discord Rich Presence
|
||||||
#DEFINES += DISCORD
|
# DEFINES += DISCORD
|
||||||
|
|
||||||
contains(DEFINES, DISCORD) {
|
contains(DEFINES, DISCORD) {
|
||||||
LIBS += -ldiscord-rpc
|
LIBS += -ldiscord-rpc
|
||||||
}
|
}
|
||||||
|
|
||||||
#DEFINES += BASSAUDIO
|
# Uncomment to enable the BASS audio engine
|
||||||
|
# (Recommended for Windows)
|
||||||
|
# DEFINES += BASSAUDIO
|
||||||
|
|
||||||
contains(DEFINES, BASSAUDIO) {
|
contains(DEFINES, BASSAUDIO) {
|
||||||
LIBS += -lbass
|
LIBS += -lbass
|
||||||
|
LIBS += -lbassopus
|
||||||
}
|
}
|
||||||
|
|
||||||
#DEFINES += QTAUDIO
|
# Uncomment to enable the Qt audio engine
|
||||||
|
# (Recommended for non-Windows platforms)
|
||||||
|
# DEFINES += QTAUDIO
|
||||||
|
|
||||||
contains(DEFINES, QTAUDIO) {
|
contains(DEFINES, QTAUDIO) {
|
||||||
QT += multimedia
|
QT += multimedia
|
||||||
}
|
}
|
||||||
|
|
||||||
contains(CONFIG, qml_debug) {
|
AUDIO_DEFINES = $$find(DEFINES, BASSAUDIO) $$find(DEFINES, QTAUDIO)
|
||||||
DEFINES += DEBUG_NETWORK
|
count(AUDIO_DEFINES, 0) {
|
||||||
|
warning("No audio system selected. Your build will not have audio.")
|
||||||
|
}
|
||||||
|
|
||||||
|
count(AUDIO_DEFINES, 2) {
|
||||||
|
error("More than one audio system selected.")
|
||||||
}
|
}
|
||||||
|
|
||||||
macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
|
macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
|
||||||
@ -46,16 +55,16 @@ CONFIG += c++14
|
|||||||
|
|
||||||
RESOURCES += resources.qrc
|
RESOURCES += resources.qrc
|
||||||
|
|
||||||
TRANSLATIONS = resource/translations/ao_en.ts \
|
TRANSLATIONS = resource/translations/ao_en.ts \
|
||||||
resource/translations/ao_jp.ts \
|
resource/translations/ao_jp.ts \
|
||||||
resource/translations/ao_de.ts \
|
resource/translations/ao_de.ts \
|
||||||
resource/translations/ao_ru.ts \
|
resource/translations/ao_ru.ts \
|
||||||
resource/translations/ao_es.ts \
|
resource/translations/ao_es.ts \
|
||||||
resource/translations/ao_pt.ts \
|
resource/translations/ao_pt.ts \
|
||||||
resource/translations/ao_pl.ts
|
resource/translations/ao_pl.ts
|
||||||
|
|
||||||
win32:RC_ICONS = resource/logo.ico
|
win32:RC_ICONS = resource/logo_ao2.ico
|
||||||
macx:ICON = resource/logo.icns
|
macx:ICON = resource/logo_ao2.icns
|
||||||
|
|
||||||
android:DISTFILES += \
|
android:DISTFILES += \
|
||||||
android/AndroidManifest.xml \
|
android/AndroidManifest.xml \
|
||||||
|
44
CONTRIBUTING.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
## Compiling
|
||||||
|
|
||||||
|
The traditional route is by undergoing the [AO2 Rite of Passage](https://gist.github.com/oldmud0/6c645bd1667370c3e92686f7d0642c38).
|
||||||
|
|
||||||
|
However, these days it is easy to get away with using the default Qt toolchain on any platform, which creates a dynamic executable. (Don't forget to invoke windeployqt when creating a release.)
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- [BASS](http://un4seen.com) (optional; may use Qt Multimedia instead)
|
||||||
|
- [Discord Rich Presence](https://github.com/discordapp/discord-rpc) (optional)
|
||||||
|
|
||||||
|
## Release instructions
|
||||||
|
|
||||||
|
Follow these steps to make a new full release:
|
||||||
|
|
||||||
|
- Set a new AO version in the `.pro` file and in `aoapplication.h`.
|
||||||
|
- Compile the project.
|
||||||
|
- Commit the version bump and and create a tag for the commit.
|
||||||
|
- Rename the executable to `Attorney_Online`.
|
||||||
|
- Create a temp directory.
|
||||||
|
- Copy a fresh `base` folder to the temp dir. Ensure that the timestamps are consistent.
|
||||||
|
- Ignore this step if creating a client-only release.
|
||||||
|
- Copy the repository's `base` folder to the temp dir.
|
||||||
|
- Append `.sample` to the names of all `.ini` files, including `serverlist.txt`.
|
||||||
|
- Copy the game executable to the temp dir.
|
||||||
|
- Copy `bass.dll`, `discord-rpc.dll`, and `qapng.dll` if applicable.
|
||||||
|
- Copy `README.md` as `README.md.txt` with CRLF line endings.
|
||||||
|
- Copy `LICENSE` as `LICENSE.txt` with CRLF line endings.
|
||||||
|
- Compress the contents of the temp dir to an archive with maximum compression, but
|
||||||
|
be sure that the contents are placed inside the root directory of the archive and not
|
||||||
|
within a subdirectory.
|
||||||
|
- Compute the SHA-1 hash of the archive.
|
||||||
|
- Upload the archive to the Wasabi bucket and an additional mirror (e.g. MEGA or OneDrive)
|
||||||
|
(if this is a full release).
|
||||||
|
- Publish a GitHub release and upload the archive there (if this is a client-only release).
|
||||||
|
- Add the new version to the `program.json` manifest for the respective platform
|
||||||
|
(if this is a client-only release).
|
||||||
|
- Update the following on the website for the respective platform:
|
||||||
|
- Full download links (Wasabi and mirror)
|
||||||
|
- Client download link
|
||||||
|
- Full download hash
|
||||||
|
- Client download hash
|
||||||
|
|
||||||
|
Repeat for each platform (currently 32-bit Windows and 64-bit Linux). Once you're done, don't forget to announce your release!
|
228
README.md
@ -2,231 +2,7 @@
|
|||||||
|
|
||||||
[Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format.
|
[Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format.
|
||||||
|
|
||||||
## Introduction for beginners
|
**[Refer to the docs](https://github.com/AttorneyOnline/docs/blob/master/docs/index.md) for more information.**
|
||||||
|
|
||||||
You may already be familiar with roleplaying in forums, Roll20, and/or [AAO](http://aaonline.fr/) (the online casemaker). In this sense, Attorney Online is nothing more than a medium - an animated chatroom client - that allows cases to be played out as if it were an Ace Attorney game.
|
|
||||||
|
|
||||||
Not unlike other roleplaying games, cases can last an absurd amount of time (between 4 to 6 hours) and generally follow a roleplaying format directed by a case sheet.
|
|
||||||
|
|
||||||
An implied expectation for fast typing and real-time communication may seem daunting at first, but due to the number of people in the courtroom, things get hectic very quickly even with only a few people talking. Therefore, you should not feel pressured to talk constantly: only when you have the attention of the court (or when you have an objection to make) should you feel the need to speak.
|
|
||||||
|
|
||||||
It is recommended, but not strictly necessary, to have played an Ace Attorney game before creating your own case. You should also try to spectate or take part in a community case in order to get a grasp of how cases are done in practice.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Basic features
|
|
||||||
|
|
||||||
### In-character chat
|
|
||||||
|
|
||||||
Type in a message in the gray box under the viewport, select an emote, and press Enter.
|
|
||||||
|
|
||||||
### Emotes
|
|
||||||
|
|
||||||
An emote represents a set of animations played while the character is speaking and idle. Some emotes also contain a preanimation, which is played before the text is said by the character.
|
|
||||||
|
|
||||||
### Interjections (shouts)
|
|
||||||
|
|
||||||
Select an interjection to toggle it. When you send a message, it will interrupt all other dialogue and interject with your message.
|
|
||||||
|
|
||||||
### Out-of-character chat
|
|
||||||
|
|
||||||
This is a general-purpose chat isolated within areas to discuss matters without interrupting cases. You must enter a name before chatting.
|
|
||||||
|
|
||||||
### Music list
|
|
||||||
|
|
||||||
Double-click a track to play it. Some servers automatically loop the track. Green tracks are available locally; red tracks are not.
|
|
||||||
|
|
||||||
### Areas
|
|
||||||
|
|
||||||
Servers have multiple areas to hold multiple cases simultaneously. Double-click an area in the music list to switch to it. (The reason that
|
|
||||||
areas are in the music list is a historical one.)
|
|
||||||
|
|
||||||
### Judge controls
|
|
||||||
|
|
||||||
The judge can set health bars and play the Witness Testimony, Cross Examination, Guilty, and Not Guilty animations.
|
|
||||||
|
|
||||||
### Mod calls
|
|
||||||
|
|
||||||
Calling a mod notifies moderators currently in the server of an incident. (Mod call reasons require 2.6+ server-side support.) Logged-in moderators can toggle the Guard option to be notified of mod calls.
|
|
||||||
|
|
||||||
### Muting
|
|
||||||
|
|
||||||
Click on a character in the mute list to ignore any in-character chat from the specified character.
|
|
||||||
|
|
||||||
### Positions
|
|
||||||
|
|
||||||
All characters have a default position within the courtroom, but they can nonetheless be changed within the interface.
|
|
||||||
|
|
||||||
Available positions:
|
|
||||||
|
|
||||||
- `def` - Defense
|
|
||||||
- `pro` - Prosecution
|
|
||||||
- `hld` - Helper defense
|
|
||||||
- `hlp` - Helper prosecution
|
|
||||||
- `jud` - Judge
|
|
||||||
- `wit` - Witness
|
|
||||||
- `jur` - Juror (2.6+)
|
|
||||||
- `sea` - Seance (2.6+)
|
|
||||||
|
|
||||||
## Advanced features
|
|
||||||
|
|
||||||
### Markup language
|
|
||||||
|
|
||||||
2.6.0 introduces a markup language for in-character chat. It does not require server-side support.
|
|
||||||
|
|
||||||
#### Color
|
|
||||||
|
|
||||||
Wrapping text with these characters will set the text inside of them to the associated color.
|
|
||||||
|
|
||||||
- `(` and `)` (parentheses) - blue
|
|
||||||
- \` (backtick) - green
|
|
||||||
- `|` (vertical bar) - orange
|
|
||||||
- `[` and `]` (square brackets) - grey
|
|
||||||
|
|
||||||
#### Speed
|
|
||||||
|
|
||||||
Type `{` to slow down the text a bit, and `}` to speed it up. This takes effect after the character has been typed, so the text may take up different speeds at different points. Both of these can be stacked up to three times, and even against each other.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```
|
|
||||||
Hello there! This text goes at normal speed.} Now, it's a bit faster!{ Now, it's back to normal.}}} Now it goes at maximum speed! {{Now it's only a little bit faster than normal.
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Position
|
|
||||||
|
|
||||||
If you begin a message with `~~` (two tildes), the two tildes are removed and the message is centered.
|
|
||||||
|
|
||||||
### Pairing (2.6+)
|
|
||||||
|
|
||||||
If two players are in the same position and select each other's characters using the in-game pair list (or with `/pair [id]`), they will appear alongside each other. You can set the offset of your character using the provided spinbox (or with `/offset [percentage]`).
|
|
||||||
|
|
||||||
### Screenflash (2.6+)
|
|
||||||
|
|
||||||
Placing a `$` (dollar symbol) at any point in the message will cause a white flash to appear at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol. The flash will be silent, unlike the equivalent button.
|
|
||||||
|
|
||||||
### Screenshake (2.6+)
|
|
||||||
|
|
||||||
Placing an `@` (at symbol) at any point in the message will cause the screen to shake at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol (including the screenflash).
|
|
||||||
|
|
||||||
### Non-interrupting preanimations (2.6+)
|
|
||||||
|
|
||||||
When checked, this will force text to immediately begin displaying without waiting for the preanimation to finish.
|
|
||||||
|
|
||||||
### Custom IC names (shownames) (2.6+)
|
|
||||||
|
|
||||||
You can set a custom in-character name using the provided text box. An option in the interface (or `/force_nonint_pres`) is also present to disable custom IC names for other players to prevent impersonation.
|
|
||||||
|
|
||||||
### Extended area support (2.6+)
|
|
||||||
|
|
||||||
Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses of such areas are displayed (and updated automatically) if the server has 2.6+ support.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Upgrade guide for 2.6
|
|
||||||
|
|
||||||
2.6 inherits features from the Case Café custom client and server. Old themes and servers will still work, but they will not expose the new additions to players.
|
|
||||||
|
|
||||||
### Server
|
|
||||||
|
|
||||||
2.6 support has only been developed for tsuserver3. serverD is currently not equipped at all for such support.
|
|
||||||
|
|
||||||
- Apply the new code changes.
|
|
||||||
- In `areas.yaml`:
|
|
||||||
- You may add `shouts_allowed` to any of the areas to enable / disable shouts (and judge buttons, and realisation). By default, it's `shouts_allowed: true`.
|
|
||||||
- You may add `jukebox` to any of the areas to enable the jukebox in there, but you can also use `/jukebox_toggle` in game as a mod to do the same thing. By default, it's `jukebox: false`.
|
|
||||||
- You may add `showname_changes_allowed` to any of the areas to allow custom shownames used in there. If it's forbidden, players can't send messages or change music as long as they have a custom name set. By default, it's `showname_changes_allowed: false`.
|
|
||||||
- You may add `abbreviation` to override the server-generated abbreviation of the area. Instead of area numbers, this server-pack uses area abbreviations in server messages for easier understanding (but still uses area IDs in commands, of course). No default here, but here is an example: `abbreviation: SIN` gives the area the abbreviation of 'SIN'.
|
|
||||||
- You may add `noninterrupting_pres` to force users to use non-interrupting pres only. 2.6 users will see the pres play as the text goes; pre-2.6 users will not see pres at all. The default is `noninterrupting_pres: false`.
|
|
||||||
|
|
||||||
### Client themes
|
|
||||||
|
|
||||||
- You'll need the following, additional images:
|
|
||||||
- `notguilty.gif` - Not Guilty verdict animation
|
|
||||||
- `guilty.gif` - Guilty verdict animation
|
|
||||||
- `notguilty.png` - Not Guilty button
|
|
||||||
- `guilty.png` - Guilty button
|
|
||||||
- `pair_button.png` - Pair button
|
|
||||||
- `pair_button_pressed.png` - Pair button (selected)
|
|
||||||
- In your `courtroom_sounds.ini`:
|
|
||||||
- Add a sound effect for `not_guilty`, for example: `not_guilty = sfx-notguilty.wav`.
|
|
||||||
- Add a sound effect for `guilty`, for example: `guilty = sfx-guilty.wav`.
|
|
||||||
- Add a sound effect for the case alerts. They work similarly to modcall alerts, or callword alerts. For example: `case_call = sfx-triplegavel-soj.wav`.
|
|
||||||
- In your `courtroom_design.ini`, place the following new UI elements as desired:
|
|
||||||
- `log_limit_label`, which is a simple text that explains what the spinbox with the numbers is. Needs an X, Y, width, height number.
|
|
||||||
- `log_limit_spinbox`, which is the spinbox for the log limit, allowing you to set the size of the log limit in-game. Needs the same stuff as above.
|
|
||||||
- `ic_chat_name`, which is an input field for your custom showname. Needs the same stuff.
|
|
||||||
- `ao2_ic_chat_name`, which is the same as above, but comes into play when the background has a desk.
|
|
||||||
- Further comments on this: all `ao2_` UI elements come into play when the background has a desk. However, in AO2 nowadays, it's customary for every background to have a desk, even if it's just an empty gif. So you most likely have never seen the `ao2_`-less UI elements ever come into play, unless someone mis-named a desk or something.
|
|
||||||
- `showname_enable` is a checkbox that toggles whether you should see shownames or not. This does not influence whether you can USE custom shownames or not, so you can have it off, while still showing a custom showname to everyone else. Needs X, Y, width, height as usual.
|
|
||||||
- `settings` is a plain button that takes up the OS's looks, like the 'Call mod' button. Takes the same arguments as above.
|
|
||||||
- You can also just type `/settings` in OOC.
|
|
||||||
- `char_search` is a text input box on the character selection screen, which allows you to filter characters down to name. Needs the same arguments.
|
|
||||||
- `char_passworded` is a checkbox, that when ticked, shows all passworded characters on the character selection screen. Needs the same as above.
|
|
||||||
- `char_taken` is another checkbox, that does the same, but for characters that are taken.
|
|
||||||
- `not_guilty` is a button similar to the CE / WT buttons, that if pressed, plays the Not Guilty verdict animation. Needs the same arguments.
|
|
||||||
- `guilty` is similar to `not_guilty`, but for the Guilty verdict.
|
|
||||||
- `pair_button` is a toggleable button, that shows and hides the pairing list and the offset spinbox. Works similarly to the mute button.
|
|
||||||
- `pair_list` is a list of all characters in alphabetical order, shown when the user presses the Pair button. If a character is clicked on it, it is selected as the character the user wants to pair up with.
|
|
||||||
- `pair_offset_spinbox` is a spinbox that allows the user to choose between offsets of -100% to 100%.
|
|
||||||
- `switch_area_music` is a button with the text 'A/M', that toggles between the music list and the areas list. Though the two are different, they are programmed to take the same space.
|
|
||||||
- `pre_no_interrupt` is a checkbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not.
|
|
||||||
- `area_free_color` is a combination of red, green, and blue values ranging from 0 to 255. This determines the colour of the area in the Area list if it's free, and has a status of `IDLE`.
|
|
||||||
- `area_lfp_color` determines the colour of the area if its status is `LOOKING-FOR-PLAYERS`.
|
|
||||||
- `area_casing_color` determines the colour of the area if its status is `CASING`.
|
|
||||||
- `area_recess_color` determines the colour of the area if its status is `RECESS`.
|
|
||||||
- `area_rp_color` determines the colour of the area if its status is `RP`.
|
|
||||||
- `area_gaming_color` determines the colour of the area if its status is `GAMING`.
|
|
||||||
- `area_locked_color` determines the colour of the area if it is locked, regardless of status.
|
|
||||||
- `ooc_default_color` determines the colour of the username in the OOC chat if the message doesn't come from the server.
|
|
||||||
- `ooc_server_color` determines the colour of the username if the message arrived from the server.
|
|
||||||
- `casing_button` is a button with the text 'Casing' that when clicked, brings up the Case Announcements dialog. You can give the case a name, and tick whom do you want to alert. You need to be a CM for it to go through. Only people who have at least one of the roles ticked will get the alert.
|
|
||||||
- `casing` is a checkbox with the text 'Casing'. If ticked, you will get the case announcements alerts you should get, in accordance to the above. In the settings, you can change your defaults on the 'Casing' tab. (That's a buncha things titled 'Casing'!)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Compiling
|
|
||||||
|
|
||||||
The traditional route is by undergoing the [AO2 Rite of Passage](https://gist.github.com/oldmud0/6c645bd1667370c3e92686f7d0642c38). Recently, however, it has become more feasible to get away with a dynamic compilation, which is much easier for beginners and requires less setup.
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- [QtApng](https://github.com/Skycoder42/QtApng)
|
|
||||||
- [BASS](http://un4seen.com) (proprietary, but will become optional in the future; see #35)
|
|
||||||
- [Discord Rich Presence](https://github.com/discordapp/discord-rpc)
|
|
||||||
|
|
||||||
## Release instructions
|
|
||||||
|
|
||||||
Follow these steps to make a new full release:
|
|
||||||
|
|
||||||
- Set a new AO version in the `.pro` file and in `aoapplication.h`.
|
|
||||||
- Compile the project.
|
|
||||||
- Commit the version bump and and create a tag for the commit.
|
|
||||||
- Rename the executable to `Attorney_Online`.
|
|
||||||
- Create a temp directory.
|
|
||||||
- Copy a fresh `base` folder to the temp dir. Ensure that the timestamps are consistent.
|
|
||||||
- Ignore this step if creating a client-only release.
|
|
||||||
- Copy the repository's `base` folder to the temp dir.
|
|
||||||
- Append `.sample` to the names of all `.ini` files, including `serverlist.txt`.
|
|
||||||
- Copy the game executable to the temp dir.
|
|
||||||
- Copy `bass.dll`, `discord-rpc.dll`, and `qapng.dll` if applicable.
|
|
||||||
- Copy `README.md` as `README.md.txt` with CRLF line endings.
|
|
||||||
- Copy `LICENSE` as `LICENSE.txt` with CRLF line endings.
|
|
||||||
- Compress the contents of the temp dir to an archive with maximum compression, but
|
|
||||||
be sure that the contents are placed inside the root directory of the archive and not
|
|
||||||
within a subdirectory.
|
|
||||||
- Compute the SHA-1 hash of the archive.
|
|
||||||
- Upload the archive to the Wasabi bucket and an additional mirror (e.g. MEGA or OneDrive)
|
|
||||||
(if this is a full release).
|
|
||||||
- Publish a GitHub release and upload the archive there (if this is a client-only release).
|
|
||||||
- Add the new version to the `program.json` manifest for the respective platform
|
|
||||||
(if this is a client-only release).
|
|
||||||
- Update the following on the website for the respective platform:
|
|
||||||
- Full download links (Wasabi and mirror)
|
|
||||||
- Client download link
|
|
||||||
- Full download hash
|
|
||||||
- Client download hash
|
|
||||||
|
|
||||||
Repeat for each platform (currently 32-bit Windows and 64-bit Linux). Once you're done, don't forget to announce your release!
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
@ -244,6 +20,8 @@ Modifications copyright (c) 2017-2018 oldmud0
|
|||||||
|
|
||||||
Case Café additions copyright (c) 2018 Cerapter
|
Case Café additions copyright (c) 2018 Cerapter
|
||||||
|
|
||||||
|
Killing Fever Online additions copyright (c) 2019 Crystalwarrior
|
||||||
|
|
||||||
### Qt
|
### Qt
|
||||||
|
|
||||||
This project uses Qt 5, which is licensed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.txt) with [certain licensing restrictions and exceptions](https://www.qt.io/qt-licensing-terms/). To comply with licensing requirements for static linking, object code is available if you would like to relink with an alternative version of Qt, and the source code for Qt may be found at https://github.com/qt/qtbase, http://code.qt.io/cgit/, or at https://qt.io.
|
This project uses Qt 5, which is licensed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.txt) with [certain licensing restrictions and exceptions](https://www.qt.io/qt-licensing-terms/). To comply with licensing requirements for static linking, object code is available if you would like to relink with an alternative version of Qt, and the source code for Qt may be found at https://github.com/qt/qtbase, http://code.qt.io/cgit/, or at https://qt.io.
|
||||||
|
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
@ -1,10 +0,0 @@
|
|||||||
theme = default
|
|
||||||
blip_rate = 1
|
|
||||||
blank_blip = false
|
|
||||||
default_music = 50
|
|
||||||
default_sfx = 50
|
|
||||||
default_blip = 50
|
|
||||||
discord = true
|
|
||||||
ic_scroll_down = false
|
|
||||||
; master = master.aceattorneyonline.com
|
|
||||||
; ooc_name = Phoenix
|
|
BIN
base/misc/default/chatbox.png
Normal file
After Width: | Height: | Size: 505 B |
59
base/misc/default/config.ini
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
c0 = 255, 255, 255
|
||||||
|
c0_name = White
|
||||||
|
c0_talking = 1
|
||||||
|
|
||||||
|
c1 = 0, 255, 0
|
||||||
|
c1_name = Green
|
||||||
|
c1_start = `
|
||||||
|
c1_end = `
|
||||||
|
c1_remove = 1
|
||||||
|
c1_talking = 1
|
||||||
|
|
||||||
|
c2 = 255, 0, 0
|
||||||
|
c2_name = Red
|
||||||
|
c2_start = ~
|
||||||
|
c2_end = ~
|
||||||
|
c2_remove = 1
|
||||||
|
c2_talking = 1
|
||||||
|
|
||||||
|
c3 = 255, 165, 0
|
||||||
|
c3_name = Orange
|
||||||
|
c3_start = |
|
||||||
|
c3_end = |
|
||||||
|
c3_remove = 1
|
||||||
|
c3_talking = 0
|
||||||
|
|
||||||
|
c4 = 45, 150, 255
|
||||||
|
c4_name = Blue
|
||||||
|
c4_start = (
|
||||||
|
c4_end = )
|
||||||
|
c4_remove = 0
|
||||||
|
c4_talking = 0
|
||||||
|
|
||||||
|
c5 = 255, 255, 0
|
||||||
|
c5_name = Yellow
|
||||||
|
c5_start = º
|
||||||
|
c5_end = º
|
||||||
|
c5_remove = 1
|
||||||
|
c5_talking = 1
|
||||||
|
|
||||||
|
c6 = 255, 192, 203
|
||||||
|
c6_name = Pink
|
||||||
|
c6_start = №
|
||||||
|
c6_end = №
|
||||||
|
c6_remove = 1
|
||||||
|
c6_talking = 1
|
||||||
|
|
||||||
|
c7 = 0, 255, 255
|
||||||
|
c7_name = Cyan
|
||||||
|
c7_start = √
|
||||||
|
c7_end = √
|
||||||
|
c7_remove = 1
|
||||||
|
c7_talking = 1
|
||||||
|
|
||||||
|
c8 = 187, 187, 187
|
||||||
|
c8_name = Gray
|
||||||
|
c8_start = [
|
||||||
|
c8_end = ]
|
||||||
|
c8_remove = 0
|
||||||
|
c8_talking = 1
|
BIN
base/misc/default/holdit.opus
Normal file
BIN
base/misc/default/holdit_bubble.gif
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
base/misc/default/objection.opus
Normal file
BIN
base/misc/default/objection_bubble.gif
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
base/misc/default/takethat.opus
Normal file
BIN
base/misc/default/takethat_bubble.gif
Normal file
After Width: | Height: | Size: 40 KiB |
@ -1 +1 @@
|
|||||||
Subproject commit 6e1317ed93a9a4831047aa151c28742b1dd8afb5
|
Subproject commit 8de30fc0fa0e1492a29dad0e839764ca44168cb3
|
@ -1,383 +1,454 @@
|
|||||||
#ifndef AOAPPLICATION_H
|
#ifndef AOAPPLICATION_H
|
||||||
#define AOAPPLICATION_H
|
#define AOAPPLICATION_H
|
||||||
|
|
||||||
#include "aopacket.h"
|
#include "aopacket.h"
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "discord_rich_presence.h"
|
#include "discord_rich_presence.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#ifdef QTAUDIO
|
#ifdef QTAUDIO
|
||||||
#include <QAudioDeviceInfo>
|
#include <QAudioDeviceInfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QFuture>
|
class NetworkManager;
|
||||||
#include <QThread>
|
class Lobby;
|
||||||
#include <QThreadPool>
|
class Courtroom;
|
||||||
#include <QtConcurrent/QtConcurrent>
|
|
||||||
|
class AOApplication : public QApplication {
|
||||||
class NetworkManager;
|
Q_OBJECT
|
||||||
class Lobby;
|
|
||||||
class Courtroom;
|
public:
|
||||||
class AOApplication : public QApplication {
|
AOApplication(int &argc, char **argv);
|
||||||
Q_OBJECT
|
~AOApplication();
|
||||||
|
|
||||||
public:
|
NetworkManager *net_manager;
|
||||||
AOApplication(int &argc, char **argv);
|
Lobby *w_lobby;
|
||||||
~AOApplication();
|
Courtroom *w_courtroom;
|
||||||
|
AttorneyOnline::Discord *discord;
|
||||||
NetworkManager *net_manager;
|
|
||||||
Lobby *w_lobby;
|
bool lobby_constructed = false;
|
||||||
Courtroom *w_courtroom;
|
bool courtroom_constructed = false;
|
||||||
AttorneyOnline::Discord *discord;
|
|
||||||
|
void construct_lobby();
|
||||||
bool lobby_constructed = false;
|
void destruct_lobby();
|
||||||
bool courtroom_constructed = false;
|
|
||||||
|
void construct_courtroom();
|
||||||
void construct_lobby();
|
void destruct_courtroom();
|
||||||
void destruct_lobby();
|
|
||||||
|
void ms_packet_received(AOPacket *p_packet);
|
||||||
void construct_courtroom();
|
void server_packet_received(AOPacket *p_packet);
|
||||||
void destruct_courtroom();
|
|
||||||
|
void send_ms_packet(AOPacket *p_packet);
|
||||||
bool is_music_track(QString trackname);
|
void send_server_packet(AOPacket *p_packet, bool encoded = true);
|
||||||
|
|
||||||
void ms_packet_received(AOPacket *p_packet);
|
void call_settings_menu();
|
||||||
void server_packet_received(AOPacket *p_packet);
|
void call_announce_menu(Courtroom *court);
|
||||||
|
|
||||||
void send_ms_packet(AOPacket *p_packet);
|
/////////////////server metadata//////////////////
|
||||||
void send_server_packet(AOPacket *p_packet, bool encoded = true);
|
|
||||||
|
unsigned int s_decryptor = 5;
|
||||||
void call_settings_menu();
|
bool encryption_needed = true;
|
||||||
void call_announce_menu(Courtroom *court);
|
|
||||||
|
bool yellow_text_enabled = false;
|
||||||
/////////////////server metadata//////////////////
|
bool prezoom_enabled = false;
|
||||||
|
bool flipping_enabled = false;
|
||||||
unsigned int s_decryptor = 5;
|
bool custom_objection_enabled = false;
|
||||||
bool encryption_needed = true;
|
bool improved_loading_enabled = false;
|
||||||
|
bool desk_mod_enabled = false;
|
||||||
bool yellow_text_enabled = false;
|
bool evidence_enabled = false;
|
||||||
bool prezoom_enabled = false;
|
bool cccc_ic_support_enabled = false;
|
||||||
bool flipping_enabled = false;
|
bool arup_enabled = false;
|
||||||
bool custom_objection_enabled = false;
|
bool casing_alerts_enabled = false;
|
||||||
bool improved_loading_enabled = false;
|
bool modcall_reason_enabled = false;
|
||||||
bool desk_mod_enabled = false;
|
bool looping_sfx_support_enabled = false;
|
||||||
bool evidence_enabled = false;
|
bool additive_enabled = false;
|
||||||
bool cccc_ic_support_enabled = false;
|
bool effects_enabled = false;
|
||||||
bool arup_enabled = false;
|
|
||||||
bool casing_alerts_enabled = false;
|
///////////////loading info///////////////////
|
||||||
bool modcall_reason_enabled = false;
|
|
||||||
bool looping_sfx_support_enabled = false;
|
// player number, it's hardly used but might be needed for some old servers
|
||||||
|
int s_pv = 0;
|
||||||
///////////////loading info///////////////////
|
|
||||||
|
QString server_software = "";
|
||||||
// player number, it's hardly used but might be needed for some old servers
|
|
||||||
int s_pv = 0;
|
int char_list_size = 0;
|
||||||
|
int loaded_chars = 0;
|
||||||
QString server_software = "";
|
int generated_chars = 0;
|
||||||
|
int evidence_list_size = 0;
|
||||||
int char_list_size = 0;
|
int loaded_evidence = 0;
|
||||||
int loaded_chars = 0;
|
int music_list_size = 0;
|
||||||
int generated_chars = 0;
|
int loaded_music = 0;
|
||||||
int evidence_list_size = 0;
|
|
||||||
int loaded_evidence = 0;
|
bool courtroom_loaded = false;
|
||||||
int music_list_size = 0;
|
|
||||||
int loaded_music = 0;
|
//////////////////versioning///////////////
|
||||||
int area_count = 0;
|
|
||||||
bool courtroom_loaded = false;
|
int get_release() const { return RELEASE; }
|
||||||
|
int get_major_version() const { return MAJOR_VERSION; }
|
||||||
//////////////////versioning///////////////
|
int get_minor_version() const { return MINOR_VERSION; }
|
||||||
|
QString get_version_string();
|
||||||
int get_release() const { return RELEASE; }
|
|
||||||
int get_major_version() const { return MAJOR_VERSION; }
|
///////////////////////////////////////////
|
||||||
int get_minor_version() const { return MINOR_VERSION; }
|
|
||||||
QString get_version_string();
|
void set_favorite_list();
|
||||||
|
QVector<server_type> &get_favorite_list() { return favorite_list; }
|
||||||
///////////////////////////////////////////
|
void add_favorite_server(int p_server);
|
||||||
|
|
||||||
void set_favorite_list();
|
void set_server_list();
|
||||||
QVector<server_type> &get_favorite_list() { return favorite_list; }
|
QVector<server_type> &get_server_list() { return server_list; }
|
||||||
void add_favorite_server(int p_server);
|
|
||||||
|
// reads the theme from config.ini and sets it accordingly
|
||||||
void set_server_list();
|
void reload_theme();
|
||||||
QVector<server_type> &get_server_list() { return server_list; }
|
|
||||||
|
// Returns the character the player has currently selected
|
||||||
// reads the theme from config.ini and sets it accordingly
|
QString get_current_char();
|
||||||
void reload_theme();
|
|
||||||
|
// implementation in path_functions.cpp
|
||||||
// Returns the character the player has currently selected
|
QString get_base_path();
|
||||||
QString get_current_char();
|
QString get_data_path();
|
||||||
|
QString get_theme_path(QString p_file);
|
||||||
// implementation in path_functions.cpp
|
QString get_default_theme_path(QString p_file);
|
||||||
QString get_base_path();
|
QString get_custom_theme_path(QString p_theme, QString p_file);
|
||||||
QString get_data_path();
|
QString get_character_path(QString p_char, QString p_file);
|
||||||
QString get_theme_path(QString p_file);
|
QString get_sounds_path(QString p_file);
|
||||||
QString get_default_theme_path(QString p_file);
|
QString get_music_path(QString p_song);
|
||||||
QString get_custom_theme_path(QString p_theme, QString p_file);
|
QString get_background_path(QString p_file);
|
||||||
QString get_character_path(QString p_char, QString p_file);
|
QString get_default_background_path(QString p_file);
|
||||||
QString get_sounds_path(QString p_file);
|
QString get_evidence_path(QString p_file);
|
||||||
QString get_music_path(QString p_song);
|
QString get_case_sensitive_path(QString p_file);
|
||||||
QString get_background_path(QString p_file);
|
|
||||||
QString get_default_background_path(QString p_file);
|
////// Functions for reading and writing files //////
|
||||||
QString get_evidence_path(QString p_file);
|
// Implementations file_functions.cpp
|
||||||
QString get_case_sensitive_path(QString p_file);
|
|
||||||
|
// Instead of reinventing the wheel, we'll use a QSettings class.
|
||||||
////// Functions for reading and writing files //////
|
QSettings *configini;
|
||||||
// Implementations file_functions.cpp
|
|
||||||
|
// Reads the theme from config.ini and loads it into the current_theme
|
||||||
// Instead of reinventing the wheel, we'll use a QSettings class.
|
// variable
|
||||||
QSettings *configini;
|
QString read_theme();
|
||||||
|
|
||||||
// Reads the theme from config.ini and loads it into the current_theme
|
// Returns the value of ooc_name in config.ini
|
||||||
// variable
|
QString get_ooc_name();
|
||||||
QString read_theme();
|
|
||||||
|
// Returns the blip rate from config.ini (once per X symbols)
|
||||||
// Returns the value of ooc_name in config.ini
|
int read_blip_rate();
|
||||||
QString get_ooc_name();
|
|
||||||
|
// Returns true if blank blips is enabled in config.ini and false otherwise
|
||||||
// Returns the blip rate from config.ini
|
bool get_blank_blip();
|
||||||
int read_blip_rate();
|
|
||||||
|
// Returns true if looping sound effects are enabled in the config.ini
|
||||||
// Returns true if blank blips is enabled in config.ini and false otherwise
|
bool get_looping_sfx();
|
||||||
bool get_blank_blip();
|
|
||||||
|
// Returns true if stop music on objection is enabled in the config.ini
|
||||||
// Returns true if looping sound effects are enabled in the config.ini
|
bool objection_stop_music();
|
||||||
bool get_looping_sfx();
|
|
||||||
|
// Returns the value of default_music in config.ini
|
||||||
// Returns true if kill music on object is enabled in the config.ini
|
int get_default_music();
|
||||||
bool get_objectmusic();
|
|
||||||
|
// Returns the value of default_sfx in config.ini
|
||||||
// Returns the value of default_music in config.ini
|
int get_default_sfx();
|
||||||
int get_default_music();
|
|
||||||
|
// Returns the value of default_blip in config.ini
|
||||||
// Returns the value of default_sfx in config.ini
|
int get_default_blip();
|
||||||
int get_default_sfx();
|
|
||||||
|
// Returns the value of whether Discord should be enabled on startup
|
||||||
// Returns the value of default_blip in config.ini
|
// from the config.ini.
|
||||||
int get_default_blip();
|
bool is_discord_enabled();
|
||||||
|
|
||||||
// Returns the value of whether Discord should be enabled on startup
|
// Returns the value of whether shaking should be enabled.
|
||||||
// from the config.ini.
|
// from the config.ini.
|
||||||
bool is_discord_enabled();
|
bool is_shake_enabled();
|
||||||
|
|
||||||
// Returns the value of whether shaking and flashing should be enabled.
|
// Returns the value of whether effects should be enabled.
|
||||||
// from the config.ini.
|
// from the config.ini.
|
||||||
bool is_shakeandflash_enabled();
|
bool is_effects_enabled();
|
||||||
|
|
||||||
// Returns whether evidence should be maintained ic
|
// Returns the value of whether frame-specific effects defined in char.ini
|
||||||
bool is_keepevi_enabled();
|
// should be sent/received over the network. from the config.ini.
|
||||||
|
bool is_frame_network_enabled();
|
||||||
// Returns the value of the maximum amount of lines the IC chatlog
|
|
||||||
// may contain, from config.ini.
|
// Returns the value of whether colored ic log should be a thing.
|
||||||
int get_max_log_size();
|
// from the config.ini.
|
||||||
|
bool is_colorlog_enabled();
|
||||||
// Gets the punctuation delay modifier
|
|
||||||
bool get_pundelay();
|
// Returns the value of whether sticky sounds should be a thing.
|
||||||
|
// from the config.ini.
|
||||||
//Gets whether slower text speed is enabled
|
bool is_stickysounds_enabled();
|
||||||
bool get_slower_blips();
|
|
||||||
// Returns whether the log should go upwards (new behaviour)
|
// Returns the value of whether sticky effects should be a thing.
|
||||||
// or downwards (vanilla behaviour).
|
// from the config.ini.
|
||||||
bool get_log_goes_downwards();
|
bool is_stickyeffects_enabled();
|
||||||
|
|
||||||
// Returns the username the user may have set in config.ini.
|
// Returns the value of whether sticky preanims should be a thing.
|
||||||
QString get_default_username();
|
// from the config.ini.
|
||||||
|
bool is_stickypres_enabled();
|
||||||
// Returns the audio device used for the client.
|
|
||||||
QString get_audio_output_device();
|
// Returns the value of whether custom chatboxes should be a thing.
|
||||||
#ifdef QTAUDIO
|
// from the config.ini.
|
||||||
QAudioDeviceInfo QtAudioDevice;
|
// I am increasingly maddened by the lack of dynamic auto-generation system for settings.
|
||||||
#endif
|
bool is_customchat_enabled();
|
||||||
|
|
||||||
// Returns whether the user would like to have custom shownames on by default.
|
// Returns the value of the maximum amount of lines the IC chatlog
|
||||||
bool get_showname_enabled_by_default();
|
// may contain, from config.ini.
|
||||||
|
int get_max_log_size();
|
||||||
// Returns the list of words in callwords.ini
|
|
||||||
QStringList get_call_words();
|
// Returns whether the log should go upwards (new behaviour)
|
||||||
|
// or downwards (vanilla behaviour).
|
||||||
// Appends the argument string to serverlist.txt
|
bool get_log_goes_downwards();
|
||||||
void write_to_serverlist_txt(QString p_line);
|
|
||||||
|
// Returns the username the user may have set in config.ini.
|
||||||
// Returns the contents of serverlist.txt
|
QString get_default_username();
|
||||||
QVector<server_type> read_serverlist_txt();
|
|
||||||
|
// Returns the audio device used for the client.
|
||||||
// Returns the value of p_identifier in the design.ini file in p_design_path
|
QString get_audio_output_device();
|
||||||
QString read_design_ini(QString p_identifier, QString p_design_path);
|
#ifdef QTAUDIO
|
||||||
|
QAudioDeviceInfo QtAudioDevice;
|
||||||
// Returns the coordinates of widget with p_identifier from p_file
|
#endif
|
||||||
QPoint get_button_spacing(QString p_identifier, QString p_file);
|
|
||||||
|
// Returns whether the user would like to have custom shownames on by default.
|
||||||
// Returns the dimensions of widget with specified identifier from p_file
|
bool get_showname_enabled_by_default();
|
||||||
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
|
|
||||||
|
// Returns the list of words in callwords.ini
|
||||||
// Returns the name of the font with p_identifier from p_file
|
QStringList get_call_words();
|
||||||
QString get_font_name(QString p_identifier, QString p_file);
|
|
||||||
|
// returns all of the file's lines in a QStringList
|
||||||
// Returns the value of font_size with p_identifier from p_file
|
QStringList get_list_file(QString p_file);
|
||||||
int get_font_size(QString p_identifier, QString p_file);
|
|
||||||
|
// Process a file and return its text as a QString
|
||||||
// Returns the color with p_identifier from p_file
|
QString read_file(QString filename);
|
||||||
QColor get_color(QString p_identifier, QString p_file);
|
|
||||||
|
// Write text to file. make_dir would auto-create the directory if it doesn't
|
||||||
// Returns the colour from the misc folder.
|
// exist.
|
||||||
QColor get_chat_color(QString p_identifier, QString p_chat);
|
bool write_to_file(QString p_text, QString p_file, bool make_dir = false);
|
||||||
|
|
||||||
// Returns the sfx with p_identifier from sounds.ini in the current theme path
|
// Append text to the end of the file. make_dir would auto-create the
|
||||||
QString get_sfx(QString p_identifier);
|
// directory if it doesn't exist.
|
||||||
|
bool append_to_file(QString p_text, QString p_file, bool make_dir = false);
|
||||||
// Figure out if we can opus this or if we should fall back to wav
|
|
||||||
QString get_sfx_suffix(QString sound_to_check);
|
// Appends the argument string to serverlist.txt
|
||||||
|
void write_to_serverlist_txt(QString p_line);
|
||||||
// figure out if we can find what prefix this song uses
|
|
||||||
QString get_music_prefix(QString song_to_check);
|
// Returns the contents of serverlist.txt
|
||||||
|
QVector<server_type> read_serverlist_txt();
|
||||||
// Can we use APNG for this? If not, WEBP? if not, GIF? If not, fall back to a
|
|
||||||
// gif.
|
// Returns the value of p_identifier in the design.ini file in p_design_path
|
||||||
QString get_image_suffix(QString path_to_check);
|
QString read_design_ini(QString p_identifier, QString p_design_path);
|
||||||
|
|
||||||
// Returns the value of p_search_line within target_tag and terminator_tag
|
// Returns the coordinates of widget with p_identifier from p_file
|
||||||
QString read_char_ini(QString p_char, QString p_search_line,
|
QPoint get_button_spacing(QString p_identifier, QString p_file);
|
||||||
QString target_tag);
|
|
||||||
|
// Returns the dimensions of widget with specified identifier from p_file
|
||||||
// Returns the side of the p_char character from that characters ini file
|
pos_size_type get_element_dimensions(QString p_identifier, QString p_file,
|
||||||
QString get_char_side(QString p_char);
|
QString p_char = "");
|
||||||
|
|
||||||
// Returns the showname from the ini of p_char
|
// Returns the value to you
|
||||||
QString get_showname(QString p_char);
|
QString get_design_element(QString p_identifier, QString p_file,
|
||||||
|
QString p_char = "");
|
||||||
// Returns the value of chat from the specific p_char's ini file
|
|
||||||
QString get_chat(QString p_char);
|
// Returns the name of the font with p_identifier from p_file
|
||||||
|
QString get_font_name(QString p_identifier, QString p_file);
|
||||||
// Returns the value of shouts from the specified p_char's ini file
|
|
||||||
QString get_char_shouts(QString p_char);
|
// Returns the value of font_size with p_identifier from p_file
|
||||||
|
int get_font_size(QString p_identifier, QString p_file);
|
||||||
// Returns the preanim duration of p_char's p_emote
|
|
||||||
int get_preanim_duration(QString p_char, QString p_emote);
|
// Returns the color with p_identifier from p_file
|
||||||
|
QColor get_color(QString p_identifier, QString p_file);
|
||||||
// Same as above, but only returns if it has a % in front(refer to Preanims
|
|
||||||
// section in the manual)
|
// Returns the markdown symbol used for specified p_identifier such as colors
|
||||||
int get_ao2_preanim_duration(QString p_char, QString p_emote);
|
QString get_chat_markdown(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
// Not in use
|
// Returns the color from the misc folder.
|
||||||
int get_text_delay(QString p_char, QString p_emote);
|
QColor get_chat_color(QString p_identifier, QString p_chat);
|
||||||
|
|
||||||
// Returns the custom realisation used by the character.
|
// Returns the sfx with p_identifier from sounds.ini in the current theme path
|
||||||
QString get_custom_realization(QString p_char);
|
QString get_sfx(QString p_identifier);
|
||||||
|
|
||||||
// Returns the name of p_char
|
// Figure out if we can opus this or if we should fall back to wav
|
||||||
QString get_char_name(QString p_char);
|
QString get_sfx_suffix(QString sound_to_check);
|
||||||
|
|
||||||
// Returns the total amount of emotes of p_char
|
// Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to
|
||||||
int get_emote_number(QString p_char);
|
// PNG.
|
||||||
|
QString get_image_suffix(QString path_to_check);
|
||||||
// Returns the emote comment of p_char's p_emote
|
|
||||||
QString get_emote_comment(QString p_char, int p_emote);
|
// If this image is static and non-animated, return the supported static image
|
||||||
|
// formats. Currently only PNG.
|
||||||
// Returns if an emote loops it's SFX
|
QString get_static_image_suffix(QString path_to_check);
|
||||||
QString get_sfx_looping(QString p_char, int p_emote);
|
|
||||||
|
// Returns the value of p_search_line within target_tag and terminator_tag
|
||||||
// Returns if an emote has a frame specific SFX for it
|
QString read_char_ini(QString p_char, QString p_search_line,
|
||||||
QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame);
|
QString target_tag);
|
||||||
|
|
||||||
// Returns if an emote has a frame specific SFX for it
|
// Returns a QStringList of all key=value definitions on a given tag.
|
||||||
QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
|
QStringList read_ini_tags(QString p_file, QString target_tag = "");
|
||||||
|
|
||||||
// Returns if an emote has a frame specific SFX for it
|
// Sets the char.ini p_search_line key under tag target_tag to value.
|
||||||
QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
|
void set_char_ini(QString p_char, QString value, QString p_search_line,
|
||||||
|
QString target_tag);
|
||||||
// Returns the base name of p_char's p_emote
|
|
||||||
QString get_emote(QString p_char, int p_emote);
|
// Returns the text between target_tag and terminator_tag in p_file
|
||||||
|
QString get_stylesheet(QString p_file);
|
||||||
// Returns the preanimation name of p_char's p_emote
|
|
||||||
QString get_pre_emote(QString p_char, int p_emote);
|
// Returns the text between target_tag and terminator_tag in p_file
|
||||||
|
QString get_tagged_stylesheet(QString target_tag, QString p_file);
|
||||||
// Returns the sfx of p_char's p_emote
|
|
||||||
QString get_sfx_name(QString p_char, int p_emote);
|
// Returns the side of the p_char character from that characters ini file
|
||||||
|
QString get_char_side(QString p_char);
|
||||||
// Not in use
|
|
||||||
int get_sfx_delay(QString p_char, int p_emote);
|
// Returns the showname from the ini of p_char
|
||||||
|
QString get_showname(QString p_char);
|
||||||
// Returns the modifier for p_char's p_emote
|
|
||||||
int get_emote_mod(QString p_char, int p_emote);
|
// Returns the value of chat image from the specific p_char's ini file
|
||||||
|
QString get_chat(QString p_char);
|
||||||
// Returns the desk modifier for p_char's p_emote
|
|
||||||
int get_desk_mod(QString p_char, int p_emote);
|
// Returns the value of chat font from the specific p_char's ini file
|
||||||
|
QString get_chat_font(QString p_char);
|
||||||
// Returns p_char's gender
|
|
||||||
QString get_gender(QString p_char);
|
// Returns the value of chat font size from the specific p_char's ini file
|
||||||
|
int get_chat_size(QString p_char);
|
||||||
// ======
|
|
||||||
// These are all casing-related settings.
|
// Returns the value of shouts from the specified p_char's ini file
|
||||||
// ======
|
QString get_char_shouts(QString p_char);
|
||||||
|
|
||||||
// Returns if the user has casing alerts enabled.
|
// Returns the preanim duration of p_char's p_emote
|
||||||
bool get_casing_enabled();
|
int get_preanim_duration(QString p_char, QString p_emote);
|
||||||
|
|
||||||
// Returns if the user wants to get alerts for the defence role.
|
// Same as above, but only returns if it has a % in front(refer to Preanims
|
||||||
bool get_casing_defence_enabled();
|
// section in the manual)
|
||||||
|
int get_ao2_preanim_duration(QString p_char, QString p_emote);
|
||||||
// Same for prosecution.
|
|
||||||
bool get_casing_prosecution_enabled();
|
// Not in use
|
||||||
|
int get_text_delay(QString p_char, QString p_emote);
|
||||||
// Same for judge.
|
|
||||||
bool get_casing_judge_enabled();
|
// Get the effects folder referenced by the char.ini, read it and return the
|
||||||
|
// list of filenames in a string
|
||||||
// Same for witnesses.
|
QStringList get_theme_effects();
|
||||||
bool get_casing_wit_enabled();
|
|
||||||
|
// Get the theme's effects folder, read it and return the list of filenames in
|
||||||
// Same for juror.
|
// a string
|
||||||
bool get_casing_juror_enabled();
|
QStringList get_effects(QString p_char);
|
||||||
|
|
||||||
// Same for steno.
|
// t
|
||||||
bool get_casing_steno_enabled();
|
QString get_effect(QString effect, QString p_char, QString p_folder);
|
||||||
|
|
||||||
// Same for CM.
|
// Return the effect sound associated with the fx_name in the
|
||||||
bool get_casing_cm_enabled();
|
// misc/effects/<char-defined>/sounds.ini, or theme/effects/sounds.ini.
|
||||||
|
QString get_effect_sound(QString fx_name, QString p_char);
|
||||||
// Get the message for the CM for casing alerts.
|
|
||||||
QString get_casing_can_host_cases();
|
// Returns the custom realisation used by the character.
|
||||||
|
QString get_custom_realization(QString p_char);
|
||||||
// Get if html for ic log is enabled
|
|
||||||
bool get_colored_iclog_enabled();
|
// Returns the name of p_char
|
||||||
|
QString get_char_name(QString p_char);
|
||||||
// Get if ic log mirror is enabled
|
|
||||||
bool get_iclmir_enabled();
|
// Returns the total amount of emotes of p_char
|
||||||
|
int get_emote_number(QString p_char);
|
||||||
// Get if only inline coloring should be shown in log
|
|
||||||
bool colorlog_restricted_enabled();
|
// Returns the emote comment of p_char's p_emote
|
||||||
|
QString get_emote_comment(QString p_char, int p_emote);
|
||||||
private:
|
|
||||||
const int RELEASE = 2;
|
// Returns the base name of p_char's p_emote
|
||||||
const int MAJOR_VERSION = 7;
|
QString get_emote(QString p_char, int p_emote);
|
||||||
const int MINOR_VERSION = 0;
|
|
||||||
|
// Returns the preanimation name of p_char's p_emote
|
||||||
QString current_theme = "default";
|
QString get_pre_emote(QString p_char, int p_emote);
|
||||||
|
|
||||||
QVector<server_type> server_list;
|
// Returns the sfx of p_char's p_emote
|
||||||
QVector<server_type> favorite_list;
|
QString get_sfx_name(QString p_char, int p_emote);
|
||||||
|
|
||||||
private slots:
|
// Returns the blipsound of p_char's p_emote
|
||||||
void ms_connect_finished(bool connected, bool will_retry);
|
QString get_emote_blip(QString p_char, int p_emote);
|
||||||
|
|
||||||
public slots:
|
// Returns if the sfx is defined as looping in char.ini
|
||||||
void server_disconnected();
|
QString get_sfx_looping(QString p_char, int p_emote);
|
||||||
void loading_cancelled();
|
|
||||||
};
|
// Returns if an emote has a frame specific SFX for it
|
||||||
|
QString get_sfx_frame(QString p_char, QString p_emote, int n_frame);
|
||||||
#endif // AOAPPLICATION_H
|
|
||||||
|
// Returns if an emote has a frame specific SFX for it
|
||||||
|
QString get_flash_frame(QString p_char, QString p_emote, int n_frame);
|
||||||
|
|
||||||
|
// Returns if an emote has a frame specific SFX for it
|
||||||
|
QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
|
||||||
|
|
||||||
|
// Not in use
|
||||||
|
int get_sfx_delay(QString p_char, int p_emote);
|
||||||
|
|
||||||
|
// Returns the modifier for p_char's p_emote
|
||||||
|
int get_emote_mod(QString p_char, int p_emote);
|
||||||
|
|
||||||
|
// Returns the desk modifier for p_char's p_emote
|
||||||
|
int get_desk_mod(QString p_char, int p_emote);
|
||||||
|
|
||||||
|
// Returns p_char's gender
|
||||||
|
QString get_gender(QString p_char);
|
||||||
|
|
||||||
|
// ======
|
||||||
|
// These are all casing-related settings.
|
||||||
|
// ======
|
||||||
|
|
||||||
|
// Returns if the user has casing alerts enabled.
|
||||||
|
bool get_casing_enabled();
|
||||||
|
|
||||||
|
// Returns if the user wants to get alerts for the defence role.
|
||||||
|
bool get_casing_defence_enabled();
|
||||||
|
|
||||||
|
// Same for prosecution.
|
||||||
|
bool get_casing_prosecution_enabled();
|
||||||
|
|
||||||
|
// Same for judge.
|
||||||
|
bool get_casing_judge_enabled();
|
||||||
|
|
||||||
|
// Same for juror.
|
||||||
|
bool get_casing_juror_enabled();
|
||||||
|
|
||||||
|
// Same for steno.
|
||||||
|
bool get_casing_steno_enabled();
|
||||||
|
|
||||||
|
// Same for CM.
|
||||||
|
bool get_casing_cm_enabled();
|
||||||
|
|
||||||
|
// Get the message for the CM for casing alerts.
|
||||||
|
QString get_casing_can_host_cases();
|
||||||
|
|
||||||
|
// Get if automatic logging is enabled
|
||||||
|
bool get_auto_logging_enabled();
|
||||||
|
|
||||||
|
// The file name of the log file in base/logs.
|
||||||
|
QString log_filename;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const int RELEASE = 2;
|
||||||
|
const int MAJOR_VERSION = 8;
|
||||||
|
const int MINOR_VERSION = 4;
|
||||||
|
|
||||||
|
QString current_theme = "default";
|
||||||
|
|
||||||
|
QVector<server_type> server_list;
|
||||||
|
QVector<server_type> favorite_list;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ms_connect_finished(bool connected, bool will_retry);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void server_disconnected();
|
||||||
|
void loading_cancelled();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // AOAPPLICATION_H
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
#include "bass.h"
|
#include "bass.h"
|
||||||
|
#include "bassopus.h"
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
#include <QSoundEffect>
|
#include <QSoundEffect>
|
||||||
#endif
|
#endif
|
||||||
@ -10,6 +11,7 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -19,14 +21,17 @@ public:
|
|||||||
|
|
||||||
void set_blips(QString p_sfx);
|
void set_blips(QString p_sfx);
|
||||||
void blip_tick();
|
void blip_tick();
|
||||||
void set_volume(qreal p_volume);
|
void set_volume(int p_volume);
|
||||||
|
|
||||||
int m_cycle = 0;
|
int m_cycle = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const int max_blip_ms = 60;
|
||||||
|
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
qreal m_volume;
|
qreal m_volume;
|
||||||
|
QElapsedTimer delay;
|
||||||
|
|
||||||
void set_volume_internal(qreal p_volume);
|
void set_volume_internal(qreal p_volume);
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ private:
|
|||||||
QCheckBox *ui_judge_needed;
|
QCheckBox *ui_judge_needed;
|
||||||
QCheckBox *ui_juror_needed;
|
QCheckBox *ui_juror_needed;
|
||||||
QCheckBox *ui_steno_needed;
|
QCheckBox *ui_steno_needed;
|
||||||
QCheckBox *ui_witness_needed;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ok_pressed();
|
void ok_pressed();
|
||||||
|
@ -1,77 +1,125 @@
|
|||||||
#ifndef AOCHARMOVIE_H
|
#ifndef AOCHARMOVIE_H
|
||||||
#define AOCHARMOVIE_H
|
#define AOCHARMOVIE_H
|
||||||
|
|
||||||
#include "include/aosfxplayer.h"
|
|
||||||
#include "include/courtroom.h"
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMovie>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
|
|
||||||
class AOCharMovie : public QLabel {
|
class AOCharMovie : public QLabel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void play(QString p_char, QString p_emote, QString emote_prefix);
|
// Play a hat.gif - style preanimation
|
||||||
void play_pre(QString p_char, QString p_emote, int duration);
|
void play_pre(QString p_char, QString p_emote, int duration);
|
||||||
|
|
||||||
|
// Play a (b)normal.gif - style animation (talking)
|
||||||
void play_talking(QString p_char, QString p_emote);
|
void play_talking(QString p_char, QString p_emote);
|
||||||
|
|
||||||
|
// Play an (a)normal.gif - style animation (not talking)
|
||||||
void play_idle(QString p_char, QString p_emote);
|
void play_idle(QString p_char, QString p_emote);
|
||||||
|
|
||||||
void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
|
// Stop the movie, clearing the image
|
||||||
void LoadImageWithStupidMethodForFlipSupport(QImage image);
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void play_frame_sfx();
|
// Set the m_flipped variable to true/false
|
||||||
|
void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
|
||||||
|
|
||||||
void sfx_two_network_boogaloo();
|
// Set the movie's playback speed (between 10% and 1000%)
|
||||||
void screenshake_two_network_boogaloo();
|
void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); }
|
||||||
void realization_two_network_boogaloo();
|
|
||||||
|
|
||||||
AOSfxPlayer *frame_specific_sfx_player;
|
|
||||||
Courtroom *mycourtroom;
|
|
||||||
QString frame_sfx_hellstring = "";
|
|
||||||
QString frame_screenshake_hellstring = "";
|
|
||||||
QString frame_realization_hellstring = "";
|
|
||||||
bool use_networked_framehell = false;
|
|
||||||
|
|
||||||
|
// Move the label itself around
|
||||||
void move(int ax, int ay);
|
void move(int ax, int ay);
|
||||||
|
|
||||||
|
// This is somewhat pointless now as there's no "QMovie" object to resize, aka
|
||||||
|
// no "combo" to speak of
|
||||||
void combo_resize(int w, int h);
|
void combo_resize(int w, int h);
|
||||||
|
|
||||||
|
// Return the frame delay adjusted for speed
|
||||||
|
int get_frame_delay(int delay);
|
||||||
|
|
||||||
|
QStringList network_strings;
|
||||||
|
|
||||||
|
QString m_char;
|
||||||
|
QString m_emote;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
QMovie *m_movie;
|
QVector<QPixmap> movie_frames;
|
||||||
QVector<QImage> movie_frames;
|
QVector<int> movie_delays;
|
||||||
|
|
||||||
|
// Effects such as sfx, screenshakes and realization flashes are stored in
|
||||||
|
// here. QString entry format: "sfx^[sfx_name]", "shake", "flash". The program
|
||||||
|
// uses the QVector index as reference.
|
||||||
|
QVector<QVector<QString>> movie_effects;
|
||||||
|
|
||||||
QTimer *preanim_timer;
|
QTimer *preanim_timer;
|
||||||
QTimer *ticker;
|
QTimer *ticker;
|
||||||
QString last_path;
|
QString last_path;
|
||||||
QString current_emote;
|
QImageReader *m_reader = new QImageReader();
|
||||||
QString current_char;
|
|
||||||
int default_w;
|
|
||||||
int default_h;
|
|
||||||
|
|
||||||
const int time_mod = 62;
|
QElapsedTimer actual_time;
|
||||||
|
|
||||||
|
// Usually used to turn seconds into milliseconds such as for [Time] tag in
|
||||||
|
// char.ini
|
||||||
|
const int time_mod = 60;
|
||||||
|
|
||||||
// These are the X and Y values before they are fixed based on the sprite's
|
// These are the X and Y values before they are fixed based on the sprite's
|
||||||
// width.
|
// width.
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
// These are the width and height values before they are fixed based on the
|
||||||
|
// sprite's width.
|
||||||
|
int f_w = 0;
|
||||||
|
int f_h = 0;
|
||||||
|
|
||||||
|
int frame = 0;
|
||||||
|
int max_frames = 0;
|
||||||
|
|
||||||
|
int speed = 100;
|
||||||
|
|
||||||
bool m_flipped = false;
|
bool m_flipped = false;
|
||||||
|
|
||||||
bool play_once = true;
|
bool play_once = true;
|
||||||
bool apng = false;
|
|
||||||
|
// Set the movie's image to provided paths, preparing for playback.
|
||||||
|
void load_image(QString p_char, QString p_emote, QString emote_prefix);
|
||||||
|
|
||||||
|
// Start playback of the movie (if animated).
|
||||||
|
void play();
|
||||||
|
|
||||||
|
// Play a frame-specific effect, if there's any defined for that specific
|
||||||
|
// frame.
|
||||||
|
void play_frame_effect(int frame);
|
||||||
|
|
||||||
|
// Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a
|
||||||
|
// provided QImage
|
||||||
|
QPixmap get_pixmap(QImage image);
|
||||||
|
|
||||||
|
// Set the movie's frame to provided pixmap
|
||||||
|
void set_frame(QPixmap f_pixmap);
|
||||||
|
|
||||||
|
// Initialize the frame-specific effects from the char.ini
|
||||||
|
void load_effects();
|
||||||
|
|
||||||
|
// Initialize the frame-specific effects from the provided network_strings,
|
||||||
|
// this is only initialized if network_strings has size more than 0.
|
||||||
|
void load_network_effects();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done();
|
void done();
|
||||||
|
void shake();
|
||||||
|
void flash();
|
||||||
|
void play_sfx(QString sfx);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void timer_done();
|
void preanim_done();
|
||||||
void movie_ticker();
|
void movie_ticker();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOCHARMOVIE_H
|
#endif // AOCHARMOVIE_H
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define AOEMOTEBUTTON_H
|
#define AOEMOTEBUTTON_H
|
||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
#include <QPainter>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
@ -10,11 +10,11 @@ class AOEmoteButton : public QPushButton {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
|
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y,
|
||||||
|
int p_w, int p_h);
|
||||||
|
|
||||||
// void set_on(QString p_char, int p_emote);
|
void set_image(QString p_image, QString p_emote_comment);
|
||||||
// void set_off(QString p_char, int p_emote);
|
void set_char_image(QString p_char, int p_emote, QString suffix);
|
||||||
void set_image(QString p_char, int p_emote, QString suffix);
|
|
||||||
|
|
||||||
void set_id(int p_id) { m_id = p_id; }
|
void set_id(int p_id) { m_id = p_id; }
|
||||||
int get_id() { return m_id; }
|
int get_id() { return m_id; }
|
||||||
@ -25,6 +25,7 @@ private:
|
|||||||
|
|
||||||
int m_id = 0;
|
int m_id = 0;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void emote_clicked(int p_id);
|
void emote_clicked(int p_id);
|
||||||
|
|
||||||
|
@ -12,10 +12,9 @@ class AOEvidenceButton : public QPushButton {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x,
|
AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y,
|
||||||
int p_y);
|
int p_w, int p_h);
|
||||||
|
|
||||||
void reset();
|
|
||||||
void set_image(QString p_image);
|
void set_image(QString p_image);
|
||||||
void set_theme_image(QString p_image);
|
void set_theme_image(QString p_image);
|
||||||
void set_id(int p_id) { m_id = p_id; }
|
void set_id(int p_id) { m_id = p_id; }
|
||||||
@ -36,9 +35,9 @@ protected:
|
|||||||
void leaveEvent(QEvent *e);
|
void leaveEvent(QEvent *e);
|
||||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||||
/*
|
/*
|
||||||
void dragLeaveEvent(QMouseEvent *e);
|
void dragLeaveEvent(QMouseEvent *e);
|
||||||
void dragEnterEvent(QMouseEvent *e);
|
void dragEnterEvent(QMouseEvent *e);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void evidence_clicked(int p_id);
|
void evidence_clicked(int p_id);
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#define AOEVIDENCEDISPLAY_H
|
#define AOEVIDENCEDISPLAY_H
|
||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
#include "aomovie.h"
|
||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMovie>
|
|
||||||
|
|
||||||
class AOEvidenceDisplay : public QLabel {
|
class AOEvidenceDisplay : public QLabel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -17,15 +17,16 @@ public:
|
|||||||
void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
|
void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
|
||||||
QLabel *get_evidence_icon();
|
QLabel *get_evidence_icon();
|
||||||
void reset();
|
void reset();
|
||||||
|
void combo_resize(int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
QMovie *evidence_movie;
|
AOMovie *evidence_movie;
|
||||||
QLabel *evidence_icon;
|
QLabel *evidence_icon;
|
||||||
AOSfxPlayer *sfx_player;
|
AOSfxPlayer *sfx_player;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void frame_change(int p_frame);
|
void show_done();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOEVIDENCEDISPLAY_H
|
#endif // AOEVIDENCEDISPLAY_H
|
||||||
|
@ -16,8 +16,8 @@ public:
|
|||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
void set_image(QString p_image);
|
bool set_image(QString p_image);
|
||||||
void set_image_from_path(QString p_path);
|
bool set_chatbox(QString p_path);
|
||||||
void set_size_and_pos(QString identifier);
|
void set_size_and_pos(QString identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,14 +10,17 @@ class AOLineEdit : public QLineEdit {
|
|||||||
public:
|
public:
|
||||||
AOLineEdit(QWidget *parent);
|
AOLineEdit(QWidget *parent);
|
||||||
|
|
||||||
|
void preserve_selection(bool toggle) { p_selection = toggle; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool p_selection = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||||
|
void focusOutEvent(QFocusEvent *ev);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void double_clicked();
|
void double_clicked();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_enter_pressed();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOLINEEDIT_H
|
#endif // AOLINEEDIT_H
|
||||||
|
@ -14,8 +14,7 @@ public:
|
|||||||
AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void set_play_once(bool p_play_once);
|
void set_play_once(bool p_play_once);
|
||||||
void start_timer(int delay);
|
void play(QString p_image, QString p_char = "", QString p_custom_theme = "",
|
||||||
void play(QString p_gif, QString p_char = "", QString p_custom_theme = "",
|
|
||||||
int default_duration = 0);
|
int default_duration = 0);
|
||||||
void combo_resize(int w, int h);
|
void combo_resize(int w, int h);
|
||||||
void stop();
|
void stop();
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#ifndef AOMUSICPLAYER_H
|
#ifndef AOMUSICPLAYER_H
|
||||||
#define AOMUSICPLAYER_H
|
#define AOMUSICPLAYER_H
|
||||||
|
#include "file_functions.h"
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
#include "bass.h"
|
#include "bass.h"
|
||||||
|
#include "bassopus.h"
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
#endif
|
#endif
|
||||||
@ -10,76 +12,44 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QObject>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
class AOMusicPlayer {
|
||||||
class AOMusicPlayer : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
virtual ~AOMusicPlayer();
|
virtual ~AOMusicPlayer();
|
||||||
|
void set_volume(int p_value, int channel = -1);
|
||||||
|
void set_looping(bool toggle, int channel = 0);
|
||||||
|
|
||||||
void play(QString p_song);
|
const int m_channelmax = 4;
|
||||||
void set_volume(int p_value);
|
|
||||||
|
|
||||||
void kill_loop();
|
// These have to be public for the stupid sync thing
|
||||||
QString get_path();
|
int loop_start[4] = {0, 0, 0, 0};
|
||||||
bool enable_looping = true;
|
int loop_end[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void play(QString p_song, int channel = 0, bool loop = false,
|
||||||
|
int effect_flags = 0);
|
||||||
|
void stop(int channel = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
int m_volume = 0;
|
bool m_looping = false;
|
||||||
QString f_path;
|
int m_volume[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
HSTREAM m_stream;
|
// Channel 0 = music
|
||||||
|
// Channel 1 = ambience
|
||||||
|
// Channel 2 = extra
|
||||||
|
// Channel 3 = extra
|
||||||
|
#if defined(BASSAUDIO)
|
||||||
|
HSTREAM m_stream_list[4];
|
||||||
|
HSYNC loop_sync[4];
|
||||||
|
#elif defined(QTAUDIO)
|
||||||
|
QMediaPlayer m_stream_list[4];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#elif defined(QTAUDIO)
|
|
||||||
class AOMusicPlayer : public QObject {
|
|
||||||
public:
|
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
|
||||||
~AOMusicPlayer();
|
|
||||||
|
|
||||||
void play(QString p_song);
|
|
||||||
void set_volume(int p_value);
|
|
||||||
|
|
||||||
void kill_loop();
|
|
||||||
QString get_path();
|
|
||||||
bool enable_looping = true;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QWidget *m_parent;
|
|
||||||
AOApplication *ao_app;
|
|
||||||
|
|
||||||
QMediaPlayer m_player;
|
|
||||||
|
|
||||||
int m_volume = 0;
|
|
||||||
QString f_path;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
class AOMusicPlayer : public QObject {
|
|
||||||
public:
|
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
|
||||||
~AOMusicPlayer();
|
|
||||||
|
|
||||||
void play(QString p_song);
|
|
||||||
void set_volume(int p_value);
|
|
||||||
|
|
||||||
void kill_loop();
|
|
||||||
QString get_path();
|
|
||||||
bool enable_looping = true;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QWidget *m_parent;
|
|
||||||
AOApplication *ao_app;
|
|
||||||
|
|
||||||
int m_volume = 0;
|
|
||||||
QString f_path;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // AOMUSICPLAYER_H
|
#endif // AOMUSICPLAYER_H
|
||||||
|
@ -1,153 +1,146 @@
|
|||||||
#ifndef AOOPTIONSDIALOG_H
|
#ifndef AOOPTIONSDIALOG_H
|
||||||
#define AOOPTIONSDIALOG_H
|
#define AOOPTIONSDIALOG_H
|
||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
#include "bass.h"
|
||||||
#ifdef BASSAUDIO
|
|
||||||
#include "bass.h"
|
#include <QtCore/QVariant>
|
||||||
#elif defined QTAUDIO
|
#include <QtWidgets/QApplication>
|
||||||
#include <QAudio>
|
#include <QtWidgets/QCheckBox>
|
||||||
#include <QAudioDeviceInfo>
|
#include <QtWidgets/QComboBox>
|
||||||
#endif
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QtWidgets/QDialogButtonBox>
|
||||||
#include <QtCore/QVariant>
|
#include <QtWidgets/QFormLayout>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QFrame>
|
||||||
#include <QtWidgets/QCheckBox>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QComboBox>
|
#include <QtWidgets/QLineEdit>
|
||||||
#include <QtWidgets/QDialog>
|
#include <QtWidgets/QPlainTextEdit>
|
||||||
#include <QtWidgets/QDialogButtonBox>
|
#include <QtWidgets/QScrollArea>
|
||||||
#include <QtWidgets/QFormLayout>
|
#include <QtWidgets/QSpinBox>
|
||||||
#include <QtWidgets/QFrame>
|
#include <QtWidgets/QTabWidget>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QWidget>
|
||||||
#include <QtWidgets/QPlainTextEdit>
|
|
||||||
#include <QtWidgets/QSpinBox>
|
#include <QDirIterator>
|
||||||
#include <QtWidgets/QTabWidget>
|
#include <QTextStream>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
|
||||||
#include <QtWidgets/QWidget>
|
class AOOptionsDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
#include <QDirIterator>
|
public:
|
||||||
#include <QTextStream>
|
explicit AOOptionsDialog(QWidget *parent = nullptr,
|
||||||
|
AOApplication *p_ao_app = nullptr);
|
||||||
class AOOptionsDialog : public QDialog {
|
|
||||||
Q_OBJECT
|
private:
|
||||||
public:
|
AOApplication *ao_app;
|
||||||
explicit AOOptionsDialog(QWidget *parent = nullptr,
|
|
||||||
AOApplication *p_ao_app = nullptr);
|
QVBoxLayout *ui_vertical_layout;
|
||||||
|
QTabWidget *ui_settings_tabs;
|
||||||
private:
|
|
||||||
AOApplication *ao_app;
|
QWidget *ui_gameplay_tab;
|
||||||
|
QWidget *ui_form_layout_widget;
|
||||||
QVBoxLayout *ui_vertical_layout;
|
QFormLayout *ui_gameplay_form;
|
||||||
QTabWidget *ui_settings_tabs;
|
QLabel *ui_theme_label;
|
||||||
|
QComboBox *ui_theme_combobox;
|
||||||
QWidget *ui_gameplay_tab;
|
QFrame *ui_theme_log_divider;
|
||||||
QWidget *ui_form_layout_widget;
|
QLabel *ui_downwards_lbl;
|
||||||
QFormLayout *ui_gameplay_form;
|
QCheckBox *ui_downwards_cb;
|
||||||
QLabel *ui_theme_label;
|
QLabel *ui_length_lbl;
|
||||||
QComboBox *ui_theme_combobox;
|
QSpinBox *ui_length_spinbox;
|
||||||
QFrame *ui_theme_log_divider;
|
QFrame *ui_log_names_divider;
|
||||||
QLabel *ui_downwards_lbl;
|
QLineEdit *ui_username_textbox;
|
||||||
QCheckBox *ui_downwards_cb;
|
QLabel *ui_username_lbl;
|
||||||
QLabel *ui_length_lbl;
|
QLabel *ui_showname_lbl;
|
||||||
QSpinBox *ui_length_spinbox;
|
QCheckBox *ui_showname_cb;
|
||||||
QLabel *ui_pun_delay;
|
QFrame *ui_net_divider;
|
||||||
QCheckBox *ui_pun_delay_cb;
|
QLabel *ui_ms_lbl;
|
||||||
QLabel *ui_slower_blips_lb;
|
QLineEdit *ui_ms_textbox;
|
||||||
QCheckBox *ui_slower_blips_cb;
|
QLabel *ui_discord_lbl;
|
||||||
QLineEdit *ui_username_textbox;
|
QCheckBox *ui_discord_cb;
|
||||||
QLabel *ui_username_lbl;
|
QLabel *ui_language_label;
|
||||||
QLabel *ui_showname_lbl;
|
QComboBox *ui_language_combobox;
|
||||||
QCheckBox *ui_showname_cb;
|
|
||||||
QFrame *ui_net_divider;
|
QLabel *ui_shake_lbl;
|
||||||
QLabel *ui_ms_lbl;
|
QCheckBox *ui_shake_cb;
|
||||||
QLineEdit *ui_ms_textbox;
|
QLabel *ui_effects_lbl;
|
||||||
QLabel *ui_discord_lbl;
|
QCheckBox *ui_effects_cb;
|
||||||
QLabel *ui_epilepsy_lbl;
|
QLabel *ui_framenetwork_lbl;
|
||||||
QCheckBox *ui_epilepsy_cb;
|
QCheckBox *ui_framenetwork_cb;
|
||||||
|
|
||||||
QCheckBox *ui_discord_cb;
|
QLabel *ui_colorlog_lbl;
|
||||||
QLabel *ui_language_label;
|
QCheckBox *ui_colorlog_cb;
|
||||||
QComboBox *ui_language_combobox;
|
|
||||||
|
QLabel *ui_stickysounds_lbl;
|
||||||
QLabel *ui_keepevi_lbl;
|
QCheckBox *ui_stickysounds_cb;
|
||||||
QCheckBox *ui_keepevi_cb;
|
|
||||||
|
QLabel *ui_stickyeffects_lbl;
|
||||||
QLabel *ui_keepcobj_lbl;
|
QCheckBox *ui_stickyeffects_cb;
|
||||||
QCheckBox *ui_keepcobj_cb;
|
|
||||||
|
QLabel *ui_stickypres_lbl;
|
||||||
QWidget *ui_callwords_tab;
|
QCheckBox *ui_stickypres_cb;
|
||||||
QWidget *ui_callwords_widget;
|
|
||||||
QVBoxLayout *ui_callwords_layout;
|
QLabel *ui_customchat_lbl;
|
||||||
QPlainTextEdit *ui_callwords_textbox;
|
QCheckBox *ui_customchat_cb;
|
||||||
QLabel *ui_callwords_explain_lbl;
|
|
||||||
QCheckBox *ui_callwords_char_textbox;
|
QWidget *ui_callwords_tab;
|
||||||
|
QWidget *ui_callwords_widget;
|
||||||
QWidget *ui_audio_tab;
|
QVBoxLayout *ui_callwords_layout;
|
||||||
QWidget *ui_audio_widget;
|
QPlainTextEdit *ui_callwords_textbox;
|
||||||
QFormLayout *ui_audio_layout;
|
QLabel *ui_callwords_explain_lbl;
|
||||||
QLabel *ui_audio_device_lbl;
|
QCheckBox *ui_callwords_char_textbox;
|
||||||
QComboBox *ui_audio_device_combobox;
|
|
||||||
QFrame *ui_audio_volume_divider;
|
QWidget *ui_audio_tab;
|
||||||
QSpinBox *ui_music_volume_spinbox;
|
QWidget *ui_audio_widget;
|
||||||
QLabel *ui_music_volume_lbl;
|
QFormLayout *ui_audio_layout;
|
||||||
QSpinBox *ui_sfx_volume_spinbox;
|
QLabel *ui_audio_device_lbl;
|
||||||
QLabel *ui_loopsfx_lbl;
|
QComboBox *ui_audio_device_combobox;
|
||||||
QCheckBox *ui_loopsfx_cb;
|
QFrame *ui_audio_volume_divider;
|
||||||
QLabel *ui_objectmusic_lbl;
|
QSpinBox *ui_music_volume_spinbox;
|
||||||
QCheckBox *ui_objectmusic_cb;
|
QLabel *ui_music_volume_lbl;
|
||||||
|
QSpinBox *ui_sfx_volume_spinbox;
|
||||||
QSpinBox *ui_blips_volume_spinbox;
|
QSpinBox *ui_blips_volume_spinbox;
|
||||||
QLabel *ui_sfx_volume_lbl;
|
QLabel *ui_sfx_volume_lbl;
|
||||||
QLabel *ui_blips_volume_lbl;
|
QLabel *ui_blips_volume_lbl;
|
||||||
QFrame *ui_volume_blip_divider;
|
QFrame *ui_volume_blip_divider;
|
||||||
QSpinBox *ui_bliprate_spinbox;
|
QSpinBox *ui_bliprate_spinbox;
|
||||||
QLabel *ui_bliprate_lbl;
|
QLabel *ui_bliprate_lbl;
|
||||||
QCheckBox *ui_blank_blips_cb;
|
QCheckBox *ui_blank_blips_cb;
|
||||||
QLabel *ui_blank_blips_lbl;
|
QLabel *ui_blank_blips_lbl;
|
||||||
QDialogButtonBox *ui_settings_buttons;
|
QLabel *ui_loopsfx_lbl;
|
||||||
|
QCheckBox *ui_loopsfx_cb;
|
||||||
QWidget *ui_casing_tab;
|
QLabel *ui_objectmusic_lbl;
|
||||||
QWidget *ui_casing_widget;
|
QCheckBox *ui_objectmusic_cb;
|
||||||
QFormLayout *ui_casing_layout;
|
QDialogButtonBox *ui_settings_buttons;
|
||||||
QLabel *ui_casing_supported_lbl;
|
|
||||||
QLabel *ui_casing_enabled_lbl;
|
QWidget *ui_casing_tab;
|
||||||
QCheckBox *ui_casing_enabled_cb;
|
QWidget *ui_casing_widget;
|
||||||
QLabel *ui_casing_def_lbl;
|
QFormLayout *ui_casing_layout;
|
||||||
QCheckBox *ui_casing_def_cb;
|
QLabel *ui_casing_supported_lbl;
|
||||||
QLabel *ui_casing_pro_lbl;
|
QLabel *ui_casing_enabled_lbl;
|
||||||
QCheckBox *ui_casing_pro_cb;
|
QCheckBox *ui_casing_enabled_cb;
|
||||||
QLabel *ui_casing_jud_lbl;
|
QLabel *ui_casing_def_lbl;
|
||||||
QCheckBox *ui_casing_jud_cb;
|
QCheckBox *ui_casing_def_cb;
|
||||||
QLabel *ui_casing_jur_lbl;
|
QLabel *ui_casing_pro_lbl;
|
||||||
QCheckBox *ui_casing_jur_cb;
|
QCheckBox *ui_casing_pro_cb;
|
||||||
QLabel *ui_casing_steno_lbl;
|
QLabel *ui_casing_jud_lbl;
|
||||||
QCheckBox *ui_casing_steno_cb;
|
QCheckBox *ui_casing_jud_cb;
|
||||||
QLabel *ui_casing_cm_lbl;
|
QLabel *ui_casing_jur_lbl;
|
||||||
QCheckBox *ui_casing_cm_cb;
|
QCheckBox *ui_casing_jur_cb;
|
||||||
QLabel *ui_casing_wit_lbl;
|
QLabel *ui_casing_steno_lbl;
|
||||||
QCheckBox *ui_casing_wit_cb;
|
QCheckBox *ui_casing_steno_cb;
|
||||||
QLabel *ui_casing_cm_cases_lbl;
|
QLabel *ui_casing_cm_lbl;
|
||||||
QLineEdit *ui_casing_cm_cases_textbox;
|
QCheckBox *ui_casing_cm_cb;
|
||||||
|
QLabel *ui_casing_cm_cases_lbl;
|
||||||
QWidget *ui_other_tab;
|
QLineEdit *ui_casing_cm_cases_textbox;
|
||||||
QWidget *ui_other_widget;
|
QLabel *ui_log_lbl;
|
||||||
QFormLayout *ui_other_layout;
|
QCheckBox *ui_log_cb;
|
||||||
QLabel *ui_other_fancy_icl_enabled_lb;
|
|
||||||
QCheckBox *ui_other_fancy_icl_enabled_cb;
|
bool needs_default_audiodev();
|
||||||
QLabel *ui_other_mirror_icl_enabled_lb;
|
|
||||||
QCheckBox *ui_other_mirror_icl_enabled_cb;
|
signals:
|
||||||
|
|
||||||
QLabel *ui_other_fancy_icl_limit_lb;
|
public slots:
|
||||||
QCheckBox *ui_other_fancy_icl_limit_cb;
|
void save_pressed();
|
||||||
|
void discard_pressed();
|
||||||
bool needs_default_audiodev();
|
};
|
||||||
|
|
||||||
signals:
|
#endif // AOOPTIONSDIALOG_H
|
||||||
|
|
||||||
public slots:
|
|
||||||
void save_pressed();
|
|
||||||
void discard_pressed();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // AOOPTIONSDIALOG_H
|
|
||||||
|
@ -16,11 +16,27 @@ public:
|
|||||||
void set_image(QString p_image);
|
void set_image(QString p_image);
|
||||||
void set_legacy_desk(QString p_image);
|
void set_legacy_desk(QString p_image);
|
||||||
|
|
||||||
|
// Move the label itself around
|
||||||
|
void move(int ax, int ay);
|
||||||
|
|
||||||
|
// This is somewhat pointless now as there's no "QMovie" object to resize, aka
|
||||||
|
// no "combo" to speak of
|
||||||
|
void combo_resize(int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
QMovie *m_movie;
|
QMovie *m_movie;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
QString last_image;
|
QString last_image;
|
||||||
|
|
||||||
|
// These are the X and Y values before they are fixed based on the sprite's
|
||||||
|
// width.
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
// These are the width and height values before they are fixed based on the
|
||||||
|
// sprite's width.
|
||||||
|
int f_w = 0;
|
||||||
|
int f_h = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOSCENE_H
|
#endif // AOSCENE_H
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
#include "bass.h"
|
#include "bass.h"
|
||||||
|
#include "bassopus.h"
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
#include <QSoundEffect>
|
#include <QSoundEffect>
|
||||||
#endif
|
#endif
|
||||||
@ -10,32 +11,36 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
class AOSfxPlayer : public QObject {
|
class AOSfxPlayer {
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void play(QString p_sfx, QString p_char = "", QString shout = "");
|
void clear();
|
||||||
void stop();
|
void loop_clear();
|
||||||
|
void play(QString p_sfx, QString p_char = "", QString shout = "",
|
||||||
|
int channel = -1);
|
||||||
|
void stop(int channel = -1);
|
||||||
void set_volume(qreal p_volume);
|
void set_volume(qreal p_volume);
|
||||||
void setLooping(bool is_looping);
|
void set_looping(bool toggle, int channel = -1);
|
||||||
|
int m_channel = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
qreal m_volume = 0;
|
qreal m_volume = 0;
|
||||||
bool looping_sfx = false;
|
|
||||||
|
|
||||||
|
bool m_looping = true;
|
||||||
void set_volume_internal(qreal p_volume);
|
void set_volume_internal(qreal p_volume);
|
||||||
|
|
||||||
|
const int m_channelmax = 5;
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
HSTREAM m_stream;
|
HSTREAM m_stream_list[5];
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
QSoundEffect m_sfx;
|
QSoundEffect m_stream_list[5];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ class AOTextArea : public QTextBrowser {
|
|||||||
public:
|
public:
|
||||||
AOTextArea(QWidget *p_parent = nullptr);
|
AOTextArea(QWidget *p_parent = nullptr);
|
||||||
|
|
||||||
void append_chatmessage(QString p_name, QString p_message, QString p_colour,
|
void append_linked(QString p_message);
|
||||||
bool song);
|
void append_chatmessage(QString p_name, QString p_message, QString p_colur);
|
||||||
void append_error(QString p_message);
|
void append_error(QString p_message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
|
const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
|
||||||
|
|
||||||
void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
|
void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
|
||||||
bool is_scrolled_down);
|
bool is_scrolled_down);
|
||||||
|
2444
include/bass.h
64
include/bassopus.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
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,24 +1,26 @@
|
|||||||
#ifndef CHATLOGPIECE_H
|
#ifndef CHATLOGPIECE_H
|
||||||
#define CHATLOGPIECE_H
|
#define CHATLOGPIECE_H
|
||||||
|
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class chatlogpiece {
|
class chatlogpiece {
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(chatlogpiece)
|
||||||
public:
|
public:
|
||||||
chatlogpiece();
|
chatlogpiece();
|
||||||
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
||||||
bool p_song, int color);
|
bool p_song,int color);
|
||||||
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
||||||
bool p_song, int color, QDateTime p_datetime);
|
bool p_song, int color, QDateTime p_datetime);
|
||||||
|
|
||||||
QString get_name();
|
QString get_name();
|
||||||
QString get_showname();
|
QString get_showname();
|
||||||
QString get_message();
|
QString get_message();
|
||||||
bool get_is_song();
|
bool is_song();
|
||||||
QDateTime get_datetime();
|
QDateTime get_datetime();
|
||||||
QString get_datetime_as_string();
|
QString get_datetime_as_string();
|
||||||
int get_chat_color();
|
int get_chat_color();
|
||||||
|
|
||||||
QString get_full();
|
QString get_full();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -26,8 +28,8 @@ private:
|
|||||||
QString showname;
|
QString showname;
|
||||||
QString message;
|
QString message;
|
||||||
QDateTime datetime;
|
QDateTime datetime;
|
||||||
bool is_song;
|
|
||||||
int color;
|
int color;
|
||||||
|
bool p_is_song;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATLOGPIECE_H
|
#endif // CHATLOGPIECE_H
|
||||||
|
1549
include/courtroom.h
@ -96,9 +96,11 @@ enum CHAT_MESSAGE {
|
|||||||
SCREENSHAKE,
|
SCREENSHAKE,
|
||||||
FRAME_SCREENSHAKE,
|
FRAME_SCREENSHAKE,
|
||||||
FRAME_REALIZATION,
|
FRAME_REALIZATION,
|
||||||
FRAME_SFX
|
FRAME_SFX,
|
||||||
|
ADDITIVE,
|
||||||
|
EFFECTS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN };
|
enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 };
|
||||||
|
|
||||||
#endif // DATATYPES_H
|
#endif // DATATYPES_H
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <discord-rpc.h>
|
#include <discord-rpc.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
@ -31,13 +32,17 @@ public:
|
|||||||
void append_chatmessage(QString f_name, QString f_message);
|
void append_chatmessage(QString f_name, QString f_message);
|
||||||
void append_error(QString f_message);
|
void append_error(QString f_message);
|
||||||
void set_player_count(int players_online, int max_players);
|
void set_player_count(int players_online, int max_players);
|
||||||
|
void set_stylesheet(QWidget *widget, QString target_tag);
|
||||||
|
void set_stylesheets();
|
||||||
|
void set_fonts();
|
||||||
|
void set_font(QWidget *widget, QString p_identifier);
|
||||||
void set_loading_text(QString p_text);
|
void set_loading_text(QString p_text);
|
||||||
void show_loading_overlay() { ui_loading_background->show(); }
|
void show_loading_overlay() { ui_loading_background->show(); }
|
||||||
void hide_loading_overlay() { ui_loading_background->hide(); }
|
void hide_loading_overlay() { ui_loading_background->hide(); }
|
||||||
QString get_chatlog();
|
QString get_chatlog();
|
||||||
int get_selected_server();
|
int get_selected_server();
|
||||||
void enable_connect_button();
|
void enable_connect_button();
|
||||||
void check_update();
|
|
||||||
void set_loading_value(int p_value);
|
void set_loading_value(int p_value);
|
||||||
|
|
||||||
bool public_servers_selected = true;
|
bool public_servers_selected = true;
|
||||||
@ -59,7 +64,10 @@ private:
|
|||||||
QLabel *ui_version;
|
QLabel *ui_version;
|
||||||
AOButton *ui_about;
|
AOButton *ui_about;
|
||||||
|
|
||||||
QListWidget *ui_server_list;
|
AOButton *ui_settings;
|
||||||
|
|
||||||
|
QTreeWidget *ui_server_list;
|
||||||
|
QLineEdit *ui_server_search;
|
||||||
|
|
||||||
QLabel *ui_player_count;
|
QLabel *ui_player_count;
|
||||||
AOTextArea *ui_description;
|
AOTextArea *ui_description;
|
||||||
@ -74,11 +82,10 @@ private:
|
|||||||
QProgressBar *ui_progress_bar;
|
QProgressBar *ui_progress_bar;
|
||||||
AOButton *ui_cancel;
|
AOButton *ui_cancel;
|
||||||
|
|
||||||
QModelIndex last_model;
|
int last_index;
|
||||||
|
|
||||||
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
|
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
|
||||||
public slots:
|
|
||||||
void lobbyThreadHandler(QString loadingText);
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_public_servers_clicked();
|
void on_public_servers_clicked();
|
||||||
void on_favorites_clicked();
|
void on_favorites_clicked();
|
||||||
@ -90,8 +97,10 @@ private slots:
|
|||||||
void on_connect_pressed();
|
void on_connect_pressed();
|
||||||
void on_connect_released();
|
void on_connect_released();
|
||||||
void on_about_clicked();
|
void on_about_clicked();
|
||||||
void on_server_list_clicked(QModelIndex p_model);
|
void on_settings_clicked();
|
||||||
void on_server_list_doubleclicked(QModelIndex p_model);
|
void on_server_list_clicked(QTreeWidgetItem *p_item, int column);
|
||||||
|
void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column);
|
||||||
|
void on_server_search_edited(QString p_text);
|
||||||
void on_chatfield_return_pressed();
|
void on_chatfield_return_pressed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
47
include/scrolltext.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#ifndef SCROLLTEXT_H
|
||||||
|
#define SCROLLTEXT_H
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QStaticText>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class ScrollText : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString text READ text WRITE setText)
|
||||||
|
Q_PROPERTY(QString separator READ separator WRITE setSeparator)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ScrollText(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
QString text() const;
|
||||||
|
void setText(QString text);
|
||||||
|
|
||||||
|
QString separator() const;
|
||||||
|
void setSeparator(QString separator);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent *);
|
||||||
|
virtual void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateText();
|
||||||
|
QString _text;
|
||||||
|
QString _separator;
|
||||||
|
QStaticText staticText;
|
||||||
|
int singleTextWidth;
|
||||||
|
QSize wholeTextSize;
|
||||||
|
int leftMargin;
|
||||||
|
bool scrollEnabled;
|
||||||
|
int scrollPos;
|
||||||
|
QImage alphaChannel;
|
||||||
|
QImage buffer;
|
||||||
|
QTimer timer;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
virtual void timer_timeout();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SCROLLTEXT_H
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
BIN
resource/logo_kfo.ico
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
resource/logo_kfo.png
Normal file
After Width: | Height: | Size: 22 KiB |
@ -1,13 +1,13 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>resource/fonts/Ace-Attorney.ttf</file>
|
<file>resource/fonts/Ace-Attorney.ttf</file>
|
||||||
<file>resource/logo.png</file>
|
<file>resource/logo_ao2.png</file>
|
||||||
<file>resource/translations/ao_de.qm</file>
|
<file>resource/translations/ao_de.qm</file>
|
||||||
<file>resource/translations/ao_en.qm</file>
|
<file>resource/translations/ao_en.qm</file>
|
||||||
<file>resource/translations/ao_jp.qm</file>
|
|
||||||
<file>resource/translations/ao_es.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_pt.qm</file>
|
||||||
<file>resource/translations/ao_ru.qm</file>
|
<file>resource/translations/ao_ru.qm</file>
|
||||||
<file>resource/translations/ao_pl.qm</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -30,4 +30,4 @@ tar -xvf apng.tar.xz
|
|||||||
cp clang_64/plugins/imageformats/libqapng.dylib ../lib
|
cp clang_64/plugins/imageformats/libqapng.dylib ../lib
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
/usr/local/opt/qt/bin/qmake && make -j2
|
/usr/local/opt/qt/bin/qmake "DEFINES += DISCORD QTAUDIO" && make -j2
|
||||||
|
@ -20,5 +20,6 @@ cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks
|
|||||||
|
|
||||||
# libbass has a funny path for some reason, just use rpath
|
# libbass has a funny path for some reason, just use rpath
|
||||||
install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
||||||
|
install_name_tool -change @loader_path/libbassopus.dylib @rpath/libbassopus.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
||||||
|
|
||||||
zip -r -9 ../bin/Attorney_Online_mac_x86_64.zip ../bin/
|
zip -r -9 ../bin/Attorney_Online_macOS.zip ../bin/
|
22
scripts/release_macos.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script prepares the compiled bundle for shipping as a standalone release
|
||||||
|
# Assumes the Qt bin folder is in PATH
|
||||||
|
# Should be used on a "Release" build from QT creator
|
||||||
|
# Note that this DOES NOT add the base/ folder
|
||||||
|
|
||||||
|
# Exit on errors and unset variables
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
||||||
|
|
||||||
|
cd ${ROOT_DIR}
|
||||||
|
|
||||||
|
# This thing basically does all the work
|
||||||
|
macdeployqt ../bin/Attorney_Online.app
|
||||||
|
|
||||||
|
# Need to add the dependencies
|
||||||
|
cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks
|
||||||
|
|
||||||
|
# libbass has a funny path for some reason, just use rpath
|
||||||
|
install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
@ -1,12 +1,13 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include "aocaseannouncerdialog.h"
|
|
||||||
#include "aooptionsdialog.h"
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
#include "lobby.h"
|
#include "lobby.h"
|
||||||
#include "networkmanager.h"
|
#include "networkmanager.h"
|
||||||
|
|
||||||
|
#include "aocaseannouncerdialog.h"
|
||||||
|
#include "aooptionsdialog.h"
|
||||||
|
|
||||||
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
|
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
|
||||||
{
|
{
|
||||||
// Create the QSettings class that points to the config.ini.
|
// Create the QSettings class that points to the config.ini.
|
||||||
@ -125,7 +126,6 @@ void AOApplication::add_favorite_server(int p_server)
|
|||||||
void AOApplication::server_disconnected()
|
void AOApplication::server_disconnected()
|
||||||
{
|
{
|
||||||
if (courtroom_constructed) {
|
if (courtroom_constructed) {
|
||||||
beep();
|
|
||||||
call_notice(tr("Disconnected from server."));
|
call_notice(tr("Disconnected from server."));
|
||||||
construct_lobby();
|
construct_lobby();
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
@ -135,6 +135,7 @@ void AOApplication::server_disconnected()
|
|||||||
void AOApplication::loading_cancelled()
|
void AOApplication::loading_cancelled()
|
||||||
{
|
{
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
|
|
||||||
w_lobby->hide_loading_overlay();
|
w_lobby->hide_loading_overlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,13 +9,17 @@ AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
|
|
||||||
void AOBlipPlayer::set_blips(QString p_sfx)
|
void AOBlipPlayer::set_blips(QString p_sfx)
|
||||||
{
|
{
|
||||||
QString f_path = ao_app->get_sounds_path(p_sfx);
|
QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx));
|
||||||
|
|
||||||
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
||||||
BASS_StreamFree(m_stream_list[n_stream]);
|
BASS_StreamFree(m_stream_list[n_stream]);
|
||||||
|
|
||||||
m_stream_list[n_stream] = BASS_StreamCreateFile(
|
if (f_path.endsWith(".opus"))
|
||||||
FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
|
m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(
|
||||||
|
FALSE, f_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_volume_internal(m_volume);
|
set_volume_internal(m_volume);
|
||||||
@ -23,6 +27,10 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
|||||||
|
|
||||||
void AOBlipPlayer::blip_tick()
|
void AOBlipPlayer::blip_tick()
|
||||||
{
|
{
|
||||||
|
if (delay.isValid() && delay.elapsed() < max_blip_ms)
|
||||||
|
return;
|
||||||
|
|
||||||
|
delay.start();
|
||||||
int f_cycle = m_cycle++;
|
int f_cycle = m_cycle++;
|
||||||
|
|
||||||
if (m_cycle == 5)
|
if (m_cycle == 5)
|
||||||
@ -34,15 +42,15 @@ void AOBlipPlayer::blip_tick()
|
|||||||
BASS_ChannelPlay(f_stream, false);
|
BASS_ChannelPlay(f_stream, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume(qreal p_value)
|
void AOBlipPlayer::set_volume(int p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value / 100;
|
m_volume = static_cast<qreal>(p_value) / 100;
|
||||||
set_volume_internal(m_volume);
|
set_volume_internal(m_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
|
void AOBlipPlayer::set_volume_internal(qreal p_value)
|
||||||
{
|
{
|
||||||
float volume = p_value;
|
float volume = static_cast<float>(p_value);
|
||||||
|
|
||||||
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
||||||
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
|
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
|
||||||
@ -63,12 +71,12 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
|||||||
m_blips.setSource(QUrl::fromLocalFile(f_path));
|
m_blips.setSource(QUrl::fromLocalFile(f_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
set_volume_internal(m_volume);
|
set_volume(m_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::blip_tick()
|
void AOBlipPlayer::blip_tick()
|
||||||
{
|
{
|
||||||
m_cycle++;
|
int f_cycle = m_cycle++;
|
||||||
|
|
||||||
if (m_cycle == 5)
|
if (m_cycle == 5)
|
||||||
m_cycle = 0;
|
m_cycle = 0;
|
||||||
@ -76,14 +84,9 @@ void AOBlipPlayer::blip_tick()
|
|||||||
m_blips.play();
|
m_blips.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume(qreal p_value)
|
void AOBlipPlayer::set_volume(int p_value)
|
||||||
{
|
|
||||||
m_volume = p_value / 100;
|
|
||||||
set_volume_internal(m_volume);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
|
|
||||||
{
|
{
|
||||||
|
m_volume = p_value;
|
||||||
m_blips.setVolume(m_volume);
|
m_blips.setVolume(m_volume);
|
||||||
}
|
}
|
||||||
#else // No audio
|
#else // No audio
|
||||||
@ -97,7 +100,7 @@ void AOBlipPlayer::set_blips(QString p_sfx) {}
|
|||||||
|
|
||||||
void AOBlipPlayer::blip_tick() {}
|
void AOBlipPlayer::blip_tick() {}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume(qreal p_value) {}
|
void AOBlipPlayer::set_volume(int p_value) {}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume_internal(qreal p_value) {}
|
void AOBlipPlayer::set_volume_internal(qreal p_value) {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,11 +13,26 @@ AOButton::~AOButton() {}
|
|||||||
|
|
||||||
void AOButton::set_image(QString p_image)
|
void AOButton::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
QString image_path = ao_app->get_theme_path(p_image);
|
QString image_path =
|
||||||
QString default_image_path = ao_app->get_default_theme_path(p_image);
|
ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image));
|
||||||
|
QString default_image_path =
|
||||||
|
ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image));
|
||||||
|
|
||||||
if (file_exists(image_path))
|
if (file_exists(image_path)) {
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setText("");
|
||||||
|
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; }");
|
||||||
|
}
|
||||||
|
else if (file_exists(default_image_path)) {
|
||||||
|
this->setText("");
|
||||||
|
this->setStyleSheet("QPushButton { border-image: url(\"" +
|
||||||
|
default_image_path +
|
||||||
|
"\"); }"
|
||||||
|
"QToolTip { background-image: url(); color: #000000; "
|
||||||
|
"background-color: #ffffff; border: 0px; }");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,15 +62,12 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
|
|||||||
ui_juror_needed->setText(tr("Jurors needed"));
|
ui_juror_needed->setText(tr("Jurors needed"));
|
||||||
ui_steno_needed = new QCheckBox(this);
|
ui_steno_needed = new QCheckBox(this);
|
||||||
ui_steno_needed->setText(tr("Stenographer needed"));
|
ui_steno_needed->setText(tr("Stenographer needed"));
|
||||||
ui_witness_needed = new QCheckBox(this);
|
|
||||||
ui_witness_needed->setText(tr("Witness needed"));
|
|
||||||
|
|
||||||
ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed);
|
ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed);
|
||||||
ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed);
|
ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed);
|
||||||
ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed);
|
ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed);
|
||||||
ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed);
|
ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed);
|
||||||
ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed);
|
ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed);
|
||||||
ui_form_layout->setWidget(6, QFormLayout::FieldRole, ui_witness_needed);
|
|
||||||
|
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
}
|
}
|
||||||
@ -80,8 +77,7 @@ void AOCaseAnnouncerDialog::ok_pressed()
|
|||||||
court->announce_case(
|
court->announce_case(
|
||||||
ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
|
ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
|
||||||
ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
|
ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
|
||||||
ui_juror_needed->isChecked(), ui_steno_needed->isChecked(),
|
ui_juror_needed->isChecked(), ui_steno_needed->isChecked());
|
||||||
ui_witness_needed->isChecked());
|
|
||||||
|
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
|
|||||||
|
|
||||||
ui_taken = new AOImage(this, ao_app);
|
ui_taken = new AOImage(this, ao_app);
|
||||||
ui_taken->resize(60, 60);
|
ui_taken->resize(60, 60);
|
||||||
ui_taken->set_image("char_taken.png");
|
ui_taken->set_image("char_taken");
|
||||||
ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
|
ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
ui_taken->hide();
|
ui_taken->hide();
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
|
|||||||
ui_selector = new AOImage(parent, ao_app);
|
ui_selector = new AOImage(parent, ao_app);
|
||||||
ui_selector->resize(62, 62);
|
ui_selector->resize(62, 62);
|
||||||
ui_selector->move(x_pos - 1, y_pos - 1);
|
ui_selector->move(x_pos - 1, y_pos - 1);
|
||||||
ui_selector->set_image("char_selector.png");
|
ui_selector->set_image("char_selector");
|
||||||
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
|
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
ui_selector->hide();
|
ui_selector->hide();
|
||||||
}
|
}
|
||||||
@ -59,13 +59,21 @@ void AOCharButton::set_passworded() { ui_passworded->show(); }
|
|||||||
|
|
||||||
void AOCharButton::set_image(QString p_character)
|
void AOCharButton::set_image(QString p_character)
|
||||||
{
|
{
|
||||||
QString image_path = ao_app->get_character_path(p_character, "char_icon.png");
|
QString image_path = ao_app->get_static_image_suffix(
|
||||||
|
ao_app->get_character_path(p_character, "char_icon"));
|
||||||
|
|
||||||
this->setText("");
|
this->setText("");
|
||||||
|
|
||||||
if (file_exists(image_path))
|
if (file_exists(image_path)) {
|
||||||
this->setStyleSheet("border-image:url(\"" + 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; }");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
this->setStyleSheet("border-image:url()");
|
this->setStyleSheet("QPushButton { border-image: url(); }"
|
||||||
|
"QToolTip { background-image: url(); color: #000000; "
|
||||||
|
"background-color: #ffffff; border: 0px; }");
|
||||||
this->setText(p_character);
|
this->setText(p_character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,248 +8,276 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app)
|
|||||||
: QLabel(p_parent)
|
: QLabel(p_parent)
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
m_movie = new QMovie(this);
|
|
||||||
preanim_timer = new QTimer(this);
|
preanim_timer = new QTimer(this);
|
||||||
ticker = new QTimer(this);
|
|
||||||
preanim_timer->setSingleShot(true);
|
preanim_timer->setSingleShot(true);
|
||||||
ticker->setSingleShot(true);
|
|
||||||
|
ticker = new QTimer(this);
|
||||||
|
ticker->setTimerType(Qt::PreciseTimer);
|
||||||
|
ticker->setSingleShot(false);
|
||||||
connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker()));
|
connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker()));
|
||||||
this->setUpdatesEnabled(true);
|
|
||||||
|
// connect(m_movie, SIGNAL(frameChanged(int)), this,
|
||||||
|
// SLOT(frame_change(int)));
|
||||||
|
connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
void AOCharMovie::load_image(QString p_char, QString p_emote,
|
||||||
|
QString emote_prefix)
|
||||||
{
|
{
|
||||||
apng = false;
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
actual_time.restart();
|
||||||
|
#endif
|
||||||
|
QString emote_path;
|
||||||
|
QList<QString> pathlist;
|
||||||
|
pathlist = {
|
||||||
|
ao_app->get_image_suffix(ao_app->get_character_path(
|
||||||
|
p_char, emote_prefix + p_emote)), // Default path
|
||||||
|
ao_app->get_image_suffix(ao_app->get_character_path(
|
||||||
|
p_char, emote_prefix + "/" +
|
||||||
|
p_emote)), // Path check if it's categorized into a folder
|
||||||
|
ao_app->get_character_path(
|
||||||
|
p_char, p_emote + ".png"), // Non-animated path if emote_prefix fails
|
||||||
|
ao_app->get_image_suffix(
|
||||||
|
ao_app->get_theme_path("placeholder")), // Theme placeholder path
|
||||||
|
ao_app->get_image_suffix(ao_app->get_default_theme_path(
|
||||||
|
"placeholder")), // Default theme placeholder path
|
||||||
|
};
|
||||||
|
|
||||||
QString original_path =
|
for (QString path : pathlist) {
|
||||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
|
if (file_exists(path)) {
|
||||||
QString alt_path =
|
emote_path = path;
|
||||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
|
break;
|
||||||
QString apng_path =
|
}
|
||||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
|
|
||||||
QString alt_path_still = ao_app->get_character_path(p_char, p_emote + ".png");
|
|
||||||
|
|
||||||
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
|
|
||||||
QString placeholder_default_path =
|
|
||||||
ao_app->get_default_theme_path("placeholder.gif");
|
|
||||||
QString gif_path;
|
|
||||||
current_emote = emote_prefix + p_emote;
|
|
||||||
current_char = p_char;
|
|
||||||
if (file_exists(apng_path)) {
|
|
||||||
gif_path = apng_path;
|
|
||||||
apng = true;
|
|
||||||
}
|
}
|
||||||
else if (file_exists(original_path))
|
|
||||||
gif_path = original_path;
|
|
||||||
else if (file_exists(alt_path))
|
|
||||||
gif_path = alt_path;
|
|
||||||
else if (file_exists(alt_path_still))
|
|
||||||
gif_path = alt_path_still;
|
|
||||||
else if (file_exists(placeholder_path))
|
|
||||||
gif_path = placeholder_path;
|
|
||||||
else
|
|
||||||
gif_path = placeholder_default_path;
|
|
||||||
last_path = gif_path;
|
|
||||||
delete m_movie;
|
|
||||||
m_movie = new QMovie(this);
|
|
||||||
m_movie->stop();
|
|
||||||
this->clear();
|
this->clear();
|
||||||
m_movie->setFileName(gif_path);
|
ticker->stop();
|
||||||
m_movie->jumpToFrame(0);
|
preanim_timer->stop();
|
||||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
movie_frames.clear();
|
||||||
this->show();
|
movie_delays.clear();
|
||||||
this->play_frame_sfx();
|
movie_effects.clear();
|
||||||
// if the frame count is 0 (i.e. it's a static PNG) don't try to play the next
|
|
||||||
// frame, ya goofus
|
|
||||||
if (m_movie->frameCount() != 0) {
|
|
||||||
ticker->start(m_movie->nextFrameDelay());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharMovie::play_frame_sfx()
|
if (!file_exists(emote_path))
|
||||||
{
|
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
|
||||||
QString sfx_to_play =
|
|
||||||
ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
|
|
||||||
QString screenshake_to_play =
|
|
||||||
ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
|
|
||||||
QString realization_to_play =
|
|
||||||
ao_app->get_realization_frame(current_char, current_emote, current_frame);
|
|
||||||
if (sfx_to_play != "" && !use_networked_framehell) {
|
|
||||||
frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play));
|
|
||||||
}
|
|
||||||
else if (use_networked_framehell) {
|
|
||||||
this->sfx_two_network_boogaloo();
|
|
||||||
}
|
|
||||||
if (screenshake_to_play != "" && !use_networked_framehell) {
|
|
||||||
mycourtroom->doScreenShake();
|
|
||||||
}
|
|
||||||
else if (use_networked_framehell) {
|
|
||||||
this->screenshake_two_network_boogaloo();
|
|
||||||
}
|
|
||||||
if (realization_to_play != "" && !use_networked_framehell) {
|
|
||||||
mycourtroom->doRealization();
|
|
||||||
}
|
|
||||||
else if (use_networked_framehell) {
|
|
||||||
this->realization_two_network_boogaloo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharMovie::realization_two_network_boogaloo()
|
|
||||||
{
|
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
|
||||||
QStringList realizationList = this->frame_realization_hellstring.split("^");
|
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
|
||||||
QString screenshakeList = realizationList.at(i);
|
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
|
||||||
if (extra_garbage.at(0) != current_emote) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
|
||||||
QString levels_of_garbage = extra_garbage.at(ii);
|
|
||||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
|
||||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
|
||||||
that_shouldnt_be_possible.at(1) != "") {
|
|
||||||
mycourtroom->doRealization();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharMovie::screenshake_two_network_boogaloo()
|
|
||||||
{
|
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
|
||||||
QStringList realizationList = this->frame_screenshake_hellstring.split("^");
|
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
|
||||||
QString screenshakeList = realizationList.at(i);
|
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
|
||||||
if (extra_garbage.at(0) != current_emote) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
|
||||||
QString levels_of_garbage = extra_garbage.at(ii);
|
|
||||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
|
||||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
|
||||||
that_shouldnt_be_possible.at(1) != "") {
|
|
||||||
mycourtroom->doScreenShake();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharMovie::sfx_two_network_boogaloo()
|
|
||||||
{
|
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
|
||||||
QStringList realizationList = this->frame_sfx_hellstring.split("^");
|
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
|
||||||
QString screenshakeList = realizationList.at(i);
|
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
|
||||||
if (extra_garbage.at(0) != current_emote) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
|
||||||
QString levels_of_garbage = extra_garbage.at(ii);
|
|
||||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
|
||||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
|
||||||
that_shouldnt_be_possible.at(1) != "") {
|
|
||||||
frame_specific_sfx_player->play(
|
|
||||||
ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharMovie::movie_ticker()
|
|
||||||
{
|
|
||||||
if (m_movie->currentFrameNumber() == m_movie->frameCount() - 1) {
|
|
||||||
delete m_movie;
|
|
||||||
m_movie = new QMovie(this);
|
|
||||||
m_movie->stop();
|
|
||||||
this->clear();
|
|
||||||
m_movie->setFileName(last_path);
|
|
||||||
m_movie->jumpToFrame(0);
|
|
||||||
if (play_once) {
|
|
||||||
timer_done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_movie->jumpToNextFrame();
|
|
||||||
}
|
|
||||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
|
||||||
// imagine if QT had sane stuff like "mirror on QMovie" or "resize the image
|
|
||||||
// on QT" or "interface with the current QMovie image" or anything else
|
|
||||||
|
|
||||||
this->play_frame_sfx();
|
|
||||||
|
|
||||||
if (m_movie->frameCount() == 0) {
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_reader->setFileName(emote_path);
|
||||||
|
QPixmap f_pixmap = this->get_pixmap(m_reader->read());
|
||||||
|
int f_delay = m_reader->nextImageDelay();
|
||||||
|
|
||||||
|
frame = 0;
|
||||||
|
max_frames = m_reader->imageCount();
|
||||||
|
|
||||||
|
this->set_frame(f_pixmap);
|
||||||
|
this->show();
|
||||||
|
if (max_frames > 1) {
|
||||||
|
movie_frames.append(f_pixmap);
|
||||||
|
movie_delays.append(f_delay);
|
||||||
}
|
}
|
||||||
else if (!apng) {
|
|
||||||
ticker->start(m_movie->nextFrameDelay());
|
m_char = p_char;
|
||||||
|
m_emote = emote_prefix + p_emote;
|
||||||
|
|
||||||
|
if (network_strings.size() > 0) // our FX overwritten by networked ones
|
||||||
|
this->load_network_effects();
|
||||||
|
else // Use default ini FX
|
||||||
|
this->load_effects();
|
||||||
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
qDebug() << max_frames << "Setting image to " << emote_path
|
||||||
|
<< "Time taken to process image:" << actual_time.elapsed();
|
||||||
|
|
||||||
|
actual_time.restart();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOCharMovie::load_effects()
|
||||||
|
{
|
||||||
|
movie_effects.clear();
|
||||||
|
movie_effects.resize(max_frames);
|
||||||
|
for (int e_frame = 0; e_frame < max_frames; ++e_frame) {
|
||||||
|
QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame);
|
||||||
|
if (effect != "") {
|
||||||
|
movie_effects[e_frame].append("shake");
|
||||||
|
}
|
||||||
|
|
||||||
|
effect = ao_app->get_flash_frame(m_char, m_emote, e_frame);
|
||||||
|
if (effect != "") {
|
||||||
|
movie_effects[e_frame].append("flash");
|
||||||
|
}
|
||||||
|
|
||||||
|
effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame);
|
||||||
|
if (effect != "") {
|
||||||
|
movie_effects[e_frame].append("sfx^" + effect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
|
void AOCharMovie::load_network_effects()
|
||||||
{
|
{
|
||||||
QPixmap f_pixmap;
|
movie_effects.clear();
|
||||||
if (m_flipped)
|
movie_effects.resize(max_frames);
|
||||||
f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
|
// Order is important!!!
|
||||||
|
QStringList effects_list = {"shake", "flash", "sfx^"};
|
||||||
|
|
||||||
|
// Determines which list is smaller - effects_list or network_strings - and
|
||||||
|
// uses it as basis for the loop. This way, incomplete network_strings would
|
||||||
|
// still be parsed, and excess/unaccounted for networked information is
|
||||||
|
// omitted.
|
||||||
|
int effects_size = qMin(effects_list.size(), network_strings.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < effects_size; ++i) {
|
||||||
|
QString netstring = network_strings.at(i);
|
||||||
|
QStringList emote_splits = netstring.split("^");
|
||||||
|
foreach (QString emote, emote_splits) {
|
||||||
|
QStringList parsed = emote.split("|");
|
||||||
|
if (parsed.size() <= 0 || parsed.at(0) != m_emote)
|
||||||
|
continue;
|
||||||
|
foreach (QString frame_data, parsed) {
|
||||||
|
QStringList frame_split = frame_data.split("=");
|
||||||
|
if (frame_split.size() <=
|
||||||
|
1) // We might still be hanging at the emote itself (entry 0).
|
||||||
|
continue;
|
||||||
|
int f_frame = frame_split.at(0).toInt();
|
||||||
|
if (f_frame >= max_frames) {
|
||||||
|
qDebug() << "Warning: out of bounds" << effects_list[i] << "frame"
|
||||||
|
<< f_frame << "out of" << max_frames << "for" << m_char
|
||||||
|
<< m_emote;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QString f_data = frame_split.at(1);
|
||||||
|
if (f_data != "") {
|
||||||
|
QString effect = effects_list[i];
|
||||||
|
if (effect == "sfx^") // Currently the only frame result that feeds us
|
||||||
|
// data, let's yank it in.
|
||||||
|
effect += f_data;
|
||||||
|
qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char
|
||||||
|
<< m_emote;
|
||||||
|
movie_effects[f_frame].append(effect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOCharMovie::play()
|
||||||
|
{
|
||||||
|
play_frame_effect(frame);
|
||||||
|
if (max_frames <= 1) {
|
||||||
|
if (play_once)
|
||||||
|
ticker->start(60);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
f_pixmap = QPixmap::fromImage(image);
|
ticker->start(this->get_frame_delay(movie_delays[frame]));
|
||||||
auto aspect_ratio = Qt::KeepAspectRatio;
|
|
||||||
|
|
||||||
if (f_pixmap.size().width() > f_pixmap.size().height())
|
|
||||||
aspect_ratio = Qt::KeepAspectRatioByExpanding;
|
|
||||||
|
|
||||||
if (f_pixmap.size().width() > this->size().width() ||
|
|
||||||
f_pixmap.size().height() > this->size().height())
|
|
||||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio,
|
|
||||||
Qt::SmoothTransformation));
|
|
||||||
else
|
|
||||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio,
|
|
||||||
Qt::FastTransformation));
|
|
||||||
|
|
||||||
QLabel::move(x + (this->width() - this->pixmap()->width()) / 2, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
|
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
|
||||||
{
|
{
|
||||||
QString gif_path = ao_app->get_character_path(p_char, p_emote);
|
load_image(p_char, p_emote, "");
|
||||||
|
// As much as I'd like to screw around with [Time] durations modifying the
|
||||||
m_movie->stop();
|
// animation speed, I don't think I can reliably do that, not without looping
|
||||||
m_movie->setFileName(gif_path);
|
// through all frames in the image at least - which causes lag. So for now it
|
||||||
m_movie->jumpToFrame(0);
|
// simply ends the preanimation early instead.
|
||||||
play_once = true;
|
play_once = true;
|
||||||
play(p_char, p_emote, "");
|
if (duration >
|
||||||
|
0) // It's -1 if there's no definition in [Time] for it. In which case, it
|
||||||
|
// will let the animation run out in full. Duration 0 does the same.
|
||||||
|
preanim_timer->start(duration *
|
||||||
|
time_mod); // This timer will not fire if the animation
|
||||||
|
// finishes earlier than that
|
||||||
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::play_talking(QString p_char, QString p_emote)
|
void AOCharMovie::play_talking(QString p_char, QString p_emote)
|
||||||
{
|
{
|
||||||
play_once = false;
|
play_once = false;
|
||||||
play(p_char, p_emote, "(b)");
|
load_image(p_char, p_emote, "(b)");
|
||||||
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::play_idle(QString p_char, QString p_emote)
|
void AOCharMovie::play_idle(QString p_char, QString p_emote)
|
||||||
{
|
{
|
||||||
play_once = false;
|
play_once = false;
|
||||||
play(p_char, p_emote, "(a)");
|
load_image(p_char, p_emote, "(a)");
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOCharMovie::play_frame_effect(int frame)
|
||||||
|
{
|
||||||
|
if (frame < max_frames) {
|
||||||
|
foreach (QString effect, movie_effects[frame]) {
|
||||||
|
if (effect == "shake") {
|
||||||
|
shake();
|
||||||
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
qDebug() << "Attempting to play shake on frame" << frame;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effect == "flash") {
|
||||||
|
flash();
|
||||||
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
qDebug() << "Attempting to play flash on frame" << frame;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effect.startsWith("sfx^")) {
|
||||||
|
QString sfx = effect.section("^", 1);
|
||||||
|
play_sfx(sfx);
|
||||||
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::stop()
|
void AOCharMovie::stop()
|
||||||
{
|
{
|
||||||
// for all intents and purposes, stopping is the same as hiding. at no point
|
// for all intents and purposes, stopping is the same as hiding. at no point
|
||||||
// do we want a frozen gif to display
|
// do we want a frozen gif to display
|
||||||
m_movie->stop();
|
ticker->stop();
|
||||||
frame_specific_sfx_player->stop();
|
preanim_timer->stop();
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPixmap AOCharMovie::get_pixmap(QImage image)
|
||||||
|
{
|
||||||
|
QPixmap f_pixmap;
|
||||||
|
if (m_flipped)
|
||||||
|
f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
|
||||||
|
else
|
||||||
|
f_pixmap = QPixmap::fromImage(image);
|
||||||
|
// auto aspect_ratio = Qt::KeepAspectRatio;
|
||||||
|
auto transform_mode = Qt::FastTransformation;
|
||||||
|
if (f_pixmap.height() > f_h) // We are downscaling, use anti-aliasing.
|
||||||
|
transform_mode = Qt::SmoothTransformation;
|
||||||
|
|
||||||
|
f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode);
|
||||||
|
this->resize(f_pixmap.size());
|
||||||
|
|
||||||
|
return f_pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOCharMovie::set_frame(QPixmap f_pixmap)
|
||||||
|
{
|
||||||
|
this->setPixmap(f_pixmap);
|
||||||
|
QLabel::move(
|
||||||
|
x + (f_w - f_pixmap.width()) / 2,
|
||||||
|
y + (f_h - f_pixmap.height())); // Always center horizontally, always put
|
||||||
|
// at the bottom vertically
|
||||||
|
}
|
||||||
|
|
||||||
void AOCharMovie::combo_resize(int w, int h)
|
void AOCharMovie::combo_resize(int w, int h)
|
||||||
{
|
{
|
||||||
QSize f_size(w, h);
|
QSize f_size(w, h);
|
||||||
|
f_w = w;
|
||||||
|
f_h = h;
|
||||||
this->resize(f_size);
|
this->resize(f_size);
|
||||||
m_movie->setScaledSize(this->size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AOCharMovie::get_frame_delay(int delay)
|
||||||
|
{
|
||||||
|
return static_cast<int>(double(delay) * double(speed / 100));
|
||||||
|
}
|
||||||
|
|
||||||
void AOCharMovie::move(int ax, int ay)
|
void AOCharMovie::move(int ax, int ay)
|
||||||
{
|
{
|
||||||
x = ax;
|
x = ax;
|
||||||
@ -257,4 +285,39 @@ void AOCharMovie::move(int ax, int ay)
|
|||||||
QLabel::move(x, y);
|
QLabel::move(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::timer_done() { done(); }
|
void AOCharMovie::movie_ticker()
|
||||||
|
{
|
||||||
|
++frame;
|
||||||
|
if (frame >= max_frames) {
|
||||||
|
if (play_once) {
|
||||||
|
preanim_done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
frame = 0;
|
||||||
|
}
|
||||||
|
// qint64 difference = elapsed - movie_delays[frame];
|
||||||
|
if (frame >= movie_frames.size()) {
|
||||||
|
m_reader->jumpToImage(frame);
|
||||||
|
movie_frames.resize(frame + 1);
|
||||||
|
movie_frames[frame] = this->get_pixmap(m_reader->read());
|
||||||
|
movie_delays.resize(frame + 1);
|
||||||
|
movie_delays[frame] = m_reader->nextImageDelay();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_CHARMOVIE
|
||||||
|
qDebug() << frame << movie_delays[frame]
|
||||||
|
<< "actual time taken from last frame:" << actual_time.restart();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
this->set_frame(movie_frames[frame]);
|
||||||
|
play_frame_effect(frame);
|
||||||
|
ticker->setInterval(this->get_frame_delay(movie_delays[frame]));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOCharMovie::preanim_done()
|
||||||
|
{
|
||||||
|
ticker->stop();
|
||||||
|
preanim_timer->stop();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
@ -1,34 +1,66 @@
|
|||||||
#include "aoemotebutton.h"
|
#include "aoemotebutton.h"
|
||||||
|
|
||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
|
|
||||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
|
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
|
||||||
int p_x, int p_y)
|
int p_x, int p_y, int p_w, int p_h)
|
||||||
: QPushButton(p_parent)
|
: QPushButton(p_parent)
|
||||||
{
|
{
|
||||||
parent = p_parent;
|
parent = p_parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
this->move(p_x, p_y);
|
this->move(p_x, p_y);
|
||||||
this->resize(40, 40);
|
this->resize(p_w, p_h);
|
||||||
|
|
||||||
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
|
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
|
void AOEmoteButton::set_image(QString p_image, QString p_emote_comment)
|
||||||
{
|
{
|
||||||
QString emotion_number = QString::number(p_emote + 1);
|
QString tmp_p_image = p_image;
|
||||||
QString image_path = ao_app->get_character_path(
|
|
||||||
p_char, "emotions/button" + emotion_number + suffix);
|
|
||||||
|
|
||||||
if (file_exists(image_path)) {
|
if (file_exists(p_image)) {
|
||||||
this->setText("");
|
this->setText("");
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setStyleSheet(
|
||||||
|
"QPushButton { border-image: url(\"" + p_image +
|
||||||
|
"\") 0 0 0 0 stretch stretch; }"
|
||||||
|
"QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
|
||||||
|
}
|
||||||
|
else if (p_image.contains("_on") && file_exists(tmp_p_image.replace("_on", "_off"))) {
|
||||||
|
QImage tmpImage(tmp_p_image);
|
||||||
|
QPoint p1, p2;
|
||||||
|
p2.setY(tmpImage.height());
|
||||||
|
|
||||||
|
QLinearGradient gradient(p1, p2);
|
||||||
|
gradient.setColorAt(0, Qt::transparent);
|
||||||
|
gradient.setColorAt(1, QColor(0, 0, 0, 159));
|
||||||
|
|
||||||
|
QPainter p(&tmpImage);
|
||||||
|
p.fillRect(0, 0, tmpImage.width(), tmpImage.height(), gradient);
|
||||||
|
|
||||||
|
gradient.setColorAt(0, QColor(0, 0, 0, 159));
|
||||||
|
gradient.setColorAt(1, Qt::transparent);
|
||||||
|
p.fillRect(0, 0, tmpImage.width(), tmpImage.height(), gradient);
|
||||||
|
|
||||||
|
p.end();
|
||||||
|
tmpImage.save(p_image, "png");
|
||||||
|
set_image(p_image, p_emote_comment);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->setText(ao_app->get_emote_comment(p_char, p_emote));
|
this->setText(p_emote_comment);
|
||||||
this->setStyleSheet("border-image:url(\"\")");
|
this->setStyleSheet("QPushButton { border-image: url(); }"
|
||||||
|
"QToolTip { background-image: url(); color: #000000; "
|
||||||
|
"background-color: #ffffff; border: 0px; }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOEmoteButton::set_char_image(QString p_char, int p_emote, QString suffix)
|
||||||
|
{
|
||||||
|
QString emotion_number = QString::number(p_emote + 1);
|
||||||
|
QString image_path =
|
||||||
|
ao_app->get_static_image_suffix(ao_app->get_character_path(
|
||||||
|
p_char, "emotions/button" + emotion_number + suffix));
|
||||||
|
|
||||||
|
this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote));
|
||||||
|
}
|
||||||
|
|
||||||
void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
|
void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
|
||||||
|
@ -3,51 +3,55 @@
|
|||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
|
|
||||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
|
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
|
||||||
int p_x, int p_y)
|
int p_x, int p_y, int p_w, int p_h)
|
||||||
: QPushButton(p_parent)
|
: QPushButton(p_parent)
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
m_parent = p_parent;
|
m_parent = p_parent;
|
||||||
|
|
||||||
ui_selected = new AOImage(p_parent, ao_app);
|
ui_selected = new AOImage(this, ao_app);
|
||||||
ui_selected->resize(70, 70);
|
ui_selected->resize(p_w, p_h);
|
||||||
ui_selected->move(p_x, p_y);
|
// ui_selected->move(p_x, p_y);
|
||||||
ui_selected->set_image("evidence_selected.png");
|
ui_selected->set_image("evidence_selected");
|
||||||
ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
|
ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
ui_selected->hide();
|
ui_selected->hide();
|
||||||
|
|
||||||
ui_selector = new AOImage(p_parent, ao_app);
|
ui_selector = new AOImage(this, ao_app);
|
||||||
ui_selector->resize(71, 71);
|
ui_selector->resize(p_w, p_h);
|
||||||
ui_selector->move(p_x - 1, p_y - 1);
|
// ui_selector->move(p_x - 1, p_y - 1);
|
||||||
ui_selector->set_image("evidence_selector.png");
|
ui_selector->set_image("evidence_selector");
|
||||||
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
|
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
ui_selector->hide();
|
ui_selector->hide();
|
||||||
|
|
||||||
this->move(p_x, p_y);
|
this->move(p_x, p_y);
|
||||||
this->resize(70, 70);
|
this->resize(p_w, p_h);
|
||||||
this->setAcceptDrops(true);
|
// this->setAcceptDrops(true);
|
||||||
|
|
||||||
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
|
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceButton::reset()
|
|
||||||
{
|
|
||||||
this->hide();
|
|
||||||
ui_selected->hide();
|
|
||||||
ui_selector->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOEvidenceButton::set_image(QString p_image)
|
void AOEvidenceButton::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
QString image_path = ao_app->get_evidence_path(p_image);
|
QString image_path = ao_app->get_evidence_path(p_image);
|
||||||
|
if (file_exists(p_image)) {
|
||||||
if (file_exists(image_path)) {
|
|
||||||
this->setText("");
|
this->setText("");
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setStyleSheet(
|
||||||
|
"QPushButton { border-image: url(\"" + p_image +
|
||||||
|
"\") 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 {
|
else {
|
||||||
this->setText(p_image);
|
this->setText(p_image);
|
||||||
this->setStyleSheet("");
|
this->setStyleSheet("QPushButton { border-image: url(); }"
|
||||||
|
"QToolTip { background-image: url(); color: #000000; "
|
||||||
|
"background-color: #ffffff; border: 0px; }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +67,7 @@ void AOEvidenceButton::set_theme_image(QString p_image)
|
|||||||
else
|
else
|
||||||
final_image_path = default_image_path;
|
final_image_path = default_image_path;
|
||||||
|
|
||||||
this->setText("");
|
this->set_image(final_image_path);
|
||||||
this->setStyleSheet("border-image:url(\"" + final_image_path + "\")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceButton::set_selected(bool p_selected)
|
void AOEvidenceButton::set_selected(bool p_selected)
|
||||||
@ -87,11 +90,15 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
|
|||||||
void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
|
void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
//QWidget::dragLeaveEvent(e);
|
//QWidget::dragLeaveEvent(e);
|
||||||
|
|
||||||
|
qDebug() << "drag leave event";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
|
void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
//QWidget::dragEnterEvent(e);
|
//QWidget::dragEnterEvent(e);
|
||||||
|
|
||||||
|
qDebug() << "drag enter event";
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -8,13 +8,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
|
|||||||
: QLabel(p_parent)
|
: QLabel(p_parent)
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
evidence_movie = new QMovie(this);
|
|
||||||
evidence_icon = new QLabel(this);
|
evidence_icon = new QLabel(this);
|
||||||
sfx_player = new AOSfxPlayer(this, ao_app);
|
sfx_player = new AOSfxPlayer(this, ao_app);
|
||||||
|
|
||||||
connect(evidence_movie, SIGNAL(frameChanged(int)), this,
|
evidence_movie = new AOMovie(this, ao_app);
|
||||||
SLOT(frame_change(int)));
|
|
||||||
|
connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceDisplay::show_evidence(QString p_evidence_image,
|
void AOEvidenceDisplay::show_evidence(QString p_evidence_image,
|
||||||
@ -24,64 +23,34 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image,
|
|||||||
|
|
||||||
sfx_player->set_volume(p_volume);
|
sfx_player->set_volume(p_volume);
|
||||||
|
|
||||||
QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image);
|
|
||||||
|
|
||||||
QPixmap f_pixmap(f_evidence_path);
|
|
||||||
|
|
||||||
QString final_gif_path;
|
QString final_gif_path;
|
||||||
QString gif_name;
|
QString gif_name;
|
||||||
QString icon_identifier;
|
QString icon_identifier;
|
||||||
|
|
||||||
if (is_left_side) {
|
if (is_left_side) {
|
||||||
icon_identifier = "left_evidence_icon";
|
icon_identifier = "left_evidence_icon";
|
||||||
gif_name = "evidence_appear_left.gif";
|
gif_name = "evidence_appear_left";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
icon_identifier = "right_evidence_icon";
|
icon_identifier = "right_evidence_icon";
|
||||||
gif_name = "evidence_appear_right.gif";
|
gif_name = "evidence_appear_right";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image);
|
||||||
|
QPixmap f_pixmap(f_evidence_path);
|
||||||
|
|
||||||
pos_size_type icon_dimensions =
|
pos_size_type icon_dimensions =
|
||||||
ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
|
ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
|
||||||
|
|
||||||
|
f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height);
|
||||||
|
evidence_icon->setPixmap(f_pixmap);
|
||||||
|
evidence_icon->resize(f_pixmap.size());
|
||||||
evidence_icon->move(icon_dimensions.x, icon_dimensions.y);
|
evidence_icon->move(icon_dimensions.x, icon_dimensions.y);
|
||||||
evidence_icon->resize(icon_dimensions.width, icon_dimensions.height);
|
|
||||||
|
|
||||||
evidence_icon->setPixmap(f_pixmap.scaled(
|
evidence_movie->play(gif_name);
|
||||||
evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
|
|
||||||
|
|
||||||
QString f_default_gif_path = ao_app->get_default_theme_path(gif_name);
|
|
||||||
QString f_gif_path = ao_app->get_theme_path(gif_name);
|
|
||||||
|
|
||||||
if (file_exists(f_gif_path))
|
|
||||||
final_gif_path = f_gif_path;
|
|
||||||
else
|
|
||||||
final_gif_path = f_default_gif_path;
|
|
||||||
|
|
||||||
evidence_movie->setFileName(final_gif_path);
|
|
||||||
|
|
||||||
if (evidence_movie->frameCount() < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this->setMovie(evidence_movie);
|
|
||||||
|
|
||||||
evidence_movie->start();
|
|
||||||
sfx_player->play(ao_app->get_sfx("evidence_present"));
|
sfx_player->play(ao_app->get_sfx("evidence_present"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceDisplay::frame_change(int p_frame)
|
|
||||||
{
|
|
||||||
if (p_frame == (evidence_movie->frameCount() - 1)) {
|
|
||||||
// we need this or else the last frame wont show
|
|
||||||
delay(evidence_movie->nextFrameDelay());
|
|
||||||
|
|
||||||
evidence_movie->stop();
|
|
||||||
this->clear();
|
|
||||||
|
|
||||||
evidence_icon->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOEvidenceDisplay::reset()
|
void AOEvidenceDisplay::reset()
|
||||||
{
|
{
|
||||||
sfx_player->stop();
|
sfx_player->stop();
|
||||||
@ -90,4 +59,13 @@ void AOEvidenceDisplay::reset()
|
|||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOEvidenceDisplay::show_done() { evidence_icon->show(); }
|
||||||
|
|
||||||
QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
|
QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
|
||||||
|
|
||||||
|
void AOEvidenceDisplay::combo_resize(int w, int h)
|
||||||
|
{
|
||||||
|
QSize f_size(w, h);
|
||||||
|
this->resize(f_size);
|
||||||
|
evidence_movie->combo_resize(w, h);
|
||||||
|
}
|
||||||
|
@ -10,37 +10,42 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
|
|||||||
|
|
||||||
AOImage::~AOImage() {}
|
AOImage::~AOImage() {}
|
||||||
|
|
||||||
void AOImage::set_image(QString p_image)
|
bool AOImage::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
QString theme_image_path = ao_app->get_theme_path(p_image);
|
QString theme_image_path =
|
||||||
QString default_image_path = ao_app->get_default_theme_path(p_image);
|
ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image));
|
||||||
|
QString default_image_path =
|
||||||
|
ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image));
|
||||||
|
|
||||||
QString final_image_path;
|
QString final_image_path;
|
||||||
|
|
||||||
if (file_exists(theme_image_path))
|
if (file_exists(theme_image_path))
|
||||||
final_image_path = theme_image_path;
|
final_image_path = theme_image_path;
|
||||||
else
|
else if (file_exists(default_image_path))
|
||||||
final_image_path = default_image_path;
|
final_image_path = default_image_path;
|
||||||
|
else {
|
||||||
|
qDebug() << "Warning: Image" << p_image << "not found! Can't set!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QPixmap f_pixmap(final_image_path);
|
QPixmap f_pixmap(final_image_path);
|
||||||
|
|
||||||
this->setPixmap(
|
this->setPixmap(
|
||||||
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOImage::set_image_from_path(QString p_path)
|
bool AOImage::set_chatbox(QString p_path)
|
||||||
{
|
{
|
||||||
QString default_path = ao_app->get_default_theme_path("chatmed.png");
|
p_path = ao_app->get_static_image_suffix(p_path);
|
||||||
|
if (!file_exists(p_path)) {
|
||||||
|
qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString final_path;
|
QPixmap f_pixmap(p_path);
|
||||||
|
|
||||||
if (file_exists(p_path))
|
|
||||||
final_path = p_path;
|
|
||||||
else
|
|
||||||
final_path = default_path;
|
|
||||||
|
|
||||||
QPixmap f_pixmap(final_path);
|
|
||||||
|
|
||||||
this->setPixmap(
|
this->setPixmap(
|
||||||
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,22 @@
|
|||||||
#include "aolineedit.h"
|
#include "aolineedit.h"
|
||||||
|
|
||||||
AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent)
|
AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) {}
|
||||||
{
|
|
||||||
this->setReadOnly(true);
|
|
||||||
this->setFrame(false);
|
|
||||||
|
|
||||||
connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
QLineEdit::mouseDoubleClickEvent(e);
|
QLineEdit::mouseDoubleClickEvent(e);
|
||||||
|
|
||||||
this->setReadOnly(false);
|
double_clicked();
|
||||||
|
}
|
||||||
|
void AOLineEdit::focusOutEvent(QFocusEvent *ev)
|
||||||
|
{
|
||||||
|
int start = selectionStart();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
int len = selectionLength();
|
||||||
|
#else
|
||||||
|
int len = selectedText().length();
|
||||||
|
#endif
|
||||||
|
QLineEdit::focusOutEvent(ev);
|
||||||
|
if (p_selection && start != -1 && len != -1)
|
||||||
|
this->setSelection(start, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); }
|
|
||||||
|
215
src/aomovie.cpp
@ -1,116 +1,99 @@
|
|||||||
#include "aomovie.h"
|
#include "aomovie.h"
|
||||||
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
#include "misc_functions.h"
|
#include "misc_functions.h"
|
||||||
|
|
||||||
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
m_movie = new QMovie();
|
m_movie = new QMovie();
|
||||||
|
|
||||||
this->setMovie(m_movie);
|
this->setMovie(m_movie);
|
||||||
timer = new QTimer(this);
|
|
||||||
timer->setTimerType(Qt::PreciseTimer);
|
timer = new QTimer(this);
|
||||||
timer->setSingleShot(true);
|
timer->setTimerType(Qt::PreciseTimer);
|
||||||
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
timer->setSingleShot(true);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(timer_done()));
|
|
||||||
}
|
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
||||||
|
connect(timer, SIGNAL(timeout()), this, SLOT(timer_done()));
|
||||||
void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; }
|
}
|
||||||
void AOMovie::start_timer(int delay) { timer->start(delay); }
|
|
||||||
|
void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; }
|
||||||
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme,
|
|
||||||
int duration)
|
void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme,
|
||||||
{
|
int duration)
|
||||||
|
{
|
||||||
m_movie->stop();
|
m_movie->stop();
|
||||||
// this->timer_done();
|
|
||||||
QString shout_path = p_gif;
|
QString shout_path = p_image;
|
||||||
QList<QString> pathlist;
|
if (!file_exists(p_image)) {
|
||||||
|
QList<QString> pathlist;
|
||||||
if (ao_app->get_character_path(p_char, p_gif)
|
|
||||||
.contains(
|
pathlist = {
|
||||||
"custom_objections")) // checks if the file is located within the
|
ao_app->get_image_suffix(
|
||||||
// folder of custom objections
|
ao_app->get_character_path(p_char, p_image)), // Character folder
|
||||||
pathlist << ao_app->get_character_path(
|
ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" +
|
||||||
p_char,
|
p_custom_theme + "/" + p_image), // Misc path
|
||||||
p_gif); // get_image_suffix is unecessery as it is already given.
|
ao_app->get_image_suffix(ao_app->get_custom_theme_path(
|
||||||
else if (p_gif == "custom")
|
p_custom_theme, p_image)), // Custom theme path
|
||||||
pathlist << ao_app->get_image_suffix(
|
ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), // Theme path
|
||||||
ao_app->get_character_path(p_char, p_gif));
|
ao_app->get_image_suffix(
|
||||||
else
|
ao_app->get_default_theme_path(p_image)), // Default theme path
|
||||||
pathlist << ao_app->get_image_suffix(
|
ao_app->get_image_suffix(
|
||||||
ao_app->get_character_path(p_char, p_gif + "_bubble"));
|
ao_app->get_theme_path("placeholder")), // Placeholder path
|
||||||
|
ao_app->get_image_suffix(ao_app->get_default_theme_path(
|
||||||
QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" +
|
"placeholder")), // Default placeholder path
|
||||||
p_gif + "_bubble.gif";
|
};
|
||||||
QString custom_theme_path =
|
|
||||||
ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
|
for (QString path : pathlist) {
|
||||||
QString theme_path = ao_app->get_theme_path(p_gif + ".gif");
|
if (file_exists(path)) {
|
||||||
QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif");
|
shout_path = path;
|
||||||
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
|
break;
|
||||||
QString default_placeholder_path =
|
}
|
||||||
ao_app->get_default_theme_path("placeholder.gif");
|
}
|
||||||
|
}
|
||||||
pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" +
|
|
||||||
p_custom_theme + "/" + p_gif + "_bubble")
|
m_movie->setFileName(shout_path);
|
||||||
<< // Misc path
|
|
||||||
ao_app->get_image_suffix(
|
if (m_movie->loopCount() == 0)
|
||||||
ao_app->get_custom_theme_path(p_custom_theme, p_gif))
|
play_once = true;
|
||||||
<< // Custom theme path
|
|
||||||
ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path
|
this->show();
|
||||||
ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif))
|
m_movie->start();
|
||||||
<< // Default theme path
|
if (m_movie->frameCount() == 0 && duration > 0)
|
||||||
ao_app->get_image_suffix(ao_app->get_theme_path("placeholder"))
|
timer->start(duration);
|
||||||
<< // Placeholder path
|
}
|
||||||
ao_app->get_image_suffix(ao_app->get_default_theme_path(
|
|
||||||
"placeholder")); // Default placeholder path
|
void AOMovie::stop()
|
||||||
|
{
|
||||||
for (QString path : pathlist) {
|
m_movie->stop();
|
||||||
if (file_exists(path)) {
|
this->hide();
|
||||||
shout_path = path;
|
}
|
||||||
break;
|
|
||||||
}
|
void AOMovie::frame_change(int n_frame)
|
||||||
}
|
{
|
||||||
m_movie->setFileName(shout_path);
|
// If it's a "static movie" (only one frame - png image), we can't change
|
||||||
if (m_movie->loopCount() == 0)
|
// frames - ignore this function (use timer instead). If the frame didn't reach
|
||||||
play_once = true;
|
// the last frame or the movie is continuous, don't stop the movie.
|
||||||
|
if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) ||
|
||||||
this->show();
|
!play_once)
|
||||||
m_movie->start();
|
return;
|
||||||
if (m_movie->frameCount() == 0 && duration > 0)
|
// we need this or else the last frame wont show
|
||||||
timer->start(duration);
|
timer->start(m_movie->nextFrameDelay());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMovie::stop()
|
void AOMovie::timer_done()
|
||||||
{
|
{
|
||||||
m_movie->stop();
|
this->stop();
|
||||||
this->hide();
|
// signal connected to courtroom object, let it figure out what to do
|
||||||
}
|
done();
|
||||||
|
}
|
||||||
void AOMovie::frame_change(int n_frame)
|
|
||||||
{
|
void AOMovie::combo_resize(int w, int h)
|
||||||
// If it's a "static movie" (only one frame - png image), we can't change
|
{
|
||||||
// frames - ignore this function (use timer instead). If the frame didn't
|
QSize f_size(w, h);
|
||||||
// reach the last frame or the movie is continuous, don't stop the movie.
|
this->resize(f_size);
|
||||||
if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) ||
|
m_movie->setScaledSize(f_size);
|
||||||
!play_once)
|
}
|
||||||
return;
|
|
||||||
// we need this or else the last frame wont show
|
|
||||||
timer->start(m_movie->nextFrameDelay());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMovie::timer_done()
|
|
||||||
{
|
|
||||||
this->stop();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMovie::combo_resize(int w, int h)
|
|
||||||
{
|
|
||||||
QSize f_size(w, h);
|
|
||||||
this->resize(f_size);
|
|
||||||
m_movie->setScaledSize(f_size);
|
|
||||||
}
|
|
||||||
|
@ -1,107 +1,225 @@
|
|||||||
#include "aomusicplayer.h"
|
#include "aomusicplayer.h"
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
: QObject()
|
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer() { kill_loop(); }
|
#ifdef BASSAUDIO
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song)
|
AOMusicPlayer::~AOMusicPlayer()
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
BASS_ChannelStop(m_stream_list[n_stream]);
|
||||||
f_path = ao_app->get_music_path(p_song);
|
|
||||||
|
|
||||||
if (p_song.startsWith("http")) {
|
|
||||||
m_stream = BASS_StreamCreateURL(f_path.toStdWString().c_str(), 0,
|
|
||||||
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
|
||||||
BASS_ASYNCFILE, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
|
|
||||||
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
|
||||||
BASS_ASYNCFILE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->set_volume(m_volume);
|
|
||||||
|
|
||||||
if (ao_app->get_audio_output_device() != "default")
|
|
||||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
|
||||||
if (enable_looping) {
|
|
||||||
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
|
||||||
}
|
|
||||||
BASS_ChannelPlay(m_stream, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::set_volume(int p_value)
|
void AOMusicPlayer::play(QString p_song, int channel, bool loop,
|
||||||
|
int effect_flags)
|
||||||
{
|
{
|
||||||
m_volume = p_value;
|
channel = channel % m_channelmax;
|
||||||
float volume = m_volume / 100.0f;
|
if (channel < 0) // wtf?
|
||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path() { return f_path; }
|
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop() { BASS_ChannelStop(m_stream); }
|
|
||||||
|
|
||||||
#elif defined(QTAUDIO)
|
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
|
||||||
: QObject()
|
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
ao_app = p_ao_app;
|
|
||||||
}
|
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); }
|
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song)
|
|
||||||
{
|
|
||||||
m_player.stop();
|
|
||||||
|
|
||||||
QString f_path = ao_app->get_music_path(p_song);
|
QString f_path = ao_app->get_music_path(p_song);
|
||||||
|
|
||||||
m_player.setMedia(QUrl::fromLocalFile(f_path));
|
unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE |
|
||||||
|
BASS_UNICODE | BASS_ASYNCFILE;
|
||||||
|
if (loop)
|
||||||
|
flags |= BASS_SAMPLE_LOOP;
|
||||||
|
|
||||||
this->set_volume(100);
|
DWORD newstream;
|
||||||
|
if (f_path.endsWith(".opus"))
|
||||||
|
newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
|
||||||
|
else
|
||||||
|
newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags);
|
||||||
|
|
||||||
m_player.play();
|
if (ao_app->get_audio_output_device() != "default")
|
||||||
|
BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice());
|
||||||
|
|
||||||
|
QString d_path = f_path + ".txt";
|
||||||
|
|
||||||
|
loop_start[channel] = 0;
|
||||||
|
loop_end[channel] = BASS_ChannelGetLength(newstream, BASS_POS_BYTE);
|
||||||
|
if (loop && file_exists(d_path)) // Contains loop/etc. information file
|
||||||
|
{
|
||||||
|
QStringList lines = ao_app->read_file(d_path).split("\n");
|
||||||
|
foreach (QString line, lines) {
|
||||||
|
QStringList args = line.split("=");
|
||||||
|
if (args.size() < 2)
|
||||||
|
continue;
|
||||||
|
QString arg = args[0].trimmed();
|
||||||
|
|
||||||
|
float sample_rate;
|
||||||
|
BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate);
|
||||||
|
|
||||||
|
// Grab number of bytes for sample size
|
||||||
|
int sample_size = 16 / 8;
|
||||||
|
|
||||||
|
// number of channels (stereo/mono)
|
||||||
|
int num_channels = 2;
|
||||||
|
|
||||||
|
// Calculate the bytes for loop_start/loop_end to use with the sync proc
|
||||||
|
QWORD bytes = static_cast<QWORD>(args[1].trimmed().toFloat() *
|
||||||
|
sample_size * num_channels);
|
||||||
|
if (arg == "loop_start")
|
||||||
|
loop_start[channel] = bytes;
|
||||||
|
else if (arg == "loop_length")
|
||||||
|
loop_end[channel] = loop_start[channel] + bytes;
|
||||||
|
else if (arg == "loop_end")
|
||||||
|
loop_end[channel] = bytes;
|
||||||
|
}
|
||||||
|
qDebug() << "Found data file for song" << p_song << "length"
|
||||||
|
<< BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start"
|
||||||
|
<< loop_start << "loop end" << loop_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) {
|
||||||
|
DWORD oldstream = m_stream_list[channel];
|
||||||
|
|
||||||
|
if (effect_flags & SYNC_POS) {
|
||||||
|
BASS_ChannelLock(oldstream, true);
|
||||||
|
// Sync it with the new sample
|
||||||
|
BASS_ChannelSetPosition(newstream,
|
||||||
|
BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE),
|
||||||
|
BASS_POS_BYTE);
|
||||||
|
BASS_ChannelLock(oldstream, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effect_flags & FADE_OUT) {
|
||||||
|
// Fade out the other sample and stop it (due to -1)
|
||||||
|
BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL | BASS_SLIDE_LOG,
|
||||||
|
-1, 4000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BASS_ChannelStop(
|
||||||
|
oldstream); // Stop the sample since we don't need it anymore
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BASS_ChannelStop(m_stream_list[channel]);
|
||||||
|
|
||||||
|
m_stream_list[channel] = newstream;
|
||||||
|
BASS_ChannelPlay(m_stream_list[channel], false);
|
||||||
|
if (effect_flags & FADE_IN) {
|
||||||
|
// Fade in our sample
|
||||||
|
BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0);
|
||||||
|
BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL,
|
||||||
|
static_cast<float>(m_volume[channel] / 100.0f),
|
||||||
|
1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this->set_volume(m_volume[channel], channel);
|
||||||
|
|
||||||
|
this->set_looping(loop, channel); // Have to do this here due to any
|
||||||
|
// crossfading-related changes, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::set_volume(int p_value)
|
void AOMusicPlayer::stop(int channel)
|
||||||
{
|
{
|
||||||
m_volume = p_value;
|
BASS_ChannelStop(m_stream_list[channel]);
|
||||||
|
|
||||||
qreal linearVolume = QAudio::convertVolume(m_volume / qreal(100),
|
|
||||||
QAudio::LogarithmicVolumeScale,
|
|
||||||
QAudio::LinearVolumeScale);
|
|
||||||
|
|
||||||
m_player.setVolume(linearVolume * 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path() { return f_path; }
|
void AOMusicPlayer::set_volume(int p_value, int channel)
|
||||||
|
{
|
||||||
|
m_volume[channel] = p_value;
|
||||||
|
float volume = m_volume[channel] / 100.0f;
|
||||||
|
if (channel < 0) {
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL,
|
||||||
|
volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user)
|
||||||
|
{
|
||||||
|
QWORD loop_start = *(static_cast<unsigned *>(user));
|
||||||
|
BASS_ChannelLock(channel, true);
|
||||||
|
BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE);
|
||||||
|
BASS_ChannelLock(channel, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOMusicPlayer::set_looping(bool toggle, int channel)
|
||||||
|
{
|
||||||
|
qDebug() << "Setting looping for channel" << channel << "to" << toggle;
|
||||||
|
m_looping = toggle;
|
||||||
|
if (!m_looping) {
|
||||||
|
if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP)
|
||||||
|
BASS_ChannelFlags(m_stream_list[channel], 0,
|
||||||
|
BASS_SAMPLE_LOOP); // remove the LOOP flag
|
||||||
|
BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]);
|
||||||
|
loop_sync[channel] = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP,
|
||||||
|
BASS_SAMPLE_LOOP); // set the LOOP flag
|
||||||
|
if (loop_sync[channel] != 0) {
|
||||||
|
BASS_ChannelRemoveSync(m_stream_list[channel],
|
||||||
|
loop_sync[channel]); // remove the sync
|
||||||
|
loop_sync[channel] = 0;
|
||||||
|
}
|
||||||
|
if (loop_start[channel] > 0) {
|
||||||
|
if (loop_end[channel] == 0)
|
||||||
|
loop_end[channel] = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE);
|
||||||
|
if (loop_end[channel] > 0) // Don't loop zero length songs even if we're asked to
|
||||||
|
loop_sync[channel] = BASS_ChannelSetSync(
|
||||||
|
m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end[channel],
|
||||||
|
loopProc, &loop_start[channel]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(QTAUDIO)
|
||||||
|
|
||||||
|
AOMusicPlayer::~AOMusicPlayer() {
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
m_stream_list[n_stream].stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOMusicPlayer::play(QString p_song, int channel, bool loop,
|
||||||
|
int effect_flags)
|
||||||
|
{
|
||||||
|
channel = channel % m_channelmax;
|
||||||
|
if (channel < 0) // wtf?
|
||||||
|
return;
|
||||||
|
QString f_path = ao_app->get_music_path(p_song);
|
||||||
|
|
||||||
|
m_stream_list[channel].stop();
|
||||||
|
|
||||||
|
m_stream_list[channel].setMedia(QUrl::fromLocalFile(f_path));
|
||||||
|
|
||||||
|
this->set_volume(m_volume[channel], channel);
|
||||||
|
|
||||||
|
m_stream_list[channel].play();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOMusicPlayer::stop(int channel)
|
||||||
|
{
|
||||||
|
m_stream_list[channel].stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOMusicPlayer::set_volume(int p_value, int channel)
|
||||||
|
{
|
||||||
|
m_volume[channel] = p_value;
|
||||||
|
m_stream_list[channel].setVolume(m_volume[channel]);
|
||||||
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop() { m_player.stop(); }
|
|
||||||
#else
|
#else
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
|
||||||
: QObject()
|
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
ao_app = p_ao_app;
|
|
||||||
}
|
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer() {}
|
AOMusicPlayer::~AOMusicPlayer() {}
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song) {}
|
void AOMusicPlayer::play(QString p_song, int channel, bool loop,
|
||||||
|
int effect_flags) {}
|
||||||
|
|
||||||
void AOMusicPlayer::set_volume(int p_value) {}
|
void AOMusicPlayer::stop(int channel) {}
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path() { return f_path; }
|
void AOMusicPlayer::set_volume(int p_value, int channel) {}
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop() {}
|
void loopProc(int handle, int channel, int data, int *user) {}
|
||||||
|
|
||||||
|
void AOMusicPlayer::set_looping(bool toggle, int channel) {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "aooptionsdialog.h"
|
#include "aooptionsdialog.h"
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
#include "bass.h"
|
||||||
|
|
||||||
AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
@ -9,11 +10,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
// Setting up the basics.
|
// Setting up the basics.
|
||||||
// setAttribute(Qt::WA_DeleteOnClose);
|
// setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWindowTitle(tr("Settings"));
|
setWindowTitle(tr("Settings"));
|
||||||
resize(398, 360);
|
resize(398, 320);
|
||||||
|
|
||||||
ui_settings_buttons = new QDialogButtonBox(this);
|
ui_settings_buttons = new QDialogButtonBox(this);
|
||||||
|
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
sizePolicy1.setHeightForWidth(
|
sizePolicy1.setHeightForWidth(
|
||||||
@ -39,16 +40,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_vertical_layout->addWidget(ui_settings_buttons);
|
ui_vertical_layout->addWidget(ui_settings_buttons);
|
||||||
|
|
||||||
// Let's add the tabs one by one.
|
// Let's add the tabs one by one.
|
||||||
|
// First, we'll start with 'Gameplay'.
|
||||||
//
|
|
||||||
// GAMEPLAY
|
|
||||||
//
|
|
||||||
|
|
||||||
ui_gameplay_tab = new QWidget();
|
ui_gameplay_tab = new QWidget();
|
||||||
|
ui_gameplay_tab->setSizePolicy(sizePolicy1);
|
||||||
ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
|
ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
|
||||||
|
|
||||||
ui_form_layout_widget = new QWidget(ui_gameplay_tab);
|
ui_form_layout_widget = new QWidget(ui_gameplay_tab);
|
||||||
ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 240));
|
ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 361));
|
||||||
|
ui_form_layout_widget->setSizePolicy(sizePolicy1);
|
||||||
|
|
||||||
ui_gameplay_form = new QFormLayout(ui_form_layout_widget);
|
ui_gameplay_form = new QFormLayout(ui_form_layout_widget);
|
||||||
ui_gameplay_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
ui_gameplay_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
@ -56,6 +54,9 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_gameplay_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
ui_gameplay_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
Qt::AlignTop);
|
Qt::AlignTop);
|
||||||
ui_gameplay_form->setContentsMargins(0, 0, 0, 0);
|
ui_gameplay_form->setContentsMargins(0, 0, 0, 0);
|
||||||
|
ui_gameplay_form->setSpacing(2);
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
|
||||||
ui_theme_label = new QLabel(ui_form_layout_widget);
|
ui_theme_label = new QLabel(ui_form_layout_widget);
|
||||||
ui_theme_label->setText(tr("Theme:"));
|
ui_theme_label->setText(tr("Theme:"));
|
||||||
@ -64,8 +65,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
"the lobby's look as well, you'll need to reload the "
|
"the lobby's look as well, you'll need to reload the "
|
||||||
"lobby for the changes to take effect, such as by joining "
|
"lobby for the changes to take effect, such as by joining "
|
||||||
"a server and leaving it."));
|
"a server and leaving it."));
|
||||||
ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_theme_label);
|
||||||
|
|
||||||
ui_theme_combobox = new QComboBox(ui_form_layout_widget);
|
ui_theme_combobox = new QComboBox(ui_form_layout_widget);
|
||||||
|
|
||||||
// Fill the combobox with the names of the themes.
|
// Fill the combobox with the names of the themes.
|
||||||
@ -79,64 +79,108 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1);
|
ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_theme_log_divider = new QFrame(ui_form_layout_widget);
|
ui_theme_log_divider = new QFrame(ui_form_layout_widget);
|
||||||
ui_theme_log_divider->setMidLineWidth(0);
|
ui_theme_log_divider->setMidLineWidth(0);
|
||||||
ui_theme_log_divider->setFrameShape(QFrame::HLine);
|
ui_theme_log_divider->setFrameShape(QFrame::HLine);
|
||||||
ui_theme_log_divider->setFrameShadow(QFrame::Sunken);
|
ui_theme_log_divider->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_theme_log_divider);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_downwards_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_downwards_lbl->setText(tr("Log goes downwards:"));
|
||||||
|
ui_downwards_lbl->setToolTip(
|
||||||
|
tr("If ticked, new messages will appear at "
|
||||||
|
"the bottom (like the OOC chatlog). The traditional "
|
||||||
|
"(AO1) behaviour is equivalent to this being unticked."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_downwards_lbl);
|
||||||
|
|
||||||
|
ui_downwards_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_downwards_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_length_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_length_lbl->setText(tr("Log length:"));
|
||||||
|
ui_length_lbl->setToolTip(tr(
|
||||||
|
"The amount of messages the IC chatlog will keep before "
|
||||||
|
"deleting older messages. A value of 0 or below counts as 'infinite'."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_length_lbl);
|
||||||
|
|
||||||
|
ui_length_spinbox = new QSpinBox(ui_form_layout_widget);
|
||||||
|
ui_length_spinbox->setMaximum(10000);
|
||||||
|
ui_length_spinbox->setValue(p_ao_app->get_max_log_size());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_log_names_divider = new QFrame(ui_form_layout_widget);
|
||||||
|
ui_log_names_divider->setFrameShape(QFrame::HLine);
|
||||||
|
ui_log_names_divider->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_log_names_divider);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_username_lbl = new QLabel(ui_form_layout_widget);
|
ui_username_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_username_lbl->setText(tr("Default username:"));
|
ui_username_lbl->setText(tr("Default username:"));
|
||||||
ui_username_lbl->setToolTip(
|
ui_username_lbl->setToolTip(
|
||||||
tr("Your OOC name will be automatically set to this value "
|
tr("Your OOC name will be automatically set to this value "
|
||||||
"when you join a server."));
|
"when you join a server."));
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_username_lbl);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_username_lbl);
|
||||||
|
|
||||||
ui_username_textbox = new QLineEdit(ui_form_layout_widget);
|
ui_username_textbox = new QLineEdit(ui_form_layout_widget);
|
||||||
ui_username_textbox->setMaxLength(30);
|
ui_username_textbox->setMaxLength(30);
|
||||||
ui_username_textbox->setText(p_ao_app->get_default_username());
|
ui_username_textbox->setText(p_ao_app->get_default_username());
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_username_textbox);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_username_textbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_showname_lbl = new QLabel(ui_form_layout_widget);
|
ui_showname_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_showname_lbl->setText(tr("Custom shownames:"));
|
ui_showname_lbl->setText(tr("Custom shownames:"));
|
||||||
ui_showname_lbl->setToolTip(
|
ui_showname_lbl->setToolTip(
|
||||||
tr("Gives the default value for the in-game 'Custom shownames' "
|
tr("Gives the default value for the in-game 'Custom shownames' "
|
||||||
"checkbox, which in turn determines whether the client should "
|
"tickbox, which in turn determines whether the client should "
|
||||||
"display custom in-character names."));
|
"display custom in-character names."));
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_showname_lbl);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_showname_lbl);
|
||||||
|
|
||||||
ui_showname_cb = new QCheckBox(ui_form_layout_widget);
|
ui_showname_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default());
|
ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default());
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_showname_cb);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_showname_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_net_divider = new QFrame(ui_form_layout_widget);
|
ui_net_divider = new QFrame(ui_form_layout_widget);
|
||||||
ui_net_divider->setFrameShape(QFrame::HLine);
|
ui_net_divider->setFrameShape(QFrame::HLine);
|
||||||
ui_net_divider->setFrameShadow(QFrame::Sunken);
|
ui_net_divider->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_net_divider);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_net_divider);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_ms_lbl = new QLabel(ui_form_layout_widget);
|
ui_ms_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_ms_lbl->setText(tr("Backup MS:"));
|
ui_ms_lbl->setText(tr("Backup MS:"));
|
||||||
ui_ms_lbl->setToolTip(
|
ui_ms_lbl->setToolTip(
|
||||||
tr("If the built-in server lookups fail, the game will try the "
|
tr("If the built-in server lookups fail, the game will try the "
|
||||||
"address given here and use it as a backup master server address."));
|
"address given here and use it as a backup master server address."));
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_ms_lbl);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_ms_lbl);
|
||||||
|
|
||||||
QSettings *configini = ao_app->configini;
|
QSettings *configini = ao_app->configini;
|
||||||
ui_ms_textbox = new QLineEdit(ui_form_layout_widget);
|
ui_ms_textbox = new QLineEdit(ui_form_layout_widget);
|
||||||
ui_ms_textbox->setText(configini->value("master", "").value<QString>());
|
ui_ms_textbox->setText(configini->value("master", "").value<QString>());
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_ms_textbox);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_ms_textbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_discord_lbl = new QLabel(ui_form_layout_widget);
|
ui_discord_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_discord_lbl->setText(tr("Discord:"));
|
ui_discord_lbl->setText(tr("Discord:"));
|
||||||
ui_discord_lbl->setToolTip(
|
ui_discord_lbl->setToolTip(
|
||||||
@ -144,68 +188,152 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
"what character are you playing, and how long you have "
|
"what character are you playing, and how long you have "
|
||||||
"been playing for."));
|
"been playing for."));
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_discord_lbl);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_discord_lbl);
|
||||||
|
|
||||||
ui_discord_cb = new QCheckBox(ui_form_layout_widget);
|
ui_discord_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
ui_discord_cb->setChecked(ao_app->is_discord_enabled());
|
ui_discord_cb->setChecked(ao_app->is_discord_enabled());
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_discord_cb);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_discord_cb);
|
||||||
|
|
||||||
ui_epilepsy_lbl = new QLabel(ui_form_layout_widget);
|
|
||||||
ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:"));
|
|
||||||
ui_epilepsy_lbl->setToolTip(
|
|
||||||
tr("Allows screenshaking and flashing. Disable this if you have concerns "
|
|
||||||
"or issues with photosensitivity and/or seizures."));
|
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(7, QFormLayout::LabelRole, ui_epilepsy_lbl);
|
|
||||||
|
|
||||||
ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget);
|
|
||||||
ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled());
|
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_epilepsy_cb);
|
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_language_label = new QLabel(ui_form_layout_widget);
|
ui_language_label = new QLabel(ui_form_layout_widget);
|
||||||
ui_language_label->setText(tr("Language:"));
|
ui_language_label->setText(tr("Language:"));
|
||||||
ui_language_label->setToolTip(
|
ui_language_label->setToolTip(
|
||||||
tr("Sets the language if you don't want to use your system language."));
|
tr("Sets the language if you don't want to use your system language."));
|
||||||
ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_language_label);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_language_label);
|
||||||
|
|
||||||
ui_language_combobox = new QComboBox(ui_form_layout_widget);
|
ui_language_combobox = new QComboBox(ui_form_layout_widget);
|
||||||
ui_language_combobox->addItem(
|
ui_language_combobox->addItem(
|
||||||
configini->value("language", " ").value<QString>() +
|
configini->value("language", " ").value<QString>() +
|
||||||
" - Keep current setting");
|
tr(" - Keep current setting"));
|
||||||
ui_language_combobox->addItem(" - Default");
|
ui_language_combobox->addItem(" - Default");
|
||||||
ui_language_combobox->addItem("en - English");
|
ui_language_combobox->addItem("en - English");
|
||||||
ui_language_combobox->addItem("de - Deutsch");
|
ui_language_combobox->addItem("de - Deutsch");
|
||||||
ui_language_combobox->addItem("es - Español");
|
ui_language_combobox->addItem("es - Español");
|
||||||
ui_language_combobox->addItem("pt - Português");
|
ui_language_combobox->addItem("pt - Português");
|
||||||
ui_language_combobox->addItem("pl - Polski");
|
ui_language_combobox->addItem("pl - Polskie");
|
||||||
ui_language_combobox->addItem("jp - 日本語");
|
ui_language_combobox->addItem("jp - 日本語");
|
||||||
ui_language_combobox->addItem("ru - Русский");
|
ui_language_combobox->addItem("ru - Русский");
|
||||||
ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_language_combobox);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_language_combobox);
|
||||||
|
|
||||||
ui_net_divider = new QFrame(ui_form_layout_widget);
|
row += 1;
|
||||||
ui_net_divider->setFrameShape(QFrame::HLine);
|
ui_shake_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_net_divider->setFrameShadow(QFrame::Sunken);
|
ui_shake_lbl->setText(tr("Allow Screenshake:"));
|
||||||
ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_net_divider);
|
ui_shake_lbl->setToolTip(
|
||||||
|
tr("Allows screenshaking. Disable this if you have concerns or issues "
|
||||||
|
"with photosensitivity and/or seizures."));
|
||||||
|
|
||||||
ui_slower_blips_lb = new QLabel(ui_form_layout_widget);
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_shake_lbl);
|
||||||
ui_slower_blips_lb->setText(tr("Slower text speed:"));
|
|
||||||
ui_slower_blips_lb->setToolTip(tr("Set the text speed to be the same as the AA games."));
|
|
||||||
ui_slower_blips_cb = new QCheckBox(ui_form_layout_widget);
|
|
||||||
ui_slower_blips_cb->setChecked(p_ao_app->get_slower_blips());
|
|
||||||
ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_slower_blips_cb);
|
|
||||||
ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_slower_blips_lb);
|
|
||||||
|
|
||||||
ui_pun_delay = new QLabel(ui_form_layout_widget);
|
ui_shake_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
ui_pun_delay->setText(tr("Blip delay on punctuations:"));
|
ui_shake_cb->setChecked(ao_app->is_shake_enabled());
|
||||||
ui_pun_delay->setToolTip(tr("Punctuation delay modifier."
|
|
||||||
" Enable it for the blips to slow down on punctuations."));
|
|
||||||
ui_pun_delay_cb = new QCheckBox(ui_form_layout_widget);
|
|
||||||
ui_pun_delay_cb->setChecked(p_ao_app->get_pundelay());
|
|
||||||
ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_pun_delay_cb);
|
|
||||||
ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_pun_delay);
|
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_shake_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_effects_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_effects_lbl->setText(tr("Allow Effects:"));
|
||||||
|
ui_effects_lbl->setToolTip(
|
||||||
|
tr("Allows screen effects. Disable this if you have concerns or issues "
|
||||||
|
"with photosensitivity and/or seizures."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_effects_lbl);
|
||||||
|
|
||||||
|
ui_effects_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_effects_cb->setChecked(ao_app->is_effects_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_effects_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_framenetwork_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_framenetwork_lbl->setText(tr("Network Frame Effects:"));
|
||||||
|
ui_framenetwork_lbl->setToolTip(tr(
|
||||||
|
"Send screen-shaking, flashes and sounds as defined in the char.ini over "
|
||||||
|
"the network. Only works for servers that support this functionality."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_framenetwork_lbl);
|
||||||
|
|
||||||
|
ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_framenetwork_cb->setChecked(ao_app->is_frame_network_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_colorlog_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_colorlog_lbl->setText(tr("Colors in IC Log:"));
|
||||||
|
ui_colorlog_lbl->setToolTip(
|
||||||
|
tr("Use the markup colors in the server IC chatlog."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_colorlog_lbl);
|
||||||
|
|
||||||
|
ui_colorlog_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_colorlog_cb->setChecked(ao_app->is_colorlog_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_stickysounds_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_stickysounds_lbl->setText(tr("Sticky Sounds:"));
|
||||||
|
ui_stickysounds_lbl->setToolTip(
|
||||||
|
tr("Turn this on to prevent the sound dropdown from clearing the sound "
|
||||||
|
"after playing it."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickysounds_lbl);
|
||||||
|
|
||||||
|
ui_stickysounds_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_stickysounds_cb->setChecked(ao_app->is_stickysounds_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickysounds_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_stickyeffects_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_stickyeffects_lbl->setText(tr("Sticky Effects:"));
|
||||||
|
ui_stickyeffects_lbl->setToolTip(
|
||||||
|
tr("Turn this on to prevent the effects dropdown from clearing the "
|
||||||
|
"effect after playing it."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole,
|
||||||
|
ui_stickyeffects_lbl);
|
||||||
|
|
||||||
|
ui_stickyeffects_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickyeffects_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_stickypres_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_stickypres_lbl->setText(tr("Sticky Preanims:"));
|
||||||
|
ui_stickypres_lbl->setToolTip(
|
||||||
|
tr("Turn this on to prevent preanimation checkbox from clearing after "
|
||||||
|
"playing the emote."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickypres_lbl);
|
||||||
|
|
||||||
|
ui_stickypres_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_customchat_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_customchat_lbl->setText(tr("Custom Chatboxes:"));
|
||||||
|
ui_customchat_lbl->setToolTip(
|
||||||
|
tr("Turn this on to allow characters to define their own "
|
||||||
|
"custom chat box designs."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_customchat_lbl);
|
||||||
|
|
||||||
|
ui_customchat_cb = new QCheckBox(ui_form_layout_widget);
|
||||||
|
ui_customchat_cb->setChecked(ao_app->is_customchat_enabled());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb);
|
||||||
|
|
||||||
|
QScrollArea *scroll = new QScrollArea;
|
||||||
|
scroll->setWidget(ui_form_layout_widget);
|
||||||
|
ui_gameplay_tab->setLayout(new QVBoxLayout);
|
||||||
|
ui_gameplay_tab->layout()->addWidget(scroll);
|
||||||
|
ui_gameplay_tab->show();
|
||||||
|
|
||||||
// Here we start the callwords tab.
|
// Here we start the callwords tab.
|
||||||
ui_callwords_tab = new QWidget();
|
ui_callwords_tab = new QWidget();
|
||||||
@ -257,24 +385,25 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
Qt::AlignTop);
|
Qt::AlignTop);
|
||||||
ui_audio_layout->setContentsMargins(0, 0, 0, 0);
|
ui_audio_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
row = 0;
|
||||||
|
|
||||||
ui_audio_device_lbl = new QLabel(ui_audio_widget);
|
ui_audio_device_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_audio_device_lbl->setText(tr("Audio device:"));
|
ui_audio_device_lbl->setText(tr("Audio device:"));
|
||||||
ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds."));
|
ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_audio_device_lbl);
|
||||||
|
|
||||||
ui_audio_device_combobox = new QComboBox(ui_audio_widget);
|
ui_audio_device_combobox = new QComboBox(ui_audio_widget);
|
||||||
|
|
||||||
// Let's fill out the combobox with the available audio devices. Or don't if
|
// Let's fill out the combobox with the available audio devices. Or don't if
|
||||||
// there is no audio
|
// there is no audio
|
||||||
|
int a = 0;
|
||||||
if (needs_default_audiodev()) {
|
if (needs_default_audiodev()) {
|
||||||
|
|
||||||
ui_audio_device_combobox->addItem("default");
|
ui_audio_device_combobox->addItem("default"); //TODO translate this without breaking the default audio device
|
||||||
}
|
}
|
||||||
#ifdef BASSAUDIO
|
#ifdef BASSAUDIO
|
||||||
BASS_DEVICEINFO info;
|
BASS_DEVICEINFO info;
|
||||||
int a = 0;
|
|
||||||
for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
|
for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
|
||||||
ui_audio_device_combobox->addItem(info.name);
|
ui_audio_device_combobox->addItem(info.name);
|
||||||
if (p_ao_app->get_audio_output_device() == info.name)
|
if (p_ao_app->get_audio_output_device() == info.name)
|
||||||
@ -290,120 +419,131 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_audio_device_combobox->count() - 1);
|
ui_audio_device_combobox->count() - 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ui_audio_layout->setWidget(0, QFormLayout::FieldRole,
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_audio_device_combobox);
|
ui_audio_device_combobox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_audio_volume_divider = new QFrame(ui_audio_widget);
|
ui_audio_volume_divider = new QFrame(ui_audio_widget);
|
||||||
ui_audio_volume_divider->setFrameShape(QFrame::HLine);
|
ui_audio_volume_divider->setFrameShape(QFrame::HLine);
|
||||||
ui_audio_volume_divider->setFrameShadow(QFrame::Sunken);
|
ui_audio_volume_divider->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
ui_audio_layout->setWidget(1, QFormLayout::FieldRole,
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_audio_volume_divider);
|
ui_audio_volume_divider);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_music_volume_lbl = new QLabel(ui_audio_widget);
|
ui_music_volume_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_music_volume_lbl->setText(tr("Music:"));
|
ui_music_volume_lbl->setText(tr("Music:"));
|
||||||
ui_music_volume_lbl->setToolTip(tr("Sets the default volume for music."));
|
ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_music_volume_lbl);
|
||||||
|
|
||||||
ui_music_volume_spinbox = new QSpinBox(ui_audio_widget);
|
ui_music_volume_spinbox = new QSpinBox(ui_audio_widget);
|
||||||
ui_music_volume_spinbox->setValue(p_ao_app->get_default_music());
|
ui_music_volume_spinbox->setValue(p_ao_app->get_default_music());
|
||||||
ui_music_volume_spinbox->setMaximum(100);
|
ui_music_volume_spinbox->setMaximum(100);
|
||||||
ui_music_volume_spinbox->setSuffix("%");
|
ui_music_volume_spinbox->setSuffix("%");
|
||||||
|
|
||||||
ui_audio_layout->setWidget(2, QFormLayout::FieldRole,
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_music_volume_spinbox);
|
ui_music_volume_spinbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_sfx_volume_lbl = new QLabel(ui_audio_widget);
|
ui_sfx_volume_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_sfx_volume_lbl->setText(tr("SFX:"));
|
ui_sfx_volume_lbl->setText(tr("SFX:"));
|
||||||
ui_sfx_volume_lbl->setToolTip(
|
ui_sfx_volume_lbl->setToolTip(
|
||||||
tr("Sets the default volume for SFX sounds, "
|
tr("Sets the SFX's default volume. "
|
||||||
"like interjections or other character sound effects."));
|
"Interjections and actual sound effects count as 'SFX'."));
|
||||||
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_sfx_volume_lbl);
|
||||||
ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl);
|
|
||||||
|
|
||||||
ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget);
|
ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget);
|
||||||
ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx());
|
ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx());
|
||||||
ui_sfx_volume_spinbox->setMaximum(100);
|
ui_sfx_volume_spinbox->setMaximum(100);
|
||||||
ui_sfx_volume_spinbox->setSuffix("%");
|
ui_sfx_volume_spinbox->setSuffix("%");
|
||||||
|
|
||||||
ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_sfx_volume_spinbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_blips_volume_lbl = new QLabel(ui_audio_widget);
|
ui_blips_volume_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_blips_volume_lbl->setText(tr("Blips:"));
|
ui_blips_volume_lbl->setText(tr("Blips:"));
|
||||||
ui_blips_volume_lbl->setToolTip(
|
ui_blips_volume_lbl->setToolTip(
|
||||||
tr("Sets the volume of the blips, the talking sound effects."));
|
tr("Sets the volume of the blips, the talking sound effects."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blips_volume_lbl);
|
||||||
|
|
||||||
ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget);
|
ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget);
|
||||||
ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip());
|
ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip());
|
||||||
ui_blips_volume_spinbox->setMaximum(100);
|
ui_blips_volume_spinbox->setMaximum(100);
|
||||||
ui_blips_volume_spinbox->setSuffix("%");
|
ui_blips_volume_spinbox->setSuffix("%");
|
||||||
|
|
||||||
ui_audio_layout->setWidget(4, QFormLayout::FieldRole,
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_blips_volume_spinbox);
|
ui_blips_volume_spinbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_volume_blip_divider = new QFrame(ui_audio_widget);
|
ui_volume_blip_divider = new QFrame(ui_audio_widget);
|
||||||
ui_volume_blip_divider->setFrameShape(QFrame::HLine);
|
ui_volume_blip_divider->setFrameShape(QFrame::HLine);
|
||||||
ui_volume_blip_divider->setFrameShadow(QFrame::Sunken);
|
ui_volume_blip_divider->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_volume_blip_divider);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_bliprate_lbl = new QLabel(ui_audio_widget);
|
ui_bliprate_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_bliprate_lbl->setText(tr("Blip rate:"));
|
ui_bliprate_lbl->setText(tr("Blip rate:"));
|
||||||
ui_bliprate_lbl->setToolTip(
|
ui_bliprate_lbl->setToolTip(
|
||||||
tr("Sets the delay between playing the blip sounds."));
|
tr("Sets the delay between playing the blip sounds."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl);
|
||||||
|
|
||||||
ui_bliprate_spinbox = new QSpinBox(ui_audio_widget);
|
ui_bliprate_spinbox = new QSpinBox(ui_audio_widget);
|
||||||
ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate());
|
ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate());
|
||||||
ui_bliprate_spinbox->setMinimum(1);
|
ui_bliprate_spinbox->setMinimum(1);
|
||||||
|
ui_bliprate_spinbox->setToolTip(
|
||||||
|
tr("Play a blip sound \"once per every X symbols\", where "
|
||||||
|
"X is the blip rate."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_blank_blips_lbl = new QLabel(ui_audio_widget);
|
ui_blank_blips_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_blank_blips_lbl->setText(tr("Blank blips:"));
|
ui_blank_blips_lbl->setText(tr("Blank blips:"));
|
||||||
ui_blank_blips_lbl->setToolTip(
|
ui_blank_blips_lbl->setToolTip(
|
||||||
tr("If true, the game will play a blip sound even "
|
tr("If true, the game will play a blip sound even "
|
||||||
"when a space is 'being said'."));
|
"when a space is 'being said'."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blank_blips_lbl);
|
||||||
|
|
||||||
ui_blank_blips_cb = new QCheckBox(ui_audio_widget);
|
ui_blank_blips_cb = new QCheckBox(ui_audio_widget);
|
||||||
ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
|
ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
|
||||||
|
|
||||||
ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blank_blips_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_loopsfx_lbl = new QLabel(ui_audio_widget);
|
ui_loopsfx_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_loopsfx_lbl->setText(tr("Enable Looping SFX:"));
|
ui_loopsfx_lbl->setText(tr("Enable Looping SFX:"));
|
||||||
ui_loopsfx_lbl->setToolTip(tr("If true, the game will allow looping sound "
|
ui_loopsfx_lbl->setToolTip(tr("If true, the game will allow looping sound "
|
||||||
"effects to play on preanimations."));
|
"effects to play on preanimations."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(8, QFormLayout::LabelRole, ui_loopsfx_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_loopsfx_lbl);
|
||||||
|
|
||||||
ui_loopsfx_cb = new QCheckBox(ui_audio_widget);
|
ui_loopsfx_cb = new QCheckBox(ui_audio_widget);
|
||||||
ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx());
|
ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx());
|
||||||
|
|
||||||
ui_audio_layout->setWidget(8, QFormLayout::FieldRole, ui_loopsfx_cb);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_loopsfx_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_objectmusic_lbl = new QLabel(ui_audio_widget);
|
ui_objectmusic_lbl = new QLabel(ui_audio_widget);
|
||||||
ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
|
ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
|
||||||
ui_objectmusic_lbl->setToolTip(
|
ui_objectmusic_lbl->setToolTip(
|
||||||
tr("If true, the game will stop music when someone objects, like in the "
|
tr("If true, AO2 will stop the music for you when you or someone else "
|
||||||
"actual games."));
|
"does 'Objection!'."));
|
||||||
|
|
||||||
ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl);
|
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl);
|
||||||
|
|
||||||
ui_objectmusic_cb = new QCheckBox(ui_audio_widget);
|
ui_objectmusic_cb = new QCheckBox(ui_audio_widget);
|
||||||
ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic());
|
ui_objectmusic_cb->setChecked(p_ao_app->objection_stop_music());
|
||||||
|
|
||||||
ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb);
|
ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb);
|
||||||
|
|
||||||
//
|
// The casing tab!
|
||||||
// CASING
|
|
||||||
//
|
|
||||||
ui_casing_tab = new QWidget();
|
ui_casing_tab = new QWidget();
|
||||||
ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
|
ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
|
||||||
|
|
||||||
@ -416,6 +556,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
Qt::AlignTop);
|
Qt::AlignTop);
|
||||||
ui_casing_layout->setContentsMargins(0, 0, 0, 0);
|
ui_casing_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
row = 0;
|
||||||
|
|
||||||
// -- SERVER SUPPORTS CASING
|
// -- SERVER SUPPORTS CASING
|
||||||
|
|
||||||
@ -427,222 +568,151 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
tr("This server does not support case alerts."));
|
tr("This server does not support case alerts."));
|
||||||
ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory."));
|
ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(0, QFormLayout::FieldRole,
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_casing_supported_lbl);
|
ui_casing_supported_lbl);
|
||||||
|
|
||||||
// -- CASE ANNOUNCEMENTS
|
// -- CASE ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_enabled_lbl = new QLabel(ui_casing_widget);
|
ui_casing_enabled_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_enabled_lbl->setText(tr("Casing:"));
|
ui_casing_enabled_lbl->setText(tr("Casing:"));
|
||||||
ui_casing_enabled_lbl->setToolTip(
|
ui_casing_enabled_lbl->setToolTip(
|
||||||
tr("If checked, you will get alerts about case "
|
tr("If checked, you will get alerts about case "
|
||||||
"announcements."));
|
"announcements."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole,
|
||||||
|
ui_casing_enabled_lbl);
|
||||||
|
|
||||||
ui_casing_enabled_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_enabled_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled());
|
ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
|
ui_casing_enabled_cb);
|
||||||
|
|
||||||
// -- DEFENSE ANNOUNCEMENTS
|
// -- DEFENSE ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_def_lbl = new QLabel(ui_casing_widget);
|
ui_casing_def_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_def_lbl->setText(tr("Defense:"));
|
ui_casing_def_lbl->setText(tr("Defense:"));
|
||||||
ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
||||||
"announcements if a defense spot is open."));
|
"announcements if a defense spot is open."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_def_lbl);
|
||||||
|
|
||||||
ui_casing_def_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_def_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled());
|
ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_def_cb);
|
||||||
|
|
||||||
// -- PROSECUTOR ANNOUNCEMENTS
|
// -- PROSECUTOR ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_pro_lbl = new QLabel(ui_casing_widget);
|
ui_casing_pro_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_pro_lbl->setText(tr("Prosecution:"));
|
ui_casing_pro_lbl->setText(tr("Prosecution:"));
|
||||||
ui_casing_pro_lbl->setToolTip(
|
ui_casing_pro_lbl->setToolTip(
|
||||||
tr("If checked, you will get alerts about case "
|
tr("If checked, you will get alerts about case "
|
||||||
"announcements if a prosecutor spot is open."));
|
"announcements if a prosecutor spot is open."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_pro_lbl);
|
||||||
|
|
||||||
ui_casing_pro_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_pro_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled());
|
ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_pro_cb);
|
||||||
|
|
||||||
// -- JUDGE ANNOUNCEMENTS
|
// -- JUDGE ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_jud_lbl = new QLabel(ui_casing_widget);
|
ui_casing_jud_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_jud_lbl->setText(tr("Judge:"));
|
ui_casing_jud_lbl->setText(tr("Judge:"));
|
||||||
ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
||||||
"announcements if the judge spot is open."));
|
"announcements if the judge spot is open."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_jud_lbl);
|
||||||
|
|
||||||
ui_casing_jud_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_jud_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled());
|
ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jud_cb);
|
||||||
|
|
||||||
// -- JUROR ANNOUNCEMENTS
|
// -- JUROR ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_jur_lbl = new QLabel(ui_casing_widget);
|
ui_casing_jur_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_jur_lbl->setText(tr("Juror:"));
|
ui_casing_jur_lbl->setText(tr("Juror:"));
|
||||||
ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case "
|
||||||
"announcements if a juror spot is open."));
|
"announcements if a juror spot is open."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_jur_lbl);
|
||||||
|
|
||||||
ui_casing_jur_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_jur_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled());
|
ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jur_cb);
|
||||||
|
|
||||||
// -- STENO ANNOUNCEMENTS
|
// -- STENO ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_steno_lbl = new QLabel(ui_casing_widget);
|
ui_casing_steno_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_steno_lbl->setText(tr("Stenographer:"));
|
ui_casing_steno_lbl->setText(tr("Stenographer:"));
|
||||||
ui_casing_steno_lbl->setToolTip(
|
ui_casing_steno_lbl->setToolTip(
|
||||||
tr("If checked, you will get alerts about case "
|
tr("If checked, you will get alerts about case "
|
||||||
"announcements if a stenographer spot is open."));
|
"announcements if a stenographer spot is open."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_steno_lbl);
|
||||||
|
|
||||||
ui_casing_steno_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_steno_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled());
|
ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_steno_cb);
|
||||||
|
|
||||||
// -- CM ANNOUNCEMENTS
|
// -- CM ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_cm_lbl = new QLabel(ui_casing_widget);
|
ui_casing_cm_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_cm_lbl->setText(tr("CM:"));
|
ui_casing_cm_lbl->setText(tr("CM:"));
|
||||||
ui_casing_cm_lbl->setToolTip(
|
ui_casing_cm_lbl->setToolTip(
|
||||||
tr("If checked, you will appear amongst the potential "
|
tr("If checked, you will appear amongst the potential "
|
||||||
"CMs on the server."));
|
"CMs on the server."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl);
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_cm_lbl);
|
||||||
|
|
||||||
ui_casing_cm_cb = new QCheckBox(ui_casing_widget);
|
ui_casing_cm_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled());
|
ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cb);
|
||||||
|
|
||||||
ui_casing_wit_lbl = new QLabel(ui_casing_widget);
|
|
||||||
ui_casing_wit_lbl->setText(tr("Witness:"));
|
|
||||||
ui_casing_wit_lbl->setToolTip(
|
|
||||||
tr("If checked, you will appear amongst the potential "
|
|
||||||
"witnesses on the server."));
|
|
||||||
|
|
||||||
ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl);
|
|
||||||
|
|
||||||
ui_casing_wit_cb = new QCheckBox(ui_casing_widget);
|
|
||||||
ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled());
|
|
||||||
|
|
||||||
ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb);
|
|
||||||
|
|
||||||
// -- CM CASES ANNOUNCEMENTS
|
// -- CM CASES ANNOUNCEMENTS
|
||||||
|
|
||||||
|
row += 1;
|
||||||
ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget);
|
ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget);
|
||||||
ui_casing_cm_cases_lbl->setText(tr("Hosting cases:"));
|
ui_casing_cm_cases_lbl->setText(tr("Hosting cases:"));
|
||||||
ui_casing_cm_cases_lbl->setToolTip(
|
ui_casing_cm_cases_lbl->setToolTip(
|
||||||
tr("If you're a CM, enter what cases you are "
|
tr("If you're a CM, enter what cases you are "
|
||||||
"willing to host."));
|
"willing to host."));
|
||||||
|
|
||||||
ui_casing_layout->setWidget(9, QFormLayout::LabelRole,
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole,
|
||||||
ui_casing_cm_cases_lbl);
|
ui_casing_cm_cases_lbl);
|
||||||
|
|
||||||
ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget);
|
ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget);
|
||||||
ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases());
|
ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases());
|
||||||
|
|
||||||
ui_casing_layout->setWidget(9, QFormLayout::FieldRole,
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole,
|
||||||
ui_casing_cm_cases_textbox);
|
ui_casing_cm_cases_textbox);
|
||||||
|
//Check whether mass logging is enabled
|
||||||
|
row += 1;
|
||||||
|
ui_log_lbl = new QLabel(ui_casing_widget);
|
||||||
|
ui_log_lbl->setText(tr("Automatic Logging:"));
|
||||||
|
ui_log_lbl->setToolTip(
|
||||||
|
tr("If checked, all logs will be automatically written in the "
|
||||||
|
"/logs folder."));
|
||||||
|
|
||||||
// ICLOG
|
ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_log_lbl);
|
||||||
|
|
||||||
ui_other_tab = new QWidget();
|
ui_log_cb = new QCheckBox(ui_casing_widget);
|
||||||
ui_settings_tabs->addTab(ui_other_tab, tr("IC Log"));
|
ui_log_cb->setChecked(ao_app->get_auto_logging_enabled());
|
||||||
|
|
||||||
ui_other_widget = new QWidget(ui_other_tab);
|
ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_log_cb);
|
||||||
ui_other_widget->setGeometry(QRect(10, 10, 361, 211));
|
|
||||||
|
|
||||||
ui_other_layout = new QFormLayout(ui_other_widget);
|
|
||||||
ui_other_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
|
||||||
Qt::AlignVCenter);
|
|
||||||
ui_other_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
|
||||||
Qt::AlignTop);
|
|
||||||
ui_other_layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
ui_other_fancy_icl_enabled_lb = new QLabel(ui_other_widget);
|
|
||||||
ui_other_fancy_icl_enabled_lb->setText(tr("Colorful IC log:"));
|
|
||||||
ui_other_fancy_icl_enabled_lb->setToolTip(
|
|
||||||
tr("Enables colored text in the log."));
|
|
||||||
ui_other_layout->setWidget(1, QFormLayout::LabelRole,
|
|
||||||
ui_other_fancy_icl_enabled_lb);
|
|
||||||
|
|
||||||
ui_other_fancy_icl_enabled_cb = new QCheckBox(ui_other_widget);
|
|
||||||
ui_other_fancy_icl_enabled_cb->setChecked(
|
|
||||||
ao_app->get_colored_iclog_enabled());
|
|
||||||
ui_other_layout->setWidget(1, QFormLayout::FieldRole,
|
|
||||||
ui_other_fancy_icl_enabled_cb);
|
|
||||||
|
|
||||||
ui_other_fancy_icl_limit_lb = new QLabel(ui_other_widget);
|
|
||||||
ui_other_fancy_icl_limit_lb->setText(tr("Only inline coloring:"));
|
|
||||||
ui_other_fancy_icl_limit_lb->setToolTip(
|
|
||||||
tr("Only inline coloring will be shown such as <>,|| etc."));
|
|
||||||
ui_other_layout->setWidget(2, QFormLayout::LabelRole,
|
|
||||||
ui_other_fancy_icl_limit_lb);
|
|
||||||
ui_other_fancy_icl_limit_cb = new QCheckBox(ui_other_widget);
|
|
||||||
ui_other_fancy_icl_limit_cb->setChecked(
|
|
||||||
ao_app->colorlog_restricted_enabled());
|
|
||||||
ui_other_layout->setWidget(2, QFormLayout::FieldRole,
|
|
||||||
ui_other_fancy_icl_limit_cb);
|
|
||||||
|
|
||||||
ui_other_mirror_icl_enabled_lb = new QLabel(ui_other_widget);
|
|
||||||
ui_other_mirror_icl_enabled_lb->setText(tr("Mirror IC log:"));
|
|
||||||
ui_other_mirror_icl_enabled_lb->setToolTip(
|
|
||||||
tr("IC log will mirror the IC box. "
|
|
||||||
"Meaning that if somebody gets interrupted nobody will know what they "
|
|
||||||
"wanted to say. "
|
|
||||||
"Enable for a more realistic experience."));
|
|
||||||
ui_other_layout->setWidget(3, QFormLayout::LabelRole,
|
|
||||||
ui_other_mirror_icl_enabled_lb);
|
|
||||||
ui_other_mirror_icl_enabled_cb = new QCheckBox(ui_other_widget);
|
|
||||||
ui_other_mirror_icl_enabled_cb->setChecked(ao_app->get_iclmir_enabled());
|
|
||||||
ui_other_layout->setWidget(3, QFormLayout::FieldRole,
|
|
||||||
ui_other_mirror_icl_enabled_cb);
|
|
||||||
|
|
||||||
ui_downwards_lbl = new QLabel(ui_other_widget);
|
|
||||||
ui_downwards_lbl->setText(tr("Log goes downwards:"));
|
|
||||||
ui_downwards_lbl->setToolTip(
|
|
||||||
tr("If ticked, new messages will appear at "
|
|
||||||
"the bottom (like the OOC chatlog). The traditional "
|
|
||||||
"(AO1) behaviour is equivalent to this being unticked."));
|
|
||||||
|
|
||||||
ui_other_layout->setWidget(4, QFormLayout::LabelRole, ui_downwards_lbl);
|
|
||||||
|
|
||||||
ui_downwards_cb = new QCheckBox(ui_other_widget);
|
|
||||||
ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards());
|
|
||||||
|
|
||||||
ui_other_layout->setWidget(4, QFormLayout::FieldRole, ui_downwards_cb);
|
|
||||||
|
|
||||||
ui_length_lbl = new QLabel(ui_other_widget);
|
|
||||||
ui_length_lbl->setText(tr("Log length:"));
|
|
||||||
ui_length_lbl->setToolTip(tr(
|
|
||||||
"The amount of messages the IC chatlog will keep before "
|
|
||||||
"deleting older messages. A value of 0 or below counts as 'infinite'."));
|
|
||||||
|
|
||||||
ui_other_layout->setWidget(5, QFormLayout::LabelRole, ui_length_lbl);
|
|
||||||
|
|
||||||
ui_length_spinbox = new QSpinBox(ui_other_widget);
|
|
||||||
ui_length_spinbox->setMaximum(10000);
|
|
||||||
ui_length_spinbox->setValue(p_ao_app->get_max_log_size());
|
|
||||||
|
|
||||||
ui_other_layout->setWidget(5, QFormLayout::FieldRole, ui_length_spinbox);
|
|
||||||
|
|
||||||
// When we're done, we should continue the updates!
|
// When we're done, we should continue the updates!
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
@ -660,17 +730,20 @@ void AOOptionsDialog::save_pressed()
|
|||||||
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
|
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
|
||||||
configini->setValue("master", ui_ms_textbox->text());
|
configini->setValue("master", ui_ms_textbox->text());
|
||||||
configini->setValue("discord", ui_discord_cb->isChecked());
|
configini->setValue("discord", ui_discord_cb->isChecked());
|
||||||
configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked());
|
|
||||||
configini->setValue("language", ui_language_combobox->currentText().left(2));
|
configini->setValue("language", ui_language_combobox->currentText().left(2));
|
||||||
configini->setValue("punctuation_delay", ui_pun_delay_cb->isChecked());
|
configini->setValue("shake", ui_shake_cb->isChecked());
|
||||||
configini->setValue("slower_blips", ui_slower_blips_cb->isChecked());
|
configini->setValue("effects", ui_effects_cb->isChecked());
|
||||||
|
configini->setValue("framenetwork", ui_framenetwork_cb->isChecked());
|
||||||
|
configini->setValue("colorlog", ui_colorlog_cb->isChecked());
|
||||||
|
configini->setValue("stickysounds", ui_stickysounds_cb->isChecked());
|
||||||
|
configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked());
|
||||||
|
configini->setValue("stickypres", ui_stickypres_cb->isChecked());
|
||||||
|
configini->setValue("customchat", ui_customchat_cb->isChecked());
|
||||||
|
configini->setValue("automatic_logging_enabled", ui_log_cb->isChecked());
|
||||||
QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
|
QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
|
||||||
|
|
||||||
if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
|
if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
|
||||||
QIODevice::Text)) {
|
QIODevice::Text)) {
|
||||||
// Nevermind!
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QTextStream out(callwordsini);
|
QTextStream out(callwordsini);
|
||||||
out << ui_callwords_textbox->toPlainText();
|
out << ui_callwords_textbox->toPlainText();
|
||||||
callwordsini->close();
|
callwordsini->close();
|
||||||
@ -684,7 +757,7 @@ void AOOptionsDialog::save_pressed()
|
|||||||
configini->setValue("blip_rate", ui_bliprate_spinbox->value());
|
configini->setValue("blip_rate", ui_bliprate_spinbox->value());
|
||||||
configini->setValue("blank_blip", ui_blank_blips_cb->isChecked());
|
configini->setValue("blank_blip", ui_blank_blips_cb->isChecked());
|
||||||
configini->setValue("looping_sfx", ui_loopsfx_cb->isChecked());
|
configini->setValue("looping_sfx", ui_loopsfx_cb->isChecked());
|
||||||
configini->setValue("kill_music_on_object", ui_objectmusic_cb->isChecked());
|
configini->setValue("objection_stop_music", ui_objectmusic_cb->isChecked());
|
||||||
|
|
||||||
configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked());
|
configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked());
|
||||||
configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked());
|
configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked());
|
||||||
@ -694,17 +767,9 @@ void AOOptionsDialog::save_pressed()
|
|||||||
configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked());
|
configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked());
|
||||||
configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked());
|
configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked());
|
||||||
configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked());
|
configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked());
|
||||||
configini->setValue("casing_wit_enabled", ui_casing_wit_cb->isChecked());
|
|
||||||
configini->setValue("casing_can_host_cases",
|
configini->setValue("casing_can_host_cases",
|
||||||
ui_casing_cm_cases_textbox->text());
|
ui_casing_cm_cases_textbox->text());
|
||||||
|
|
||||||
configini->setValue("color_iclog_enabled",
|
|
||||||
ui_other_fancy_icl_enabled_cb->isChecked());
|
|
||||||
configini->setValue("mirror_iclog_enabled",
|
|
||||||
ui_other_mirror_icl_enabled_cb->isChecked());
|
|
||||||
configini->setValue("mirror_iclog_restricted",
|
|
||||||
ui_other_fancy_icl_limit_cb->isChecked());
|
|
||||||
|
|
||||||
callwordsini->close();
|
callwordsini->close();
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
@ -14,30 +14,55 @@ void AOScene::set_image(QString p_image)
|
|||||||
{
|
{
|
||||||
QString background_path =
|
QString background_path =
|
||||||
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
||||||
if (!file_exists(background_path))
|
if (!file_exists(background_path)) // If image is missing, clear current image
|
||||||
background_path = ao_app->get_image_suffix(
|
{
|
||||||
ao_app->get_default_background_path(p_image)); // Default path
|
this->clear();
|
||||||
|
this->setMovie(nullptr);
|
||||||
|
|
||||||
if (file_exists(background_path) && background_path == last_image)
|
m_movie->stop();
|
||||||
|
last_image = "";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int w = this->width();
|
if (!file_exists(background_path) || background_path != last_image)
|
||||||
int h = this->height();
|
{
|
||||||
|
this->clear();
|
||||||
|
this->setMovie(nullptr);
|
||||||
|
|
||||||
this->clear();
|
m_movie->stop();
|
||||||
this->setMovie(nullptr);
|
m_movie->setFileName(background_path);
|
||||||
|
}
|
||||||
|
|
||||||
m_movie->stop();
|
if (m_movie->isValid() && m_movie->frameCount() > 1) {
|
||||||
m_movie->setFileName(background_path);
|
m_movie->jumpToNextFrame();
|
||||||
m_movie->setScaledSize(QSize(w, h));
|
float scale_factor = static_cast<float>(f_h) /
|
||||||
|
static_cast<float>(m_movie->frameRect().height());
|
||||||
|
// preserve aspect ratio
|
||||||
|
int n_w = static_cast<int>(m_movie->frameRect().width() * scale_factor);
|
||||||
|
int n_h = static_cast<int>(m_movie->frameRect().height() * scale_factor);
|
||||||
|
|
||||||
if (m_movie->isValid()) {
|
m_movie->setScaledSize(QSize(n_w, n_h));
|
||||||
this->setMovie(m_movie);
|
this->resize(m_movie->scaledSize());
|
||||||
m_movie->start();
|
if (!file_exists(background_path) || background_path != last_image)
|
||||||
|
{
|
||||||
|
this->setMovie(m_movie);
|
||||||
|
m_movie->start();
|
||||||
|
}
|
||||||
|
QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); // Center
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QPixmap background(background_path);
|
QPixmap background(background_path);
|
||||||
this->setPixmap(background.scaled(w, h));
|
auto transform_mode = Qt::FastTransformation;
|
||||||
|
if (background.height() > f_h) // We are downscaling, use anti-aliasing.
|
||||||
|
transform_mode = Qt::SmoothTransformation;
|
||||||
|
|
||||||
|
background = background.scaledToHeight(f_h, transform_mode);
|
||||||
|
this->resize(background.size());
|
||||||
|
this->setPixmap(background);
|
||||||
|
QLabel::move(
|
||||||
|
x + (f_w - background.width()) / 2,
|
||||||
|
y + (f_h - background.height()) /
|
||||||
|
2); // Always center horizontally, always center vertically
|
||||||
}
|
}
|
||||||
last_image = background_path;
|
last_image = background_path;
|
||||||
}
|
}
|
||||||
@ -47,17 +72,23 @@ void AOScene::set_legacy_desk(QString p_image)
|
|||||||
|
|
||||||
QString desk_path =
|
QString desk_path =
|
||||||
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
||||||
if (!file_exists(desk_path))
|
if (!file_exists(desk_path)) // If image is missing, clear current image
|
||||||
desk_path = ao_app->get_image_suffix(
|
{
|
||||||
ao_app->get_default_background_path(p_image)); // Default path
|
this->clear();
|
||||||
|
this->setMovie(nullptr);
|
||||||
|
|
||||||
|
m_movie->stop();
|
||||||
|
last_image = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists(desk_path) && desk_path == last_image)
|
if (file_exists(desk_path) && desk_path == last_image)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPixmap f_desk(desk_path);
|
QPixmap f_desk(desk_path);
|
||||||
|
|
||||||
// vanilla desks vary in both width and height. in order to make that work
|
// vanilla desks vary in both width and height. in order to make that work
|
||||||
// with viewport rescaling, some INTENSE math is needed.
|
// with viewport rescaling, some INTENSE math is needed.
|
||||||
|
|
||||||
int vp_width = m_parent->width();
|
int vp_width = m_parent->width();
|
||||||
int vp_height = m_parent->height();
|
int vp_height = m_parent->height();
|
||||||
|
|
||||||
@ -73,7 +104,7 @@ void AOScene::set_legacy_desk(QString p_image)
|
|||||||
|
|
||||||
m_movie->setScaledSize(QSize(vp_width, final_h));
|
m_movie->setScaledSize(QSize(vp_width, final_h));
|
||||||
|
|
||||||
if (m_movie->isValid()) {
|
if (m_movie->isValid() && m_movie->frameCount() > 1) {
|
||||||
this->setMovie(m_movie);
|
this->setMovie(m_movie);
|
||||||
m_movie->start();
|
m_movie->start();
|
||||||
}
|
}
|
||||||
@ -83,3 +114,18 @@ void AOScene::set_legacy_desk(QString p_image)
|
|||||||
}
|
}
|
||||||
last_image = desk_path;
|
last_image = desk_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOScene::combo_resize(int w, int h)
|
||||||
|
{
|
||||||
|
QSize f_size(w, h);
|
||||||
|
f_w = w;
|
||||||
|
f_h = h;
|
||||||
|
this->resize(f_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOScene::move(int ax, int ay)
|
||||||
|
{
|
||||||
|
x = ax;
|
||||||
|
y = ay;
|
||||||
|
QLabel::move(x, y);
|
||||||
|
}
|
||||||
|
@ -1,25 +1,52 @@
|
|||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
|
|
||||||
#if defined(BASSAUDIO) // Using bass.dll for sfx
|
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
#if defined(BASSAUDIO) // Using bass.dll for sfx
|
||||||
|
void AOSfxPlayer::clear()
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
BASS_ChannelStop(m_stream_list[n_stream]);
|
||||||
|
}
|
||||||
|
set_volume_internal(m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOSfxPlayer::loop_clear()
|
||||||
|
{
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
if ((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0) & BASS_SAMPLE_LOOP))
|
||||||
|
BASS_ChannelStop(m_stream_list[n_stream]);
|
||||||
|
}
|
||||||
|
set_volume_internal(m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout,
|
||||||
|
int channel)
|
||||||
|
{
|
||||||
|
if (channel == -1) {
|
||||||
|
if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING)
|
||||||
|
m_channel = (m_channel + 1) % m_channelmax;
|
||||||
|
channel = m_channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
BASS_ChannelStop(m_stream_list[channel]);
|
||||||
|
|
||||||
QString misc_path = "";
|
QString misc_path = "";
|
||||||
QString char_path = "";
|
QString char_path = "";
|
||||||
QString sound_path = ao_app->get_sounds_path(p_sfx);
|
QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx));
|
||||||
|
|
||||||
if (shout != "")
|
if (shout != "")
|
||||||
misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx;
|
misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" +
|
||||||
|
shout + "/" + p_sfx);
|
||||||
if (p_char != "")
|
if (p_char != "")
|
||||||
char_path = ao_app->get_character_path(p_char, p_sfx);
|
char_path =
|
||||||
|
ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx));
|
||||||
|
|
||||||
QString f_path;
|
QString f_path;
|
||||||
|
|
||||||
@ -29,31 +56,31 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
|||||||
f_path = misc_path;
|
f_path = misc_path;
|
||||||
else
|
else
|
||||||
f_path = sound_path;
|
f_path = sound_path;
|
||||||
BASS_ChannelStop(m_stream);
|
|
||||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
|
if (f_path.endsWith(".opus"))
|
||||||
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
m_stream_list[channel] = BASS_OPUS_StreamCreateFile(
|
||||||
BASS_ASYNCFILE);
|
FALSE, f_path.utf16(), 0, 0,
|
||||||
|
BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
||||||
|
else
|
||||||
|
m_stream_list[channel] = BASS_StreamCreateFile(
|
||||||
|
FALSE, f_path.utf16(), 0, 0,
|
||||||
|
BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
||||||
|
|
||||||
set_volume_internal(m_volume);
|
set_volume_internal(m_volume);
|
||||||
|
|
||||||
if (ao_app->get_audio_output_device() != "default")
|
if (ao_app->get_audio_output_device() != "default")
|
||||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice());
|
||||||
BASS_ChannelPlay(m_stream, false);
|
BASS_ChannelPlay(m_stream_list[m_channel], false);
|
||||||
if (looping_sfx && ao_app->get_looping_sfx()) {
|
|
||||||
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::setLooping(bool is_looping)
|
void AOSfxPlayer::stop(int channel)
|
||||||
{
|
{
|
||||||
this->looping_sfx = is_looping;
|
if (channel == -1) {
|
||||||
|
channel = m_channel;
|
||||||
|
}
|
||||||
|
BASS_ChannelStop(m_stream_list[channel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); }
|
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(qreal p_value)
|
void AOSfxPlayer::set_volume(qreal p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value / 100;
|
m_volume = p_value / 100;
|
||||||
@ -62,19 +89,51 @@ void AOSfxPlayer::set_volume(qreal p_value)
|
|||||||
|
|
||||||
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
||||||
{
|
{
|
||||||
float volume = p_value;
|
float volume = static_cast<float>(p_value);
|
||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
}
|
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
|
||||||
#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
|
}
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
ao_app = p_ao_app;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
void AOSfxPlayer::set_looping(bool toggle, int channel)
|
||||||
{
|
{
|
||||||
m_sfx.stop();
|
if (channel == -1) {
|
||||||
|
channel = m_channel;
|
||||||
|
}
|
||||||
|
m_looping = toggle;
|
||||||
|
if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) {
|
||||||
|
if (m_looping == false)
|
||||||
|
BASS_ChannelFlags(m_stream_list[channel], 0,
|
||||||
|
BASS_SAMPLE_LOOP); // remove the LOOP flag
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (m_looping == true)
|
||||||
|
BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP,
|
||||||
|
BASS_SAMPLE_LOOP); // set the LOOP flag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
|
||||||
|
|
||||||
|
void AOSfxPlayer::clear()
|
||||||
|
{
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
m_stream_list[n_stream].stop();
|
||||||
|
}
|
||||||
|
set_volume_internal(m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOSfxPlayer::loop_clear()
|
||||||
|
{
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
m_stream_list[n_stream].stop();
|
||||||
|
}
|
||||||
|
set_volume_internal(m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout,
|
||||||
|
int channel)
|
||||||
|
{
|
||||||
|
m_stream_list[channel].stop();
|
||||||
|
|
||||||
QString misc_path = "";
|
QString misc_path = "";
|
||||||
QString char_path = "";
|
QString char_path = "";
|
||||||
@ -96,21 +155,22 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
|||||||
|
|
||||||
if (file_exists(f_path)) // if its missing, it will glitch out
|
if (file_exists(f_path)) // if its missing, it will glitch out
|
||||||
{
|
{
|
||||||
m_sfx.setSource(QUrl::fromLocalFile(f_path));
|
m_stream_list[channel].setSource(QUrl::fromLocalFile(f_path));
|
||||||
|
|
||||||
set_volume_internal(m_volume);
|
set_volume_internal(m_volume);
|
||||||
|
|
||||||
m_sfx.play();
|
m_stream_list[channel].play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::setLooping(bool is_looping)
|
void AOSfxPlayer::stop(int channel)
|
||||||
{
|
{
|
||||||
this->looping_sfx = is_looping;
|
if (channel == -1) {
|
||||||
|
channel = m_channel;
|
||||||
|
}
|
||||||
|
m_stream_list[channel].stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::stop() { m_sfx.stop(); }
|
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(qreal p_value)
|
void AOSfxPlayer::set_volume(qreal p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value / 100;
|
m_volume = p_value / 100;
|
||||||
@ -119,25 +179,33 @@ void AOSfxPlayer::set_volume(qreal p_value)
|
|||||||
|
|
||||||
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
||||||
{
|
{
|
||||||
m_sfx.setVolume(m_volume);
|
float volume = static_cast<float>(p_value);
|
||||||
|
for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) {
|
||||||
|
m_stream_list[n_stream].setVolume(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOSfxPlayer::set_looping(bool toggle, int channel)
|
||||||
|
{
|
||||||
|
if (channel == -1) {
|
||||||
|
channel = m_channel;
|
||||||
|
}
|
||||||
|
m_looping = toggle;
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
void AOSfxPlayer::clear() {}
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
ao_app = p_ao_app;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {}
|
void AOSfxPlayer::loop_clear() {}
|
||||||
|
|
||||||
void AOSfxPlayer::setLooping(bool is_looping)
|
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout,
|
||||||
{
|
int channel) {}
|
||||||
this->looping_sfx = is_looping;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSfxPlayer::stop() {}
|
void AOSfxPlayer::stop(int channel) {}
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(qreal p_value) {}
|
void AOSfxPlayer::set_volume(qreal p_value) {}
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume_internal(qreal p_value) {}
|
void AOSfxPlayer::set_volume_internal(qreal p_value) {}
|
||||||
|
|
||||||
|
void AOSfxPlayer::set_looping(bool toggle, int channel) {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,8 +2,16 @@
|
|||||||
|
|
||||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {}
|
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {}
|
||||||
|
|
||||||
|
void AOTextArea::append_linked(QString p_message)
|
||||||
|
{
|
||||||
|
QString result = p_message.toHtmlEscaped()
|
||||||
|
.replace("\n", "<br>")
|
||||||
|
.replace(url_parser_regex, "<a href='\\1'>\\1</a>");
|
||||||
|
this->insertHtml(result);
|
||||||
|
}
|
||||||
|
|
||||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
|
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
|
||||||
QString p_colour, bool song)
|
QString p_colour)
|
||||||
{
|
{
|
||||||
const QTextCursor old_cursor = this->textCursor();
|
const QTextCursor old_cursor = this->textCursor();
|
||||||
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
||||||
@ -13,18 +21,14 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message,
|
|||||||
this->moveCursor(QTextCursor::End);
|
this->moveCursor(QTextCursor::End);
|
||||||
|
|
||||||
this->append("");
|
this->append("");
|
||||||
if (song)
|
this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() +
|
||||||
this->insertHtml("<b><font color=" + p_colour + ">" +
|
"</font></b>: ");
|
||||||
p_name.toHtmlEscaped() + "</font></b> ");
|
|
||||||
else
|
|
||||||
this->insertHtml("<b><font color=" + p_colour + ">" +
|
|
||||||
p_name.toHtmlEscaped() + "</font></b>: ");
|
|
||||||
|
|
||||||
// cheap workarounds ahoy
|
// cheap workarounds ahoy
|
||||||
p_message += " ";
|
p_message += " ";
|
||||||
QString result = p_message.toHtmlEscaped()
|
QString result = p_message.toHtmlEscaped()
|
||||||
.replace("\n", "<br>")
|
.replace("\n", "<br>")
|
||||||
.replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
|
.replace(url_parser_regex, "<a href='\\1'>\\1</a>");
|
||||||
|
|
||||||
this->insertHtml(result);
|
this->insertHtml(result);
|
||||||
|
|
||||||
@ -44,7 +48,7 @@ void AOTextArea::append_error(QString p_message)
|
|||||||
|
|
||||||
p_message += " ";
|
p_message += " ";
|
||||||
QString result = p_message.replace("\n", "<br>")
|
QString result = p_message.replace("\n", "<br>")
|
||||||
.replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
|
.replace(url_parser_regex, "<a href='\\1'>\\1</a>");
|
||||||
|
|
||||||
this->insertHtml("<font color='red'>" + result + "</font>");
|
this->insertHtml("<font color='red'>" + result + "</font>");
|
||||||
|
|
||||||
|
@ -5,54 +5,6 @@
|
|||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
#include "hardware_functions.h"
|
#include "hardware_functions.h"
|
||||||
|
|
||||||
class AOCharSelectGenerationThreading : public QRunnable {
|
|
||||||
public:
|
|
||||||
Courtroom *thisCourtroom;
|
|
||||||
int char_num;
|
|
||||||
AOCharButton *char_button;
|
|
||||||
AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number)
|
|
||||||
{
|
|
||||||
thisCourtroom = my_courtroom;
|
|
||||||
char_num = character_number;
|
|
||||||
}
|
|
||||||
void run()
|
|
||||||
{
|
|
||||||
// we take the button we are supposed to mess with, and not whatever comes
|
|
||||||
// first
|
|
||||||
AOCharButton *thisCharacterButton =
|
|
||||||
thisCourtroom->ui_char_button_list.at(char_num);
|
|
||||||
thisCharacterButton->reset();
|
|
||||||
thisCharacterButton->hide();
|
|
||||||
thisCharacterButton->set_image(thisCourtroom->char_list.at(char_num).name);
|
|
||||||
|
|
||||||
thisCourtroom->connect(thisCharacterButton, SIGNAL(clicked()),
|
|
||||||
thisCourtroom->char_button_mapper, SLOT(map()));
|
|
||||||
thisCourtroom->char_button_mapper->setMapping(thisCharacterButton,
|
|
||||||
char_num);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void AOCharSelectFilter(Courtroom *thisCourtroom, int char_num)
|
|
||||||
{
|
|
||||||
AOCharButton *current_char = thisCourtroom->ui_char_button_list.at(char_num);
|
|
||||||
|
|
||||||
if (!thisCourtroom->ui_char_taken->isChecked() &&
|
|
||||||
thisCourtroom->char_list.at(char_num).taken)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!thisCourtroom->char_list.at(char_num).name.contains(
|
|
||||||
thisCourtroom->ui_char_search->text(), Qt::CaseInsensitive))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We only really need to update the fact that a character is taken
|
|
||||||
// for the buttons that actually appear.
|
|
||||||
// You'd also update the passwordedness and etc. here later.
|
|
||||||
current_char->reset();
|
|
||||||
current_char->set_taken(thisCourtroom->char_list.at(char_num).taken);
|
|
||||||
|
|
||||||
thisCourtroom->ui_char_button_list_filtered.append(current_char);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Courtroom::construct_char_select()
|
void Courtroom::construct_char_select()
|
||||||
{
|
{
|
||||||
ui_char_select_background = new AOImage(this, ao_app);
|
ui_char_select_background = new AOImage(this, ao_app);
|
||||||
@ -92,8 +44,6 @@ void Courtroom::construct_char_select()
|
|||||||
|
|
||||||
set_size_and_pos(ui_char_buttons, "char_buttons");
|
set_size_and_pos(ui_char_buttons, "char_buttons");
|
||||||
|
|
||||||
connect(char_button_mapper, SIGNAL(mapped(int)), this,
|
|
||||||
SLOT(char_clicked(int)));
|
|
||||||
connect(ui_back_to_lobby, SIGNAL(clicked()), this,
|
connect(ui_back_to_lobby, SIGNAL(clicked()), this,
|
||||||
SLOT(on_back_to_lobby_clicked()));
|
SLOT(on_back_to_lobby_clicked()));
|
||||||
|
|
||||||
@ -120,15 +70,15 @@ void Courtroom::set_char_select()
|
|||||||
ao_app->get_element_dimensions("char_select", filename);
|
ao_app->get_element_dimensions("char_select", filename);
|
||||||
|
|
||||||
if (f_charselect.width < 0 || f_charselect.height < 0) {
|
if (f_charselect.width < 0 || f_charselect.height < 0) {
|
||||||
qDebug()
|
qDebug() << "W: did not find char_select width or height in "
|
||||||
<< "W: did not find courtroom width or height in courtroom_design.ini!";
|
"courtroom_design.ini!";
|
||||||
this->resize(714, 668);
|
this->resize(714, 668);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this->resize(f_charselect.width, f_charselect.height);
|
this->resize(f_charselect.width, f_charselect.height);
|
||||||
|
|
||||||
ui_char_select_background->resize(f_charselect.width, f_charselect.height);
|
ui_char_select_background->resize(f_charselect.width, f_charselect.height);
|
||||||
ui_char_select_background->set_image("charselect_background.png");
|
ui_char_select_background->set_image("charselect_background");
|
||||||
|
|
||||||
filter_character_list();
|
filter_character_list();
|
||||||
|
|
||||||
@ -173,28 +123,33 @@ void Courtroom::set_char_select_page()
|
|||||||
|
|
||||||
void Courtroom::char_clicked(int n_char)
|
void Courtroom::char_clicked(int n_char)
|
||||||
{
|
{
|
||||||
QString char_ini_path =
|
if (n_char != -1)
|
||||||
ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
|
{
|
||||||
|
QString char_ini_path =
|
||||||
|
ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
|
||||||
|
|
||||||
qDebug() << "char_ini_path" << char_ini_path;
|
qDebug() << "char_ini_path" << char_ini_path;
|
||||||
|
|
||||||
if (!file_exists(char_ini_path)) {
|
if (!file_exists(char_ini_path)) {
|
||||||
call_notice(tr("Could not find %1").arg(char_ini_path, 1));
|
call_notice("Could not find " + char_ini_path);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_char == m_cid) {
|
if (n_char != m_cid) {
|
||||||
enter_courtroom(m_cid);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ao_app->send_server_packet(
|
ao_app->send_server_packet(
|
||||||
new AOPacket("PW#" + ui_char_password->text() + "#%"));
|
new AOPacket("PW#" + ui_char_password->text() + "#%"));
|
||||||
ao_app->send_server_packet(
|
ao_app->send_server_packet(
|
||||||
new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" +
|
new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" +
|
||||||
QString::number(n_char) + "#" + get_hdid() + "#%"));
|
QString::number(n_char) + "#" + get_hdid() + "#%"));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
update_character(n_char);
|
||||||
|
|
||||||
ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
|
enter_courtroom();
|
||||||
|
|
||||||
|
if (n_char != -1)
|
||||||
|
ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||||
@ -250,27 +205,40 @@ void Courtroom::character_loading_finished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First, we'll make all the character buttons in the very beginning.
|
// First, we'll make all the character buttons in the very beginning.
|
||||||
// Since we can't trust what will happen during the multi threading process,
|
|
||||||
// we assign the buttons their locations in the list according to the
|
|
||||||
// character list.
|
|
||||||
for (int n = 0; n < char_list.size(); n++) {
|
|
||||||
AOCharButton *characterButton =
|
|
||||||
new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
|
|
||||||
ui_char_button_list.append(characterButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We also hide them all, so they can't be accidentally clicked.
|
// We also hide them all, so they can't be accidentally clicked.
|
||||||
// Later on, we'll be revealing buttons as we need them.
|
// Later on, we'll be revealing buttons as we need them.
|
||||||
for (int n = 0; n < char_list.size(); n++) {
|
for (int n = 0; n < char_list.size(); n++) {
|
||||||
AOCharSelectGenerationThreading *char_generate =
|
AOCharButton *char_button =
|
||||||
new AOCharSelectGenerationThreading(this, n);
|
new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
|
||||||
QThreadPool::globalInstance()->start(char_generate);
|
char_button->reset();
|
||||||
if (QThreadPool::globalInstance()->activeThreadCount() ==
|
char_button->hide();
|
||||||
QThreadPool::globalInstance()->maxThreadCount()) {
|
char_button->set_image(char_list.at(n).name);
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
char_button->setToolTip(char_list.at(n).name);
|
||||||
|
ui_char_button_list.append(char_button);
|
||||||
|
|
||||||
|
connect(char_button, &AOCharButton::clicked,
|
||||||
|
[this, n]() { this->char_clicked(n); });
|
||||||
|
|
||||||
|
// This part here serves as a way of showing to the player that the game is
|
||||||
|
// still running, it is just loading the pictures of the characters.
|
||||||
|
if (ao_app->lobby_constructed) {
|
||||||
|
ao_app->generated_chars++;
|
||||||
|
int total_loading_size = ao_app->char_list_size * 2 +
|
||||||
|
ao_app->evidence_list_size +
|
||||||
|
ao_app->music_list_size;
|
||||||
|
int loading_value =
|
||||||
|
int(((ao_app->loaded_chars + ao_app->generated_chars +
|
||||||
|
ao_app->loaded_music + ao_app->loaded_evidence) /
|
||||||
|
static_cast<double>(total_loading_size)) *
|
||||||
|
100);
|
||||||
|
ao_app->w_lobby->set_loading_value(loading_value);
|
||||||
|
ao_app->w_lobby->set_loading_text(
|
||||||
|
tr("Generating chars:\n%1/%2")
|
||||||
|
.arg(QString::number(ao_app->generated_chars))
|
||||||
|
.arg(QString::number(ao_app->char_list_size)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
|
||||||
filter_character_list();
|
filter_character_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +246,27 @@ void Courtroom::filter_character_list()
|
|||||||
{
|
{
|
||||||
ui_char_button_list_filtered.clear();
|
ui_char_button_list_filtered.clear();
|
||||||
for (int i = 0; i < char_list.size(); i++) {
|
for (int i = 0; i < char_list.size(); i++) {
|
||||||
AOCharSelectFilter(this, i);
|
AOCharButton *current_char = ui_char_button_list.at(i);
|
||||||
|
|
||||||
|
// It seems passwording characters is unimplemented yet?
|
||||||
|
// Until then, this will stay here, I suppose.
|
||||||
|
// if (ui_char_passworded->isChecked() && character_is_passworded??)
|
||||||
|
// continue;
|
||||||
|
|
||||||
|
if (!ui_char_taken->isChecked() && char_list.at(i).taken)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!char_list.at(i).name.contains(ui_char_search->text(),
|
||||||
|
Qt::CaseInsensitive))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// We only really need to update the fact that a character is taken
|
||||||
|
// for the buttons that actually appear.
|
||||||
|
// You'd also update the passwordedness and etc. here later.
|
||||||
|
current_char->reset();
|
||||||
|
current_char->set_taken(char_list.at(i).taken);
|
||||||
|
|
||||||
|
ui_char_button_list_filtered.append(current_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_char_page = 0;
|
current_char_page = 0;
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
chatlogpiece::chatlogpiece()
|
chatlogpiece::chatlogpiece()
|
||||||
{
|
{
|
||||||
name = "UNKNOWN";
|
name = tr("UNKNOWN");
|
||||||
showname = "UNKNOWN";
|
showname = tr("UNKNOWN");
|
||||||
message = "UNKNOWN";
|
message = tr("UNKNOWN");
|
||||||
color = 0;
|
color = 0;
|
||||||
is_song = false;
|
p_is_song = false;
|
||||||
datetime = QDateTime::currentDateTime().toUTC();
|
datetime = QDateTime::currentDateTime().toUTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
|
|||||||
name = p_name;
|
name = p_name;
|
||||||
showname = p_showname;
|
showname = p_showname;
|
||||||
message = p_message;
|
message = p_message;
|
||||||
is_song = p_song;
|
p_is_song = p_song;
|
||||||
color = p_color;
|
color = p_color;
|
||||||
datetime = QDateTime::currentDateTime().toUTC();
|
datetime = QDateTime::currentDateTime().toUTC();
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
|
|||||||
name = p_name;
|
name = p_name;
|
||||||
showname = p_showname;
|
showname = p_showname;
|
||||||
message = p_message;
|
message = p_message;
|
||||||
is_song = p_song;
|
p_is_song = p_song;
|
||||||
color = p_color;
|
color = p_color;
|
||||||
datetime = p_datetime.toUTC();
|
datetime = p_datetime.toUTC();
|
||||||
}
|
}
|
||||||
@ -41,9 +41,10 @@ QString chatlogpiece::get_message() { return message; }
|
|||||||
|
|
||||||
QDateTime chatlogpiece::get_datetime() { return datetime; }
|
QDateTime chatlogpiece::get_datetime() { return datetime; }
|
||||||
|
|
||||||
bool chatlogpiece::get_is_song() { return is_song; }
|
bool chatlogpiece::is_song() { return p_is_song; }
|
||||||
|
|
||||||
QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
|
QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
|
||||||
|
|
||||||
int chatlogpiece::get_chat_color() { return color; }
|
int chatlogpiece::get_chat_color() { return color; }
|
||||||
|
|
||||||
QString chatlogpiece::get_full()
|
QString chatlogpiece::get_full()
|
||||||
@ -51,13 +52,15 @@ QString chatlogpiece::get_full()
|
|||||||
QString full = "[";
|
QString full = "[";
|
||||||
|
|
||||||
full.append(get_datetime_as_string());
|
full.append(get_datetime_as_string());
|
||||||
full.append(" UTC] ");
|
full.append("] ");
|
||||||
full.append(get_showname());
|
full.append(get_showname());
|
||||||
full.append(" (");
|
full.append(" (");
|
||||||
full.append(get_name());
|
full.append(get_name());
|
||||||
full.append(")");
|
full.append(")");
|
||||||
if (is_song)
|
if (p_is_song)
|
||||||
full.append(" has played a song: ");
|
full.append(tr(" has played a song: "));
|
||||||
|
else
|
||||||
|
full.append(": ");
|
||||||
full.append(get_message());
|
full.append(get_message());
|
||||||
|
|
||||||
return full;
|
return full;
|
||||||
|
9259
src/courtroom.cpp
@ -21,7 +21,6 @@ void call_notice(QString p_message)
|
|||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
||||||
msgBox->setText(p_message);
|
msgBox->setText(p_message);
|
||||||
|
|
||||||
msgBox->setWindowTitle(
|
msgBox->setWindowTitle(
|
||||||
QCoreApplication::translate("debug_functions", "Notice"));
|
QCoreApplication::translate("debug_functions", "Notice"));
|
||||||
|
|
||||||
|
@ -2,20 +2,48 @@
|
|||||||
|
|
||||||
#include "aoemotebutton.h"
|
#include "aoemotebutton.h"
|
||||||
|
|
||||||
void Courtroom::construct_emotes()
|
void Courtroom::initialize_emotes()
|
||||||
{
|
{
|
||||||
ui_emotes = new QWidget(this);
|
ui_emotes = new QWidget(this);
|
||||||
|
|
||||||
|
ui_emote_left = new AOButton(this, ao_app);
|
||||||
|
ui_emote_right = new AOButton(this, ao_app);
|
||||||
|
|
||||||
|
ui_emote_dropdown = new QComboBox(this);
|
||||||
|
|
||||||
|
connect(ui_emote_left, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_emote_left_clicked()));
|
||||||
|
connect(ui_emote_right, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_emote_right_clicked()));
|
||||||
|
|
||||||
|
connect(ui_emote_dropdown, SIGNAL(activated(int)), this,
|
||||||
|
SLOT(on_emote_dropdown_changed(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::refresh_emotes()
|
||||||
|
{
|
||||||
|
// Should properly refresh the emote list
|
||||||
|
qDeleteAll(ui_emote_list.begin(), ui_emote_list.end());
|
||||||
|
ui_emote_list.clear();
|
||||||
|
|
||||||
set_size_and_pos(ui_emotes, "emotes");
|
set_size_and_pos(ui_emotes, "emotes");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_emote_left, "emote_left");
|
||||||
|
ui_emote_left->set_image("arrow_left");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_emote_right, "emote_right");
|
||||||
|
ui_emote_right->set_image("arrow_right");
|
||||||
|
|
||||||
QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing",
|
QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing",
|
||||||
"courtroom_design.ini");
|
"courtroom_design.ini");
|
||||||
|
QPoint p_point =
|
||||||
|
ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini");
|
||||||
|
|
||||||
const int button_width = 40;
|
const int button_width = p_point.x();
|
||||||
int x_spacing = f_spacing.x();
|
int x_spacing = f_spacing.x();
|
||||||
int x_mod_count = 0;
|
int x_mod_count = 0;
|
||||||
|
|
||||||
const int button_height = 40;
|
const int button_height = p_point.y();
|
||||||
int y_spacing = f_spacing.y();
|
int y_spacing = f_spacing.y();
|
||||||
int y_mod_count = 0;
|
int y_mod_count = 0;
|
||||||
|
|
||||||
@ -30,7 +58,8 @@ void Courtroom::construct_emotes()
|
|||||||
int x_pos = (button_width + x_spacing) * x_mod_count;
|
int x_pos = (button_width + x_spacing) * x_mod_count;
|
||||||
int y_pos = (button_height + y_spacing) * y_mod_count;
|
int y_pos = (button_height + y_spacing) * y_mod_count;
|
||||||
|
|
||||||
AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos);
|
AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos,
|
||||||
|
button_width, button_height);
|
||||||
|
|
||||||
ui_emote_list.append(f_emote);
|
ui_emote_list.append(f_emote);
|
||||||
|
|
||||||
@ -82,16 +111,19 @@ void Courtroom::set_emote_page()
|
|||||||
if (current_emote_page > 0)
|
if (current_emote_page > 0)
|
||||||
ui_emote_left->show();
|
ui_emote_left->show();
|
||||||
|
|
||||||
for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) {
|
for (int n_emote = 0;
|
||||||
|
n_emote < emotes_on_page && n_emote < ui_emote_list.size(); ++n_emote) {
|
||||||
int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
|
int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
|
||||||
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
||||||
|
|
||||||
if (n_real_emote == current_emote)
|
if (n_real_emote == current_emote)
|
||||||
f_emote->set_image(current_char, n_real_emote, "_on.png");
|
f_emote->set_char_image(current_char, n_real_emote, "_on");
|
||||||
else
|
else
|
||||||
f_emote->set_image(current_char, n_real_emote, "_off.png");
|
f_emote->set_char_image(current_char, n_real_emote, "_off");
|
||||||
|
|
||||||
f_emote->show();
|
f_emote->show();
|
||||||
|
f_emote->setToolTip(QString::number(n_real_emote + 1) + ": " +
|
||||||
|
ao_app->get_emote_comment(current_char, n_real_emote));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +135,8 @@ void Courtroom::set_emote_dropdown()
|
|||||||
QStringList emote_list;
|
QStringList emote_list;
|
||||||
|
|
||||||
for (int n = 0; n < total_emotes; ++n) {
|
for (int n = 0; n < total_emotes; ++n) {
|
||||||
emote_list.append(ao_app->get_emote_comment(current_char, n));
|
emote_list.append(QString::number(n + 1) + ": " +
|
||||||
|
ao_app->get_emote_comment(current_char, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_emote_dropdown->addItems(emote_list);
|
ui_emote_dropdown->addItems(emote_list);
|
||||||
@ -116,7 +149,7 @@ void Courtroom::select_emote(int p_id)
|
|||||||
|
|
||||||
if (current_emote >= min && current_emote <= max)
|
if (current_emote >= min && current_emote <= max)
|
||||||
ui_emote_list.at(current_emote % max_emotes_on_page)
|
ui_emote_list.at(current_emote % max_emotes_on_page)
|
||||||
->set_image(current_char, current_emote, "_off.png");
|
->set_char_image(current_char, current_emote, "_off");
|
||||||
|
|
||||||
int old_emote = current_emote;
|
int old_emote = current_emote;
|
||||||
|
|
||||||
@ -124,17 +157,19 @@ void Courtroom::select_emote(int p_id)
|
|||||||
|
|
||||||
if (current_emote >= min && current_emote <= max)
|
if (current_emote >= min && current_emote <= max)
|
||||||
ui_emote_list.at(current_emote % max_emotes_on_page)
|
ui_emote_list.at(current_emote % max_emotes_on_page)
|
||||||
->set_image(current_char, current_emote, "_on.png");
|
->set_char_image(current_char, current_emote, "_on");
|
||||||
|
|
||||||
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
|
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
|
||||||
|
|
||||||
if (old_emote == current_emote) {
|
if (old_emote == current_emote) {
|
||||||
ui_pre->setChecked(!ui_pre->isChecked());
|
ui_pre->setChecked(!ui_pre->isChecked());
|
||||||
}
|
}
|
||||||
else if (emote_mod == 1)
|
else if (!ao_app->is_stickypres_enabled()) {
|
||||||
ui_pre->setChecked(true);
|
if (emote_mod == 1 || emote_mod == 4)
|
||||||
else
|
ui_pre->setChecked(true);
|
||||||
ui_pre->setChecked(false);
|
else
|
||||||
|
ui_pre->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
ui_emote_dropdown->setCurrentIndex(current_emote);
|
ui_emote_dropdown->setCurrentIndex(current_emote);
|
||||||
|
|
||||||
|
568
src/evidence.cpp
@ -1,45 +1,194 @@
|
|||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
|
|
||||||
void Courtroom::construct_evidence()
|
void Courtroom::initialize_evidence()
|
||||||
{
|
{
|
||||||
ui_evidence = new AOImage(this, ao_app);
|
ui_evidence = new AOImage(this, ao_app);
|
||||||
|
|
||||||
// ui_evidence_name = new QLabel(ui_evidence);
|
// ui_evidence_name = new QLabel(ui_evidence);
|
||||||
ui_evidence_name = new AOLineEdit(ui_evidence);
|
ui_evidence_name = new AOLineEdit(ui_evidence);
|
||||||
ui_evidence_name->setAlignment(Qt::AlignCenter);
|
ui_evidence_name->setAlignment(Qt::AlignCenter);
|
||||||
ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold));
|
ui_evidence_name->setFrame(false);
|
||||||
ui_evidence_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
|
||||||
"color: rgba(255, 128, 0, 255);");
|
|
||||||
|
|
||||||
ui_evidence_buttons = new QWidget(ui_evidence);
|
ui_evidence_buttons = new QWidget(ui_evidence);
|
||||||
|
|
||||||
ui_evidence_left = new AOButton(ui_evidence, ao_app);
|
ui_evidence_left = new AOButton(ui_evidence, ao_app);
|
||||||
ui_evidence_right = new AOButton(ui_evidence, ao_app);
|
ui_evidence_right = new AOButton(ui_evidence, ao_app);
|
||||||
ui_evidence_present = new AOButton(ui_evidence, ao_app);
|
ui_evidence_present = new AOButton(ui_evidence, ao_app);
|
||||||
|
ui_evidence_present->setToolTip(tr("Present this piece of evidence to "
|
||||||
|
"everyone on your next spoken message"));
|
||||||
|
|
||||||
|
ui_evidence_switch = new AOButton(ui_evidence, ao_app);
|
||||||
|
ui_evidence_transfer = new AOButton(ui_evidence, ao_app);
|
||||||
|
|
||||||
|
ui_evidence_save = new AOButton(ui_evidence, ao_app);
|
||||||
|
ui_evidence_save->setToolTip(tr("Save evidence to an .ini file."));
|
||||||
|
ui_evidence_load = new AOButton(ui_evidence, ao_app);
|
||||||
|
ui_evidence_load->setToolTip(tr("Load evidence from an .ini file."));
|
||||||
|
|
||||||
ui_evidence_overlay = new AOImage(ui_evidence, ao_app);
|
ui_evidence_overlay = new AOImage(ui_evidence, ao_app);
|
||||||
|
|
||||||
ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app);
|
ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app);
|
||||||
|
ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence"));
|
||||||
ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay);
|
ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay);
|
||||||
ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app);
|
ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app);
|
||||||
ui_evidence_image_button->setText(tr("Choose..."));
|
ui_evidence_image_button->setText(tr("Choose.."));
|
||||||
ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app);
|
ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app);
|
||||||
|
ui_evidence_x->setToolTip(
|
||||||
|
tr("Close the evidence display/editing overlay.\n"
|
||||||
|
"You will be prompted if there's any unsaved changes."));
|
||||||
|
ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app);
|
||||||
|
ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of "
|
||||||
|
"evidence and send them to server."));
|
||||||
|
|
||||||
ui_evidence_description = new AOTextEdit(ui_evidence_overlay);
|
ui_evidence_description = new AOTextEdit(ui_evidence_overlay);
|
||||||
ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
"color: white;");
|
"color: white;");
|
||||||
|
ui_evidence_description->setFrameStyle(QFrame::NoFrame);
|
||||||
|
ui_evidence_description->setToolTip(
|
||||||
|
tr("Double-click to edit. Press [X] to update your changes."));
|
||||||
|
|
||||||
|
connect(ui_evidence_name, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(on_evidence_name_edited()));
|
||||||
|
connect(ui_evidence_name, SIGNAL(double_clicked()), this,
|
||||||
|
SLOT(on_evidence_name_double_clicked()));
|
||||||
|
connect(ui_evidence_left, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_left_clicked()));
|
||||||
|
connect(ui_evidence_right, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_right_clicked()));
|
||||||
|
connect(ui_evidence_present, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_present_clicked()));
|
||||||
|
connect(ui_evidence_switch, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_switch_clicked()));
|
||||||
|
connect(ui_evidence_transfer, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_transfer_clicked()));
|
||||||
|
connect(ui_evidence_save, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_save_clicked()));
|
||||||
|
connect(ui_evidence_load, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_load_clicked()));
|
||||||
|
|
||||||
|
connect(ui_evidence_delete, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_delete_clicked()));
|
||||||
|
connect(ui_evidence_image_name, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(on_evidence_image_name_edited()));
|
||||||
|
connect(ui_evidence_image_name, SIGNAL(double_clicked()), this,
|
||||||
|
SLOT(on_evidence_image_name_double_clicked()));
|
||||||
|
connect(ui_evidence_image_button, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_image_button_clicked()));
|
||||||
|
connect(ui_evidence_x, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_x_clicked()));
|
||||||
|
connect(ui_evidence_ok, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_evidence_ok_clicked()));
|
||||||
|
|
||||||
|
connect(ui_evidence_name, SIGNAL(textChanged(QString)), this,
|
||||||
|
SLOT(on_evidence_edited()));
|
||||||
|
connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this,
|
||||||
|
SLOT(on_evidence_edited()));
|
||||||
|
connect(ui_evidence_description, SIGNAL(textChanged()), this,
|
||||||
|
SLOT(on_evidence_edited()));
|
||||||
|
|
||||||
|
ui_evidence->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::refresh_evidence()
|
||||||
|
{
|
||||||
|
set_font(ui_evidence_name, "", "evidence_name");
|
||||||
|
set_font(ui_evidence_image_name, "", "evidence_image_name");
|
||||||
|
set_font(ui_evidence_description, "", "evidence_description");
|
||||||
|
|
||||||
|
// Should properly refresh the evidence list
|
||||||
|
qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end());
|
||||||
|
ui_evidence_list.clear();
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_button, "evidence_button");
|
||||||
|
ui_evidence_button->set_image("evidence_button");
|
||||||
|
ui_evidence_button->setToolTip(tr("Bring up the Evidence screen."));
|
||||||
|
|
||||||
set_size_and_pos(ui_evidence, "evidence_background");
|
set_size_and_pos(ui_evidence, "evidence_background");
|
||||||
|
if (current_evidence_global)
|
||||||
|
ui_evidence->set_image("evidence_background");
|
||||||
|
else
|
||||||
|
ui_evidence->set_image("evidence_background_private");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_name, "evidence_name");
|
||||||
|
|
||||||
set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
|
set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_left, "evidence_left");
|
||||||
|
ui_evidence_left->set_image("arrow_left");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_right, "evidence_right");
|
||||||
|
ui_evidence_right->set_image("arrow_right");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_present, "evidence_present");
|
||||||
|
ui_evidence_present->set_image("present");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_overlay, "evidence_overlay");
|
||||||
|
if (current_evidence_global)
|
||||||
|
ui_evidence_overlay->set_image("evidence_overlay");
|
||||||
|
else
|
||||||
|
ui_evidence_overlay->set_image("evidence_overlay_private");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_delete, "evidence_delete");
|
||||||
|
ui_evidence_delete->set_image("evidence_delete");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_image_name, "evidence_image_name");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_image_button, "evidence_image_button");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_x, "evidence_x");
|
||||||
|
ui_evidence_x->set_image("evidence_x");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_ok, "evidence_ok");
|
||||||
|
ui_evidence_ok->set_image("evidence_ok");
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_switch, "evidence_switch");
|
||||||
|
if (current_evidence_global) {
|
||||||
|
ui_evidence_switch->set_image("evidence_global");
|
||||||
|
ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_evidence_switch->set_image("evidence_private");
|
||||||
|
ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory."));
|
||||||
|
}
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_transfer, "evidence_transfer");
|
||||||
|
if (current_evidence_global) {
|
||||||
|
ui_evidence_transfer->set_image("evidence_transfer");
|
||||||
|
ui_evidence_transfer->setToolTip(
|
||||||
|
tr("Transfer evidence to private inventory."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_evidence_transfer->set_image("evidence_transfer_private");
|
||||||
|
ui_evidence_transfer->setToolTip(
|
||||||
|
tr("Transfer evidence to global inventory."));
|
||||||
|
}
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_save, "evidence_save");
|
||||||
|
ui_evidence_save->set_image("evidence_save");
|
||||||
|
if (current_evidence_global)
|
||||||
|
ui_evidence_save->hide();
|
||||||
|
else
|
||||||
|
ui_evidence_save->show();
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_load, "evidence_load");
|
||||||
|
ui_evidence_load->set_image("evidence_load");
|
||||||
|
if (current_evidence_global)
|
||||||
|
ui_evidence_load->hide();
|
||||||
|
else
|
||||||
|
ui_evidence_load->show();
|
||||||
|
|
||||||
|
set_size_and_pos(ui_evidence_description, "evidence_description");
|
||||||
|
|
||||||
QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing",
|
QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing",
|
||||||
"courtroom_design.ini");
|
"courtroom_design.ini");
|
||||||
|
QPoint p_point = ao_app->get_button_spacing("evidence_button_size",
|
||||||
|
"courtroom_design.ini");
|
||||||
|
|
||||||
const int button_width = 70;
|
const int button_width = p_point.x();
|
||||||
int x_spacing = f_spacing.x();
|
int x_spacing = f_spacing.x();
|
||||||
int x_mod_count = 0;
|
int x_mod_count = 0;
|
||||||
|
|
||||||
const int button_height = 70;
|
const int button_height = p_point.y();
|
||||||
int y_spacing = f_spacing.y();
|
int y_spacing = f_spacing.y();
|
||||||
int y_mod_count = 0;
|
int y_mod_count = 0;
|
||||||
|
|
||||||
@ -56,8 +205,8 @@ void Courtroom::construct_evidence()
|
|||||||
int x_pos = (button_width + x_spacing) * x_mod_count;
|
int x_pos = (button_width + x_spacing) * x_mod_count;
|
||||||
int y_pos = (button_height + y_spacing) * y_mod_count;
|
int y_pos = (button_height + y_spacing) * y_mod_count;
|
||||||
|
|
||||||
AOEvidenceButton *f_evidence =
|
AOEvidenceButton *f_evidence = new AOEvidenceButton(
|
||||||
new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
|
ui_evidence_buttons, ao_app, x_pos, y_pos, button_width, button_height);
|
||||||
|
|
||||||
ui_evidence_list.append(f_evidence);
|
ui_evidence_list.append(f_evidence);
|
||||||
|
|
||||||
@ -77,33 +226,64 @@ void Courtroom::construct_evidence()
|
|||||||
x_mod_count = 0;
|
x_mod_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui_evidence_name, SIGNAL(returnPressed()), this,
|
|
||||||
SLOT(on_evidence_name_edited()));
|
|
||||||
connect(ui_evidence_left, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_left_clicked()));
|
|
||||||
connect(ui_evidence_right, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_right_clicked()));
|
|
||||||
connect(ui_evidence_present, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_present_clicked()));
|
|
||||||
connect(ui_evidence_delete, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_delete_clicked()));
|
|
||||||
connect(ui_evidence_image_name, SIGNAL(returnPressed()), this,
|
|
||||||
SLOT(on_evidence_image_name_edited()));
|
|
||||||
connect(ui_evidence_image_button, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_image_button_clicked()));
|
|
||||||
connect(ui_evidence_x, SIGNAL(clicked()), this,
|
|
||||||
SLOT(on_evidence_x_clicked()));
|
|
||||||
|
|
||||||
ui_evidence->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_evidence_list(QVector<evi_type> &p_evi_list)
|
void Courtroom::set_evidence_list(QVector<evi_type> &p_evi_list)
|
||||||
{
|
{
|
||||||
|
global_evidence_list = p_evi_list;
|
||||||
|
if (!current_evidence_global)
|
||||||
|
return; // We're on private evidence editing, wait for user to do their
|
||||||
|
// thing
|
||||||
|
|
||||||
|
QVector<evi_type> old_list = local_evidence_list;
|
||||||
local_evidence_list.clear();
|
local_evidence_list.clear();
|
||||||
local_evidence_list = p_evi_list;
|
local_evidence_list = p_evi_list;
|
||||||
|
|
||||||
set_evidence_page();
|
set_evidence_page();
|
||||||
|
|
||||||
|
if (ui_evidence_overlay
|
||||||
|
->isVisible()) // Update the currently edited evidence for this user
|
||||||
|
{
|
||||||
|
if (current_evidence >= local_evidence_list.size()) {
|
||||||
|
evidence_close();
|
||||||
|
ui_evidence_name->setText("");
|
||||||
|
}
|
||||||
|
else if (ui_evidence_description->isReadOnly()) // We haven't double clicked
|
||||||
|
// to edit it or anything
|
||||||
|
{
|
||||||
|
on_evidence_double_clicked(current_evidence);
|
||||||
|
}
|
||||||
|
// Todo: make a function that compares two pieces of evidence for any
|
||||||
|
// differences
|
||||||
|
else if (compare_evidence_changed(
|
||||||
|
old_list.at(current_evidence),
|
||||||
|
local_evidence_list.at(current_evidence))) {
|
||||||
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
||||||
|
msgBox->setText(tr("The piece of evidence you've been editing has changed."));
|
||||||
|
msgBox->setInformativeText(tr("Do you wish to keep your changes?"));
|
||||||
|
msgBox->setDetailedText(tr(
|
||||||
|
"Name: %1\n"
|
||||||
|
"Image: %2\n"
|
||||||
|
"Description:\n%3").arg(local_evidence_list.at(current_evidence).name).arg(local_evidence_list.at(current_evidence).image).arg(local_evidence_list.at(current_evidence).description));
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::LastButton);
|
||||||
|
// msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
int ret = msgBox->exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Yes:
|
||||||
|
// "Keep changes"
|
||||||
|
break;
|
||||||
|
case QMessageBox::No:
|
||||||
|
// "Discard changes and keep theirs"
|
||||||
|
on_evidence_double_clicked(current_evidence);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// should never be reached
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_evidence_page()
|
void Courtroom::set_evidence_page()
|
||||||
@ -114,7 +294,7 @@ void Courtroom::set_evidence_page()
|
|||||||
ui_evidence_right->hide();
|
ui_evidence_right->hide();
|
||||||
|
|
||||||
for (AOEvidenceButton *i_button : ui_evidence_list) {
|
for (AOEvidenceButton *i_button : ui_evidence_list) {
|
||||||
i_button->reset();
|
i_button->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// to account for the "add evidence" button
|
// to account for the "add evidence" button
|
||||||
@ -147,17 +327,21 @@ void Courtroom::set_evidence_page()
|
|||||||
AOEvidenceButton *f_evidence_button =
|
AOEvidenceButton *f_evidence_button =
|
||||||
ui_evidence_list.at(n_evidence_button);
|
ui_evidence_list.at(n_evidence_button);
|
||||||
|
|
||||||
// ie. the add evidence button
|
f_evidence_button->set_selected(false);
|
||||||
if (n_real_evidence == (total_evidence - 1))
|
f_evidence_button->setToolTip("");
|
||||||
|
if (n_real_evidence == (total_evidence - 1)) {
|
||||||
f_evidence_button->set_theme_image("addevidence.png");
|
f_evidence_button->set_theme_image("addevidence.png");
|
||||||
|
}
|
||||||
else if (n_real_evidence < (total_evidence - 1)) {
|
else if (n_real_evidence < (total_evidence - 1)) {
|
||||||
f_evidence_button->set_image(
|
f_evidence_button->set_image(
|
||||||
local_evidence_list.at(n_real_evidence).image);
|
local_evidence_list.at(n_real_evidence).image);
|
||||||
|
|
||||||
if (n_real_evidence == current_evidence)
|
if (n_real_evidence == current_evidence)
|
||||||
f_evidence_button->set_selected(true);
|
f_evidence_button->set_selected(true);
|
||||||
else
|
|
||||||
f_evidence_button->set_selected(false);
|
f_evidence_button->setToolTip(
|
||||||
|
QString::number(n_real_evidence + 1) + ": " +
|
||||||
|
local_evidence_list.at(n_real_evidence).name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
f_evidence_button->set_image("");
|
f_evidence_button->set_image("");
|
||||||
@ -168,36 +352,31 @@ void Courtroom::set_evidence_page()
|
|||||||
|
|
||||||
void Courtroom::on_evidence_name_edited()
|
void Courtroom::on_evidence_name_edited()
|
||||||
{
|
{
|
||||||
|
ui_evidence_name->setReadOnly(true);
|
||||||
if (current_evidence >= local_evidence_list.size())
|
if (current_evidence >= local_evidence_list.size())
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList f_contents;
|
void Courtroom::on_evidence_name_double_clicked()
|
||||||
|
{
|
||||||
|
if (ui_evidence_overlay->isVisible()) {
|
||||||
|
ui_evidence_name->setReadOnly(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_evidence_name->setReadOnly(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
evi_type f_evi = local_evidence_list.at(current_evidence);
|
void Courtroom::on_evidence_image_name_double_clicked()
|
||||||
|
{
|
||||||
f_contents.append(QString::number(current_evidence));
|
ui_evidence_image_name->setReadOnly(false);
|
||||||
f_contents.append(ui_evidence_name->text());
|
|
||||||
f_contents.append(f_evi.description);
|
|
||||||
f_contents.append(f_evi.image);
|
|
||||||
|
|
||||||
ao_app->send_server_packet(new AOPacket("EE", f_contents));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::on_evidence_image_name_edited()
|
void Courtroom::on_evidence_image_name_edited()
|
||||||
{
|
{
|
||||||
|
ui_evidence_image_name->setReadOnly(true);
|
||||||
if (current_evidence >= local_evidence_list.size())
|
if (current_evidence >= local_evidence_list.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QStringList f_contents;
|
|
||||||
|
|
||||||
evi_type f_evi = local_evidence_list.at(current_evidence);
|
|
||||||
|
|
||||||
f_contents.append(QString::number(current_evidence));
|
|
||||||
f_contents.append(f_evi.name);
|
|
||||||
f_contents.append(f_evi.description);
|
|
||||||
f_contents.append(ui_evidence_image_name->text());
|
|
||||||
|
|
||||||
ao_app->send_server_packet(new AOPacket("EE", f_contents));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::on_evidence_image_button_clicked()
|
void Courtroom::on_evidence_image_button_clicked()
|
||||||
@ -230,8 +409,19 @@ void Courtroom::on_evidence_clicked(int p_id)
|
|||||||
int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
|
int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
|
||||||
|
|
||||||
if (f_real_id == local_evidence_list.size()) {
|
if (f_real_id == local_evidence_list.size()) {
|
||||||
ao_app->send_server_packet(
|
if (current_evidence_global)
|
||||||
new AOPacket("PE#<name>#<description>#empty.png#%"));
|
ao_app->send_server_packet(
|
||||||
|
new AOPacket("PE#<name>#<description>#empty.png#%"));
|
||||||
|
else {
|
||||||
|
evi_type f_evi;
|
||||||
|
f_evi.name = "<name>";
|
||||||
|
f_evi.description = "<description>";
|
||||||
|
f_evi.image = "empty.png";
|
||||||
|
|
||||||
|
local_evidence_list.append(f_evi);
|
||||||
|
private_evidence_list = local_evidence_list;
|
||||||
|
set_evidence_page();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (f_real_id > local_evidence_list.size())
|
else if (f_real_id > local_evidence_list.size())
|
||||||
@ -246,7 +436,7 @@ void Courtroom::on_evidence_clicked(int p_id)
|
|||||||
|
|
||||||
current_evidence = f_real_id;
|
current_evidence = f_real_id;
|
||||||
|
|
||||||
ui_ic_chat_message->setFocus();
|
// ui_ic_chat_message->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::on_evidence_double_clicked(int p_id)
|
void Courtroom::on_evidence_double_clicked(int p_id)
|
||||||
@ -262,10 +452,18 @@ void Courtroom::on_evidence_double_clicked(int p_id)
|
|||||||
|
|
||||||
ui_evidence_description->clear();
|
ui_evidence_description->clear();
|
||||||
ui_evidence_description->appendPlainText(f_evi.description);
|
ui_evidence_description->appendPlainText(f_evi.description);
|
||||||
|
ui_evidence_description->setReadOnly(true);
|
||||||
|
ui_evidence_description->setToolTip(tr("Double-click to edit..."));
|
||||||
|
|
||||||
|
ui_evidence_name->setText(f_evi.name);
|
||||||
|
ui_evidence_name->setReadOnly(true);
|
||||||
|
ui_evidence_name->setToolTip(tr("Double-click to edit..."));
|
||||||
ui_evidence_image_name->setText(f_evi.image);
|
ui_evidence_image_name->setText(f_evi.image);
|
||||||
|
ui_evidence_image_name->setReadOnly(true);
|
||||||
|
ui_evidence_image_name->setToolTip(tr("Double-click to edit..."));
|
||||||
|
|
||||||
ui_evidence_overlay->show();
|
ui_evidence_overlay->show();
|
||||||
|
ui_evidence_ok->hide();
|
||||||
|
|
||||||
ui_ic_chat_message->setFocus();
|
ui_ic_chat_message->setFocus();
|
||||||
}
|
}
|
||||||
@ -307,10 +505,15 @@ void Courtroom::on_evidence_right_clicked()
|
|||||||
|
|
||||||
void Courtroom::on_evidence_present_clicked()
|
void Courtroom::on_evidence_present_clicked()
|
||||||
{
|
{
|
||||||
|
if (!current_evidence_global) {
|
||||||
|
ui_evidence_present->hide();
|
||||||
|
is_presenting_evidence = false;
|
||||||
|
return; // otherwise we get force-disconnected
|
||||||
|
}
|
||||||
if (is_presenting_evidence)
|
if (is_presenting_evidence)
|
||||||
ui_evidence_present->set_image("present_disabled.png");
|
ui_evidence_present->set_image("present");
|
||||||
else
|
else
|
||||||
ui_evidence_present->set_image("present.png");
|
ui_evidence_present->set_image("present_disabled");
|
||||||
|
|
||||||
is_presenting_evidence = !is_presenting_evidence;
|
is_presenting_evidence = !is_presenting_evidence;
|
||||||
|
|
||||||
@ -319,11 +522,15 @@ void Courtroom::on_evidence_present_clicked()
|
|||||||
|
|
||||||
void Courtroom::on_evidence_delete_clicked()
|
void Courtroom::on_evidence_delete_clicked()
|
||||||
{
|
{
|
||||||
ui_evidence_description->setReadOnly(true);
|
evidence_close();
|
||||||
ui_evidence_overlay->hide();
|
if (current_evidence_global)
|
||||||
|
ao_app->send_server_packet(
|
||||||
ao_app->send_server_packet(
|
new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
|
||||||
new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
|
else {
|
||||||
|
local_evidence_list.remove(current_evidence);
|
||||||
|
private_evidence_list = local_evidence_list;
|
||||||
|
set_evidence_page();
|
||||||
|
}
|
||||||
|
|
||||||
current_evidence = 0;
|
current_evidence = 0;
|
||||||
|
|
||||||
@ -332,22 +539,239 @@ void Courtroom::on_evidence_delete_clicked()
|
|||||||
|
|
||||||
void Courtroom::on_evidence_x_clicked()
|
void Courtroom::on_evidence_x_clicked()
|
||||||
{
|
{
|
||||||
ui_evidence_description->setReadOnly(true);
|
if (current_evidence >=
|
||||||
ui_evidence_overlay->hide();
|
local_evidence_list.size()) // Should never happen but you never know.
|
||||||
|
return;
|
||||||
|
|
||||||
|
evi_type fake_evidence;
|
||||||
|
fake_evidence.name = ui_evidence_name->text();
|
||||||
|
fake_evidence.description = ui_evidence_description->toPlainText();
|
||||||
|
fake_evidence.image = ui_evidence_image_name->text();
|
||||||
|
if (!compare_evidence_changed(fake_evidence,
|
||||||
|
local_evidence_list.at(current_evidence))) {
|
||||||
|
evidence_close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
msgBox->setText(tr("Evidence has been modified."));
|
||||||
|
msgBox->setInformativeText(tr("Do you want to save your changes?"));
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard |
|
||||||
|
QMessageBox::Cancel);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Save);
|
||||||
|
int ret = msgBox->exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Save:
|
||||||
|
evidence_close();
|
||||||
|
on_evidence_ok_clicked();
|
||||||
|
break;
|
||||||
|
case QMessageBox::Discard:
|
||||||
|
evidence_close();
|
||||||
|
break;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
// Cancel was clicked, do nothing
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// should never be reached
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_ok_clicked()
|
||||||
|
{
|
||||||
|
ui_evidence_name->setReadOnly(true);
|
||||||
|
ui_evidence_description->setReadOnly(true);
|
||||||
|
ui_evidence_image_name->setReadOnly(true);
|
||||||
|
if (current_evidence < local_evidence_list.size()) {
|
||||||
|
evi_type f_evi = local_evidence_list.at(current_evidence);
|
||||||
|
if (current_evidence_global) {
|
||||||
|
QStringList f_contents;
|
||||||
|
f_contents.append(QString::number(current_evidence));
|
||||||
|
f_contents.append(ui_evidence_name->text());
|
||||||
|
f_contents.append(ui_evidence_description->toPlainText());
|
||||||
|
f_contents.append(ui_evidence_image_name->text());
|
||||||
|
|
||||||
|
ao_app->send_server_packet(new AOPacket("EE", f_contents));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
f_evi.name = ui_evidence_name->text();
|
||||||
|
f_evi.description = ui_evidence_description->toPlainText();
|
||||||
|
f_evi.image = ui_evidence_image_name->text();
|
||||||
|
local_evidence_list.replace(current_evidence, f_evi);
|
||||||
|
private_evidence_list = local_evidence_list;
|
||||||
|
ui_evidence_ok->hide();
|
||||||
|
set_evidence_page();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_switch_clicked()
|
||||||
|
{
|
||||||
|
evidence_close();
|
||||||
|
evidence_switch(!current_evidence_global);
|
||||||
|
if (current_evidence_global) {
|
||||||
|
ui_evidence_switch->set_image("evidence_global");
|
||||||
|
ui_evidence->set_image("evidence_background");
|
||||||
|
ui_evidence_overlay->set_image("evidence_overlay");
|
||||||
|
ui_evidence_transfer->set_image("evidence_transfer");
|
||||||
|
ui_evidence_transfer->setToolTip(
|
||||||
|
tr("Transfer evidence to private inventory."));
|
||||||
|
ui_evidence_switch->setToolTip(
|
||||||
|
tr("Current evidence is global. Click to switch to private."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_evidence_switch->set_image("evidence_private");
|
||||||
|
ui_evidence->set_image("evidence_background_private");
|
||||||
|
ui_evidence_overlay->set_image("evidence_overlay_private");
|
||||||
|
ui_evidence_transfer->set_image("evidence_transfer_private");
|
||||||
|
ui_evidence_transfer->setToolTip(
|
||||||
|
tr("Transfer evidence to global inventory."));
|
||||||
|
ui_evidence_switch->setToolTip(
|
||||||
|
tr("Current evidence is private. Click to switch to global."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_transfer_clicked()
|
||||||
|
{
|
||||||
if (current_evidence >= local_evidence_list.size())
|
if (current_evidence >= local_evidence_list.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QStringList f_contents;
|
QString name;
|
||||||
|
if (!current_evidence_global) // Transfer private evidence to global
|
||||||
|
{
|
||||||
|
evi_type f_evi = local_evidence_list.at(current_evidence);
|
||||||
|
|
||||||
evi_type f_evi = local_evidence_list.at(current_evidence);
|
QStringList f_contents;
|
||||||
|
f_contents.append(f_evi.name);
|
||||||
|
f_contents.append(f_evi.description);
|
||||||
|
f_contents.append(f_evi.image);
|
||||||
|
|
||||||
f_contents.append(QString::number(current_evidence));
|
name = f_evi.name;
|
||||||
f_contents.append(f_evi.name);
|
ao_app->send_server_packet(new AOPacket("PE", f_contents));
|
||||||
f_contents.append(ui_evidence_description->toPlainText());
|
}
|
||||||
f_contents.append(f_evi.image);
|
else // Transfer global evidence to private
|
||||||
|
{
|
||||||
|
evi_type f_evi = local_evidence_list.at(current_evidence);
|
||||||
|
name = f_evi.name;
|
||||||
|
private_evidence_list.append(f_evi);
|
||||||
|
}
|
||||||
|
|
||||||
ao_app->send_server_packet(new AOPacket("EE", f_contents));
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
msgBox->setText(tr("\"%1\" has been transferred.").arg(name));
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_edited()
|
||||||
|
{
|
||||||
|
if (current_evidence >=
|
||||||
|
local_evidence_list.size()) // Should never happen but you never know.
|
||||||
|
return;
|
||||||
|
evi_type fake_evidence;
|
||||||
|
fake_evidence.name = ui_evidence_name->text();
|
||||||
|
fake_evidence.description = ui_evidence_description->toPlainText();
|
||||||
|
fake_evidence.image = ui_evidence_image_name->text();
|
||||||
|
if (compare_evidence_changed(fake_evidence,
|
||||||
|
local_evidence_list.at(current_evidence)))
|
||||||
|
ui_evidence_ok->show();
|
||||||
|
else
|
||||||
|
ui_evidence_ok->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::evidence_close()
|
||||||
|
{
|
||||||
|
ui_evidence_description->setReadOnly(true);
|
||||||
|
ui_evidence_description->setToolTip("");
|
||||||
|
ui_evidence_name->setReadOnly(true);
|
||||||
|
ui_evidence_name->setToolTip("");
|
||||||
|
ui_evidence_image_name->setReadOnly(true);
|
||||||
|
ui_evidence_image_name->setToolTip("");
|
||||||
|
ui_evidence_overlay->hide();
|
||||||
ui_ic_chat_message->setFocus();
|
ui_ic_chat_message->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Courtroom::evidence_switch(bool global)
|
||||||
|
{
|
||||||
|
current_evidence_global = global;
|
||||||
|
is_presenting_evidence = false;
|
||||||
|
ui_evidence_present->set_image("present");
|
||||||
|
local_evidence_list.clear();
|
||||||
|
if (current_evidence_global) {
|
||||||
|
local_evidence_list = global_evidence_list;
|
||||||
|
ui_evidence_present->show();
|
||||||
|
ui_evidence_save->hide();
|
||||||
|
ui_evidence_load->hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
local_evidence_list = private_evidence_list;
|
||||||
|
ui_evidence_present->hide();
|
||||||
|
ui_evidence_save->show();
|
||||||
|
ui_evidence_load->show();
|
||||||
|
}
|
||||||
|
current_evidence_page = 0;
|
||||||
|
set_evidence_page();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_save_clicked()
|
||||||
|
{
|
||||||
|
if (current_evidence_global)
|
||||||
|
return; // Don't allow saving/loading operations when in global inventory
|
||||||
|
// mode for now
|
||||||
|
|
||||||
|
QString p_path = QFileDialog::getSaveFileName(
|
||||||
|
this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)"));
|
||||||
|
if (p_path.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
evidence_close();
|
||||||
|
ui_evidence_name->setText("");
|
||||||
|
|
||||||
|
QSettings inventory(p_path, QSettings::IniFormat);
|
||||||
|
inventory.clear();
|
||||||
|
for (int i = 0; i < local_evidence_list.size(); i++) {
|
||||||
|
inventory.beginGroup(QString::number(i));
|
||||||
|
inventory.setValue("name", local_evidence_list[i].name);
|
||||||
|
inventory.setValue("description", local_evidence_list[i].description);
|
||||||
|
inventory.setValue("image", local_evidence_list[i].image);
|
||||||
|
inventory.endGroup();
|
||||||
|
}
|
||||||
|
inventory.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::on_evidence_load_clicked()
|
||||||
|
{
|
||||||
|
if (current_evidence_global)
|
||||||
|
return; // Don't allow saving/loading operations when in global inventory
|
||||||
|
// mode for now
|
||||||
|
|
||||||
|
QString p_path = QFileDialog::getOpenFileName(
|
||||||
|
this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)"));
|
||||||
|
if (p_path.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
evidence_close();
|
||||||
|
ui_evidence_name->setText("");
|
||||||
|
|
||||||
|
QSettings inventory(p_path, QSettings::IniFormat);
|
||||||
|
local_evidence_list.clear();
|
||||||
|
foreach (QString evi, inventory.childGroups()) {
|
||||||
|
if (evi == "General")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
evi_type f_evi;
|
||||||
|
f_evi.name = inventory.value(evi + "/name", tr("UNKNOWN")).value<QString>();
|
||||||
|
f_evi.description =
|
||||||
|
inventory.value(evi + "/description", tr("UNKNOWN")).value<QString>();
|
||||||
|
f_evi.image =
|
||||||
|
inventory.value(evi + "/image", "UNKNOWN.png").value<QString>();
|
||||||
|
local_evidence_list.append(f_evi);
|
||||||
|
}
|
||||||
|
private_evidence_list = local_evidence_list;
|
||||||
|
set_evidence_page();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Courtroom::compare_evidence_changed(evi_type evi_a, evi_type evi_b)
|
||||||
|
{
|
||||||
|
return evi_a.name != evi_b.name || evi_a.image != evi_b.image ||
|
||||||
|
evi_a.description != evi_b.description;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "hardware_functions.h"
|
#include "hardware_functions.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(_WIN64))
|
#if (defined(_WIN32) || defined(_WIN64))
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -49,6 +52,7 @@ QString get_hdid()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <IOKit/IOKitLib.h>
|
#include <IOKit/IOKitLib.h>
|
||||||
|
|
||||||
@ -80,3 +84,16 @@ QString get_hdid()
|
|||||||
#error This operating system is unsupported for hardware functions.
|
#error This operating system is unsupported for hardware functions.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include <QSysInfo>
|
||||||
|
|
||||||
|
QByteArray machineId;
|
||||||
|
|
||||||
|
QString get_hdid()
|
||||||
|
{
|
||||||
|
machineId = QSysInfo::machineUniqueId();
|
||||||
|
return QString(machineId);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
951
src/lobby.cpp
@ -1,403 +1,548 @@
|
|||||||
#include "lobby.h"
|
#include "lobby.h"
|
||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
#include "networkmanager.h"
|
#include "networkmanager.h"
|
||||||
|
|
||||||
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
this->setWindowTitle(tr("Attorney Online 2"));
|
this->setWindowTitle(tr("Attorney Online 2"));
|
||||||
this->setWindowIcon(QIcon(":/logo.png"));
|
this->setWindowIcon(QIcon(":/logo.png"));
|
||||||
|
|
||||||
ui_background = new AOImage(this, ao_app);
|
ui_background = new AOImage(this, ao_app);
|
||||||
ui_public_servers = new AOButton(this, ao_app);
|
ui_public_servers = new AOButton(this, ao_app);
|
||||||
ui_favorites = new AOButton(this, ao_app);
|
ui_favorites = new AOButton(this, ao_app);
|
||||||
ui_refresh = new AOButton(this, ao_app);
|
ui_refresh = new AOButton(this, ao_app);
|
||||||
ui_add_to_fav = new AOButton(this, ao_app);
|
ui_add_to_fav = new AOButton(this, ao_app);
|
||||||
ui_connect = new AOButton(this, ao_app);
|
ui_connect = new AOButton(this, ao_app);
|
||||||
ui_version = new QLabel(this);
|
ui_version = new QLabel(this);
|
||||||
ui_about = new AOButton(this, ao_app);
|
ui_about = new AOButton(this, ao_app);
|
||||||
ui_server_list = new QListWidget(this);
|
ui_settings = new AOButton(this, ao_app);
|
||||||
ui_player_count = new QLabel(this);
|
|
||||||
ui_description = new AOTextArea(this);
|
ui_server_list = new QTreeWidget(this);
|
||||||
ui_chatbox = new AOTextArea(this);
|
ui_server_list->setHeaderLabels({"#", "Name"}); //, "Players"});
|
||||||
ui_chatbox->setOpenExternalLinks(true);
|
ui_server_list->hideColumn(0);
|
||||||
ui_chatname = new QLineEdit(this);
|
|
||||||
ui_chatname->setPlaceholderText(tr("Name"));
|
ui_server_search = new QLineEdit(this);
|
||||||
ui_chatname->setText(ao_app->get_ooc_name());
|
ui_server_search->setFrame(false);
|
||||||
ui_chatmessage = new QLineEdit(this);
|
ui_server_search->setPlaceholderText(tr("Search"));
|
||||||
ui_loading_background = new AOImage(this, ao_app);
|
|
||||||
ui_loading_text = new QTextEdit(ui_loading_background);
|
ui_player_count = new QLabel(this);
|
||||||
ui_progress_bar = new QProgressBar(ui_loading_background);
|
ui_description = new AOTextArea(this);
|
||||||
ui_progress_bar->setMinimum(0);
|
ui_description->setOpenExternalLinks(true);
|
||||||
ui_progress_bar->setMaximum(100);
|
ui_chatbox = new AOTextArea(this);
|
||||||
ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
|
ui_chatbox->setOpenExternalLinks(true);
|
||||||
ui_cancel = new AOButton(ui_loading_background, ao_app);
|
ui_chatname = new QLineEdit(this);
|
||||||
|
ui_chatname->setPlaceholderText(tr("Name"));
|
||||||
connect(ui_public_servers, SIGNAL(clicked()), this,
|
ui_chatname->setText(ao_app->get_ooc_name());
|
||||||
SLOT(on_public_servers_clicked()));
|
ui_chatmessage = new QLineEdit(this);
|
||||||
connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
|
ui_loading_background = new AOImage(this, ao_app);
|
||||||
connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
|
ui_loading_text = new QTextEdit(ui_loading_background);
|
||||||
connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
|
ui_progress_bar = new QProgressBar(ui_loading_background);
|
||||||
connect(ui_add_to_fav, SIGNAL(pressed()), this,
|
ui_progress_bar->setMinimum(0);
|
||||||
SLOT(on_add_to_fav_pressed()));
|
ui_progress_bar->setMaximum(100);
|
||||||
connect(ui_add_to_fav, SIGNAL(released()), this,
|
ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
|
||||||
SLOT(on_add_to_fav_released()));
|
ui_cancel = new AOButton(ui_loading_background, ao_app);
|
||||||
connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed()));
|
|
||||||
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
|
connect(ui_public_servers, SIGNAL(clicked()), this,
|
||||||
connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
|
SLOT(on_public_servers_clicked()));
|
||||||
connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this,
|
connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
|
||||||
SLOT(on_server_list_clicked(QModelIndex)));
|
connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
|
||||||
connect(ui_server_list, SIGNAL(activated(QModelIndex)), this,
|
connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
|
||||||
SLOT(on_server_list_doubleclicked(QModelIndex)));
|
connect(ui_add_to_fav, SIGNAL(pressed()), this,
|
||||||
connect(ui_chatmessage, SIGNAL(returnPressed()), this,
|
SLOT(on_add_to_fav_pressed()));
|
||||||
SLOT(on_chatfield_return_pressed()));
|
connect(ui_add_to_fav, SIGNAL(released()), this,
|
||||||
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
|
SLOT(on_add_to_fav_released()));
|
||||||
|
connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed()));
|
||||||
ui_connect->setEnabled(false);
|
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
|
||||||
|
connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
|
||||||
list_servers();
|
connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked()));
|
||||||
|
connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
|
||||||
set_widgets();
|
SLOT(on_server_list_clicked(QTreeWidgetItem *, int)));
|
||||||
}
|
connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
|
||||||
|
this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem *, int)));
|
||||||
// sets images, position and size
|
connect(ui_server_search, SIGNAL(textChanged(QString)), this,
|
||||||
void Lobby::set_widgets()
|
SLOT(on_server_search_edited(QString)));
|
||||||
{
|
connect(ui_chatmessage, SIGNAL(returnPressed()), this,
|
||||||
ao_app->reload_theme();
|
SLOT(on_chatfield_return_pressed()));
|
||||||
|
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
|
||||||
QString filename = "lobby_design.ini";
|
|
||||||
|
ui_connect->setEnabled(false);
|
||||||
pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
|
|
||||||
|
list_servers();
|
||||||
if (f_lobby.width < 0 || f_lobby.height < 0) {
|
|
||||||
qDebug() << "W: did not find lobby width or height in "
|
set_widgets();
|
||||||
<< ao_app->get_theme_path(filename);
|
}
|
||||||
|
|
||||||
// Most common symptom of bad config files and missing assets.
|
// sets images, position and size
|
||||||
call_notice(
|
void Lobby::set_widgets()
|
||||||
tr("It doesn't look like your client is set up correctly.\n"
|
{
|
||||||
"Did you download all resources correctly from tiny.cc/getao, "
|
ao_app->reload_theme();
|
||||||
"including the large 'base' folder?"));
|
|
||||||
|
QString filename = "lobby_design.ini";
|
||||||
this->resize(517, 666);
|
|
||||||
}
|
pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
|
||||||
else {
|
|
||||||
this->resize(f_lobby.width, f_lobby.height);
|
if (f_lobby.width < 0 || f_lobby.height < 0) {
|
||||||
}
|
qDebug() << "W: did not find lobby width or height in " << filename;
|
||||||
|
|
||||||
set_size_and_pos(ui_background, "lobby");
|
// Most common symptom of bad config files and missing assets.
|
||||||
ui_background->set_image("lobbybackground.png");
|
call_notice(
|
||||||
|
tr("It doesn't look like your client is set up correctly.\n"
|
||||||
set_size_and_pos(ui_public_servers, "public_servers");
|
"Did you download all resources correctly from tiny.cc/getao, "
|
||||||
ui_public_servers->set_image("publicservers_selected.png");
|
"including the large 'base' folder?"));
|
||||||
|
|
||||||
set_size_and_pos(ui_favorites, "favorites");
|
this->resize(517, 666);
|
||||||
ui_favorites->set_image("favorites.png");
|
}
|
||||||
|
else {
|
||||||
set_size_and_pos(ui_refresh, "refresh");
|
this->resize(f_lobby.width, f_lobby.height);
|
||||||
ui_refresh->set_image("refresh.png");
|
}
|
||||||
|
|
||||||
set_size_and_pos(ui_add_to_fav, "add_to_fav");
|
set_size_and_pos(ui_background, "lobby");
|
||||||
ui_add_to_fav->set_image("addtofav.png");
|
ui_background->set_image("lobbybackground");
|
||||||
|
|
||||||
set_size_and_pos(ui_connect, "connect");
|
set_size_and_pos(ui_public_servers, "public_servers");
|
||||||
ui_connect->set_image("connect.png");
|
ui_public_servers->set_image("publicservers_selected");
|
||||||
|
|
||||||
set_size_and_pos(ui_version, "version");
|
set_size_and_pos(ui_favorites, "favorites");
|
||||||
ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string()));
|
ui_favorites->set_image("favorites");
|
||||||
|
|
||||||
set_size_and_pos(ui_about, "about");
|
set_size_and_pos(ui_refresh, "refresh");
|
||||||
ui_about->set_image("about.png");
|
ui_refresh->set_image("refresh");
|
||||||
|
|
||||||
set_size_and_pos(ui_server_list, "server_list");
|
set_size_and_pos(ui_add_to_fav, "add_to_fav");
|
||||||
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_add_to_fav->set_image("addtofav");
|
||||||
"font: bold;");
|
|
||||||
|
set_size_and_pos(ui_connect, "connect");
|
||||||
set_size_and_pos(ui_player_count, "player_count");
|
ui_connect->set_image("connect");
|
||||||
ui_player_count->setText(tr("Offline"));
|
|
||||||
ui_player_count->setStyleSheet("font: bold;"
|
set_size_and_pos(ui_version, "version");
|
||||||
"color: white;"
|
ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string()));
|
||||||
"qproperty-alignment: AlignCenter;");
|
|
||||||
|
set_size_and_pos(ui_about, "about");
|
||||||
set_size_and_pos(ui_description, "description");
|
ui_about->set_image("about");
|
||||||
ui_description->setReadOnly(true);
|
|
||||||
ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
set_size_and_pos(ui_settings, "settings");
|
||||||
"color: white;");
|
ui_settings->setText(tr("Settings"));
|
||||||
|
ui_settings->set_image("settings");
|
||||||
set_size_and_pos(ui_chatbox, "chatbox");
|
ui_settings->setToolTip(
|
||||||
ui_chatbox->setReadOnly(true);
|
tr("Allows you to change various aspects of the client."));
|
||||||
ui_chatbox->setStyleSheet(
|
|
||||||
"QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
|
set_size_and_pos(ui_server_list, "server_list");
|
||||||
|
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
set_size_and_pos(ui_chatname, "chatname");
|
"font: bold;");
|
||||||
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
|
||||||
"selection-background-color: rgba(0, 0, 0, 0);");
|
set_size_and_pos(ui_server_search, "server_search");
|
||||||
|
ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||||
set_size_and_pos(ui_chatmessage, "chatmessage");
|
|
||||||
ui_chatmessage->setStyleSheet(
|
set_size_and_pos(ui_player_count, "player_count");
|
||||||
"background-color: rgba(0, 0, 0, 0);"
|
ui_player_count->setText(tr("Offline"));
|
||||||
"selection-background-color: rgba(0, 0, 0, 0);");
|
ui_player_count->setStyleSheet("font: bold;"
|
||||||
|
"color: white;"
|
||||||
ui_loading_background->resize(this->width(), this->height());
|
"qproperty-alignment: AlignCenter;");
|
||||||
ui_loading_background->set_image("loadingbackground.png");
|
|
||||||
|
set_size_and_pos(ui_description, "description");
|
||||||
set_size_and_pos(ui_loading_text, "loading_label");
|
ui_description->setReadOnly(true);
|
||||||
ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
|
ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
ui_loading_text->setReadOnly(true);
|
"color: white;");
|
||||||
ui_loading_text->setAlignment(Qt::AlignCenter);
|
|
||||||
ui_loading_text->setFrameStyle(QFrame::NoFrame);
|
set_size_and_pos(ui_chatbox, "chatbox");
|
||||||
ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_chatbox->setReadOnly(true);
|
||||||
"color: rgba(255, 128, 0, 255);");
|
ui_chatbox->setStyleSheet(
|
||||||
ui_loading_text->append(tr("Loading"));
|
"QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
|
||||||
|
|
||||||
set_size_and_pos(ui_progress_bar, "progress_bar");
|
set_size_and_pos(ui_chatname, "chatname");
|
||||||
set_size_and_pos(ui_cancel, "cancel");
|
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
ui_cancel->setText(tr("Cancel"));
|
"selection-background-color: rgba(0, 0, 0, 0);");
|
||||||
|
|
||||||
ui_loading_background->hide();
|
set_size_and_pos(ui_chatmessage, "chatmessage");
|
||||||
}
|
ui_chatmessage->setStyleSheet(
|
||||||
|
"background-color: rgba(0, 0, 0, 0);"
|
||||||
void Lobby::lobbyThreadHandler(QString loadingText)
|
"selection-background-color: rgba(0, 0, 0, 0);");
|
||||||
{
|
|
||||||
this->set_loading_text(loadingText);
|
ui_loading_background->resize(this->width(), this->height());
|
||||||
}
|
ui_loading_background->set_image("loadingbackground");
|
||||||
|
|
||||||
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
|
set_size_and_pos(ui_loading_text, "loading_label");
|
||||||
{
|
ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
|
||||||
QString filename = "lobby_design.ini";
|
ui_loading_text->setReadOnly(true);
|
||||||
|
ui_loading_text->setAlignment(Qt::AlignCenter);
|
||||||
pos_size_type design_ini_result =
|
ui_loading_text->setFrameStyle(QFrame::NoFrame);
|
||||||
ao_app->get_element_dimensions(p_identifier, filename);
|
ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
|
"color: rgba(255, 128, 0, 255);");
|
||||||
if (design_ini_result.width < 0 || design_ini_result.height < 0) {
|
ui_loading_text->append(tr("Loading"));
|
||||||
qDebug() << "W: could not find " << p_identifier << " in " << filename;
|
|
||||||
p_widget->hide();
|
set_size_and_pos(ui_progress_bar, "progress_bar");
|
||||||
}
|
set_size_and_pos(ui_cancel, "cancel");
|
||||||
else {
|
ui_cancel->setText(tr("Cancel"));
|
||||||
p_widget->move(design_ini_result.x, design_ini_result.y);
|
|
||||||
p_widget->resize(design_ini_result.width, design_ini_result.height);
|
ui_loading_background->hide();
|
||||||
}
|
|
||||||
}
|
set_fonts();
|
||||||
|
set_stylesheets();
|
||||||
void Lobby::set_loading_text(QString p_text)
|
}
|
||||||
{
|
|
||||||
ui_loading_text->clear();
|
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
|
||||||
ui_loading_text->setAlignment(Qt::AlignCenter);
|
{
|
||||||
ui_loading_text->append(p_text);
|
QString filename = "lobby_design.ini";
|
||||||
}
|
|
||||||
|
pos_size_type design_ini_result =
|
||||||
QString Lobby::get_chatlog()
|
ao_app->get_element_dimensions(p_identifier, filename);
|
||||||
{
|
|
||||||
QString return_value = ui_chatbox->toPlainText();
|
if (design_ini_result.width < 0 || design_ini_result.height < 0) {
|
||||||
|
qDebug() << "W: could not find " << p_identifier << " in " << filename;
|
||||||
return return_value;
|
p_widget->hide();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
int Lobby::get_selected_server() { return ui_server_list->currentRow(); }
|
p_widget->move(design_ini_result.x, design_ini_result.y);
|
||||||
|
p_widget->resize(design_ini_result.width, design_ini_result.height);
|
||||||
void Lobby::set_loading_value(int p_value)
|
}
|
||||||
{
|
}
|
||||||
ui_progress_bar->setValue(p_value);
|
|
||||||
}
|
void Lobby::set_fonts()
|
||||||
|
{
|
||||||
void Lobby::on_public_servers_clicked()
|
set_font(ui_player_count, "player_count");
|
||||||
{
|
set_font(ui_description, "description");
|
||||||
ui_public_servers->set_image("publicservers_selected.png");
|
set_font(ui_chatbox, "chatbox");
|
||||||
ui_favorites->set_image("favorites.png");
|
set_font(ui_chatname, "chatname");
|
||||||
|
set_font(ui_chatmessage, "chatmessage");
|
||||||
list_servers();
|
set_font(ui_loading_text, "loading_text");
|
||||||
|
set_font(ui_server_list, "server_list");
|
||||||
public_servers_selected = true;
|
}
|
||||||
}
|
|
||||||
|
void Lobby::set_stylesheet(QWidget *widget, QString target_tag)
|
||||||
void Lobby::on_favorites_clicked()
|
{
|
||||||
{
|
QString f_file = "lobby_stylesheets.css";
|
||||||
ui_favorites->set_image("favorites_selected.png");
|
QString style_sheet_string =
|
||||||
ui_public_servers->set_image("publicservers.png");
|
ao_app->get_tagged_stylesheet(target_tag, f_file);
|
||||||
|
if (style_sheet_string != "")
|
||||||
ao_app->set_favorite_list();
|
widget->setStyleSheet(style_sheet_string);
|
||||||
// ao_app->favorite_list = read_serverlist_txt();
|
}
|
||||||
|
|
||||||
list_favorites();
|
void Lobby::set_stylesheets()
|
||||||
|
{
|
||||||
public_servers_selected = false;
|
set_stylesheet(ui_player_count, "[PLAYER COUNT]");
|
||||||
}
|
set_stylesheet(ui_description, "[DESCRIPTION]");
|
||||||
|
set_stylesheet(ui_chatbox, "[CHAT BOX]");
|
||||||
void Lobby::on_refresh_pressed()
|
set_stylesheet(ui_chatname, "[CHAT NAME]");
|
||||||
{
|
set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]");
|
||||||
ui_refresh->set_image("refresh_pressed.png");
|
set_stylesheet(ui_loading_text, "[LOADING TEXT]");
|
||||||
}
|
set_stylesheet(ui_server_list, "[SERVER LIST]");
|
||||||
|
}
|
||||||
void Lobby::on_refresh_released()
|
|
||||||
{
|
void Lobby::set_font(QWidget *widget, QString p_identifier)
|
||||||
ui_refresh->set_image("refresh.png");
|
{
|
||||||
|
QString design_file = "lobby_fonts.ini";
|
||||||
AOPacket *f_packet = new AOPacket("ALL#%");
|
int f_weight = ao_app->get_font_size(p_identifier, design_file);
|
||||||
|
QString class_name = widget->metaObject()->className();
|
||||||
ao_app->send_ms_packet(f_packet);
|
QString font_name =
|
||||||
}
|
ao_app->get_font_name(p_identifier + "_font", design_file);
|
||||||
|
QFont font(font_name, f_weight);
|
||||||
void Lobby::on_add_to_fav_pressed()
|
bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1;
|
||||||
{
|
if (use) {
|
||||||
ui_add_to_fav->set_image("addtofav_pressed.png");
|
bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) ==
|
||||||
}
|
1; // is the font bold or not?
|
||||||
|
font.setBold(bold);
|
||||||
void Lobby::on_add_to_fav_released()
|
widget->setFont(font);
|
||||||
{
|
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
|
||||||
ui_add_to_fav->set_image("addtofav.png");
|
bool center =
|
||||||
|
ao_app->get_font_size(p_identifier + "_center", design_file) ==
|
||||||
// you cant add favorites from favorites m8
|
1; // should it be centered?
|
||||||
if (!public_servers_selected)
|
QString is_center = "";
|
||||||
return;
|
if (center)
|
||||||
|
is_center = "qproperty-alignment: AlignCenter;";
|
||||||
ao_app->add_favorite_server(ui_server_list->currentRow());
|
QString style_sheet_string =
|
||||||
}
|
class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
|
||||||
|
"color: rgba(" + QString::number(f_color.red()) + ", " +
|
||||||
void Lobby::on_connect_pressed()
|
QString::number(f_color.green()) + ", " +
|
||||||
{
|
QString::number(f_color.blue()) + ", 255);\n" + is_center + "}";
|
||||||
ui_connect->set_image("connect_pressed.png");
|
widget->setStyleSheet(style_sheet_string);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
void Lobby::on_connect_released()
|
}
|
||||||
{
|
|
||||||
ui_connect->set_image("connect.png");
|
void Lobby::set_loading_text(QString p_text)
|
||||||
|
{
|
||||||
AOPacket *f_packet;
|
ui_loading_text->clear();
|
||||||
|
ui_loading_text->setAlignment(Qt::AlignCenter);
|
||||||
f_packet = new AOPacket("askchaa#%");
|
ui_loading_text->append(p_text);
|
||||||
|
}
|
||||||
ao_app->send_server_packet(f_packet);
|
|
||||||
}
|
QString Lobby::get_chatlog()
|
||||||
|
{
|
||||||
void Lobby::on_about_clicked()
|
QString return_value = ui_chatbox->toPlainText();
|
||||||
{
|
|
||||||
QString msg =
|
return return_value;
|
||||||
tr("<h2>Attorney Online %1</h2>"
|
}
|
||||||
"The courtroom drama simulator"
|
|
||||||
"<p><b>Source code:</b> "
|
int Lobby::get_selected_server()
|
||||||
"<a href='https://github.com/AttorneyOnline/AO2-Client'>"
|
{
|
||||||
"https://github.com/AttorneyOnline/AO2-Client</a>"
|
return ui_server_list->currentItem()->text(0).toInt();
|
||||||
"<p><b>Major development:</b><br>"
|
}
|
||||||
"OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, "
|
|
||||||
"Cents02"
|
void Lobby::set_loading_value(int p_value)
|
||||||
"<p><b>Special thanks:</b><br>"
|
{
|
||||||
"Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
|
ui_progress_bar->setValue(p_value);
|
||||||
"Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
|
}
|
||||||
"Noevain, Cronnicossy, Raidensnake")
|
|
||||||
.arg(ao_app->get_version_string());
|
void Lobby::on_public_servers_clicked()
|
||||||
QMessageBox::about(this, "About", msg);
|
{
|
||||||
}
|
ui_public_servers->set_image("publicservers_selected");
|
||||||
|
ui_favorites->set_image("favorites");
|
||||||
// clicked on an item in the serverlist
|
|
||||||
void Lobby::on_server_list_clicked(QModelIndex p_model)
|
list_servers();
|
||||||
{
|
|
||||||
if (p_model != last_model) {
|
public_servers_selected = true;
|
||||||
server_type f_server;
|
}
|
||||||
last_model = p_model;
|
|
||||||
int n_server = p_model.row();
|
void Lobby::on_favorites_clicked()
|
||||||
|
{
|
||||||
if (n_server < 0)
|
ui_favorites->set_image("favorites_selected");
|
||||||
return;
|
ui_public_servers->set_image("publicservers");
|
||||||
|
|
||||||
if (public_servers_selected) {
|
ao_app->set_favorite_list();
|
||||||
QVector<server_type> f_server_list = ao_app->get_server_list();
|
// ao_app->favorite_list = read_serverlist_txt();
|
||||||
|
|
||||||
if (n_server >= f_server_list.size())
|
list_favorites();
|
||||||
return;
|
|
||||||
|
public_servers_selected = false;
|
||||||
f_server = f_server_list.at(p_model.row());
|
}
|
||||||
}
|
|
||||||
else {
|
void Lobby::on_refresh_pressed() { ui_refresh->set_image("refresh_pressed"); }
|
||||||
if (n_server >= ao_app->get_favorite_list().size())
|
|
||||||
return;
|
void Lobby::on_refresh_released()
|
||||||
|
{
|
||||||
f_server = ao_app->get_favorite_list().at(p_model.row());
|
ui_refresh->set_image("refresh");
|
||||||
}
|
|
||||||
|
AOPacket *f_packet = new AOPacket("ALL#%");
|
||||||
ui_description->clear();
|
|
||||||
ui_description->append(f_server.desc);
|
ao_app->send_ms_packet(f_packet);
|
||||||
|
}
|
||||||
ui_description->moveCursor(QTextCursor::Start);
|
|
||||||
ui_description->ensureCursorVisible();
|
void Lobby::on_add_to_fav_pressed()
|
||||||
|
{
|
||||||
ui_player_count->setText(tr("Offline"));
|
ui_add_to_fav->set_image("addtofav_pressed");
|
||||||
|
}
|
||||||
ui_connect->setEnabled(false);
|
|
||||||
|
void Lobby::on_add_to_fav_released()
|
||||||
ao_app->net_manager->connect_to_server(f_server);
|
{
|
||||||
}
|
ui_add_to_fav->set_image("addtofav");
|
||||||
}
|
|
||||||
|
// you cant add favorites from favorites m8
|
||||||
// doubleclicked on an item in the serverlist so we'll connect right away
|
if (!public_servers_selected)
|
||||||
void Lobby::on_server_list_doubleclicked(QModelIndex p_model)
|
return;
|
||||||
{
|
|
||||||
on_server_list_clicked(p_model);
|
ao_app->add_favorite_server(get_selected_server());
|
||||||
on_connect_released();
|
}
|
||||||
}
|
|
||||||
|
void Lobby::on_connect_pressed() { ui_connect->set_image("connect_pressed"); }
|
||||||
void Lobby::on_chatfield_return_pressed()
|
|
||||||
{
|
void Lobby::on_connect_released()
|
||||||
// no you can't send empty messages
|
{
|
||||||
if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
|
ui_connect->set_image("connect");
|
||||||
return;
|
|
||||||
|
AOPacket *f_packet;
|
||||||
QString f_header = "CT";
|
|
||||||
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
|
f_packet = new AOPacket("askchaa#%");
|
||||||
|
|
||||||
AOPacket *f_packet = new AOPacket(f_header, f_contents);
|
ao_app->send_server_packet(f_packet);
|
||||||
|
}
|
||||||
ao_app->send_ms_packet(f_packet);
|
|
||||||
|
void Lobby::on_about_clicked()
|
||||||
ui_chatmessage->clear();
|
{
|
||||||
}
|
#ifdef BASSAUDIO
|
||||||
|
const QString audio = "BASS";
|
||||||
void Lobby::list_servers()
|
#elif defined(QTAUDIO)
|
||||||
{
|
const QString audio = "Qt Multimedia";
|
||||||
public_servers_selected = true;
|
#else
|
||||||
ui_favorites->set_image("favorites.png");
|
const QString audio = "null";
|
||||||
ui_public_servers->set_image("publicservers_selected.png");
|
#endif
|
||||||
|
|
||||||
ui_server_list->clear();
|
QString msg =
|
||||||
|
tr("<h2>Attorney Online %1</h2>"
|
||||||
for (server_type i_server : ao_app->get_server_list()) {
|
"The courtroom drama simulator"
|
||||||
ui_server_list->addItem(i_server.name);
|
"<p><b>Source code:</b> "
|
||||||
}
|
"<a href='https://github.com/AttorneyOnline/AO2-Client'>"
|
||||||
}
|
"https://github.com/AttorneyOnline/AO2-Client</a>"
|
||||||
|
"<p><b>Major development:</b><br>"
|
||||||
void Lobby::list_favorites()
|
"OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, "
|
||||||
{
|
"Crystalwarrior, Iamgoofball"
|
||||||
ui_server_list->clear();
|
"<p><b>Client development:</b><br>"
|
||||||
|
"Cents02, in1tiate, raidensnake, windrammer"
|
||||||
for (server_type i_server : ao_app->get_favorite_list()) {
|
"<p><b>QA testing:</b><br>"
|
||||||
ui_server_list->addItem(i_server.name);
|
"CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, "
|
||||||
}
|
"Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, "
|
||||||
}
|
"Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, "
|
||||||
|
"Veritas, Wiso"
|
||||||
void Lobby::append_chatmessage(QString f_name, QString f_message)
|
"<p><b>Special thanks:</b><br>"
|
||||||
{
|
"CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); "
|
||||||
ui_chatbox->append_chatmessage(
|
"Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); "
|
||||||
f_name, f_message,
|
"Rue (website); Draxirch (UI design); "
|
||||||
ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(),
|
"Lewdton and Argoneus (tsuserver); "
|
||||||
false);
|
"Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); "
|
||||||
}
|
"server hosts, game masters, case makers, content creators, "
|
||||||
|
"and the whole AO2 community!"
|
||||||
void Lobby::append_error(QString f_message)
|
"<p>The Attorney Online networked visual novel project "
|
||||||
{
|
"is copyright (c) 2016-2020 Attorney Online developers. Open-source "
|
||||||
ui_chatbox->append_error(f_message);
|
"licenses apply. All other assets are the property of their "
|
||||||
}
|
"respective owners."
|
||||||
|
"<p>Running on Qt version %2 with the %3 audio engine."
|
||||||
void Lobby::set_player_count(int players_online, int max_players)
|
"<p>Built on %4")
|
||||||
{
|
.arg(ao_app->get_version_string())
|
||||||
QString f_string = tr("Online: %1/%2")
|
.arg(QLatin1String(QT_VERSION_STR))
|
||||||
.arg(QString::number(players_online))
|
.arg(audio)
|
||||||
.arg(QString::number(max_players));
|
.arg(QLatin1String(__DATE__));
|
||||||
ui_player_count->setText(f_string);
|
QMessageBox::about(this, tr("About"), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
|
void Lobby::on_settings_clicked() { ao_app->call_settings_menu(); }
|
||||||
|
|
||||||
Lobby::~Lobby() {}
|
// clicked on an item in the serverlist
|
||||||
|
void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column)
|
||||||
|
{
|
||||||
|
column = 0;
|
||||||
|
if (p_item->text(column).toInt() != last_index || !public_servers_selected) {
|
||||||
|
server_type f_server;
|
||||||
|
int n_server = p_item->text(column).toInt();
|
||||||
|
last_index = n_server;
|
||||||
|
|
||||||
|
if (n_server < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (public_servers_selected) {
|
||||||
|
QVector<server_type> f_server_list = ao_app->get_server_list();
|
||||||
|
|
||||||
|
if (n_server >= f_server_list.size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
f_server = f_server_list.at(n_server);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (n_server >= ao_app->get_favorite_list().size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
f_server = ao_app->get_favorite_list().at(n_server);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_description->clear();
|
||||||
|
ui_description->append_linked(f_server.desc);
|
||||||
|
|
||||||
|
ui_description->moveCursor(QTextCursor::Start);
|
||||||
|
ui_description->ensureCursorVisible();
|
||||||
|
|
||||||
|
ui_player_count->setText(tr("Offline"));
|
||||||
|
|
||||||
|
ui_connect->setEnabled(false);
|
||||||
|
|
||||||
|
ao_app->net_manager->connect_to_server(f_server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// doubleclicked on an item in the serverlist so we'll connect right away
|
||||||
|
void Lobby::on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column)
|
||||||
|
{
|
||||||
|
on_server_list_clicked(p_item, column);
|
||||||
|
on_connect_released();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::on_server_search_edited(QString p_text)
|
||||||
|
{
|
||||||
|
// Iterate through all QTreeWidgetItem items
|
||||||
|
QTreeWidgetItemIterator it(ui_server_list);
|
||||||
|
while (*it) {
|
||||||
|
(*it)->setHidden(p_text != "");
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_text != "") {
|
||||||
|
// Search in metadata
|
||||||
|
QList<QTreeWidgetItem *> clist = ui_server_list->findItems(
|
||||||
|
ui_server_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1);
|
||||||
|
foreach (QTreeWidgetItem *item, clist) {
|
||||||
|
if (item->parent() != nullptr) // So the category shows up too
|
||||||
|
item->parent()->setHidden(false);
|
||||||
|
item->setHidden(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::on_chatfield_return_pressed()
|
||||||
|
{
|
||||||
|
// no you can't send empty messages
|
||||||
|
if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString f_header = "CT";
|
||||||
|
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
|
||||||
|
|
||||||
|
AOPacket *f_packet = new AOPacket(f_header, f_contents);
|
||||||
|
|
||||||
|
ao_app->send_ms_packet(f_packet);
|
||||||
|
|
||||||
|
ui_chatmessage->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::list_servers()
|
||||||
|
{
|
||||||
|
public_servers_selected = true;
|
||||||
|
ui_favorites->set_image("favorites");
|
||||||
|
ui_public_servers->set_image("publicservers_selected");
|
||||||
|
|
||||||
|
ui_server_list->setSortingEnabled(false);
|
||||||
|
ui_server_list->clear();
|
||||||
|
|
||||||
|
ui_server_search->setText("");
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (server_type i_server : ao_app->get_server_list()) {
|
||||||
|
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list);
|
||||||
|
treeItem->setData(0, Qt::DisplayRole, i);
|
||||||
|
treeItem->setText(1, i_server.name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ui_server_list->setSortingEnabled(true);
|
||||||
|
ui_server_list->sortItems(0, Qt::SortOrder::AscendingOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::list_favorites()
|
||||||
|
{
|
||||||
|
ui_server_list->setSortingEnabled(false);
|
||||||
|
ui_server_list->clear();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (server_type i_server : ao_app->get_favorite_list()) {
|
||||||
|
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list);
|
||||||
|
treeItem->setData(0, Qt::DisplayRole, i);
|
||||||
|
treeItem->setText(1, i_server.name);
|
||||||
|
// treeItem->setText(2, "-");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ui_server_list->setSortingEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::append_chatmessage(QString f_name, QString f_message)
|
||||||
|
{
|
||||||
|
ui_chatbox->append_chatmessage(
|
||||||
|
f_name, f_message,
|
||||||
|
ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::append_error(QString f_message)
|
||||||
|
{
|
||||||
|
ui_chatbox->append_error(f_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::set_player_count(int players_online, int max_players)
|
||||||
|
{
|
||||||
|
QString f_string = tr("Online: %1/%2")
|
||||||
|
.arg(QString::number(players_online))
|
||||||
|
.arg(QString::number(max_players));
|
||||||
|
ui_player_count->setText(f_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
|
||||||
|
|
||||||
|
Lobby::~Lobby() {}
|
||||||
|
11
src/main.cpp
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
@ -22,6 +23,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QSettings *configini = main_app.configini;
|
QSettings *configini = main_app.configini;
|
||||||
|
|
||||||
|
QPluginLoader apngPlugin("qapng");
|
||||||
|
if (!apngPlugin.load())
|
||||||
|
qCritical() << "QApng plugin could not be loaded";
|
||||||
|
|
||||||
|
QPluginLoader webpPlugin("qwebp");
|
||||||
|
if (!webpPlugin.load())
|
||||||
|
qCritical() << "QWebp plugin could not be loaded";
|
||||||
|
|
||||||
QString p_language =
|
QString p_language =
|
||||||
configini->value("language", QLocale::system().name()).toString();
|
configini->value("language", QLocale::system().name()).toString();
|
||||||
if (p_language == " " || p_language == "")
|
if (p_language == " " || p_language == "")
|
||||||
@ -38,7 +47,7 @@ int main(int argc, char *argv[])
|
|||||||
main_app.installTranslator(&appTranslator);
|
main_app.installTranslator(&appTranslator);
|
||||||
|
|
||||||
main_app.construct_lobby();
|
main_app.construct_lobby();
|
||||||
main_app.w_lobby->show();
|
|
||||||
main_app.net_manager->connect_to_master();
|
main_app.net_manager->connect_to_master();
|
||||||
|
main_app.w_lobby->show();
|
||||||
return main_app.exec();
|
return main_app.exec();
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ QString AOApplication::get_base_path()
|
|||||||
QString external_storage = getenv("EXTERNAL_STORAGE");
|
QString external_storage = getenv("EXTERNAL_STORAGE");
|
||||||
base_path = external_storage + "/AO2/";
|
base_path = external_storage + "/AO2/";
|
||||||
}
|
}
|
||||||
#elif defined __APPLE__
|
#elif defined(__APPLE__)
|
||||||
base_path = applicationDirPath() + "/../../../base/";
|
base_path = applicationDirPath() + "/../../../base/";
|
||||||
#else
|
#else
|
||||||
base_path = applicationDirPath() + "/base/";
|
base_path = applicationDirPath() + "/base/";
|
||||||
@ -93,39 +93,11 @@ QString AOApplication::get_sounds_path(QString p_file)
|
|||||||
|
|
||||||
QString AOApplication::get_music_path(QString p_song)
|
QString AOApplication::get_music_path(QString p_song)
|
||||||
{
|
{
|
||||||
QString withending_check = get_base_path() + "sounds/music/" + p_song;
|
QString path = get_base_path() + "sounds/music/" + p_song;
|
||||||
QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
|
|
||||||
QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
|
|
||||||
if (p_song.startsWith("http")) {
|
|
||||||
//it's an URL
|
|
||||||
return p_song;
|
|
||||||
}
|
|
||||||
else if (file_exists(opus_check)) {
|
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
return opus_check;
|
return path;
|
||||||
#else
|
#else
|
||||||
return get_case_sensitive_path(opus_check);
|
return get_case_sensitive_path(path);
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (file_exists(mp3_check)) {
|
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
|
||||||
return mp3_check;
|
|
||||||
#else
|
|
||||||
return get_case_sensitive_path(mp3_check);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (file_exists(withending_check)) {
|
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
|
||||||
return withending_check;
|
|
||||||
#else
|
|
||||||
return get_case_sensitive_path(withending_check);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
|
||||||
return get_base_path() + "sounds/music/" + p_song + ".wav";
|
|
||||||
#else
|
|
||||||
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song +
|
|
||||||
".wav");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
135
src/scrolltext.cpp
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
#include "scrolltext.h"
|
||||||
|
|
||||||
|
ScrollText::ScrollText(QWidget *parent) : QWidget(parent), scrollPos(0)
|
||||||
|
{
|
||||||
|
staticText.setTextFormat(Qt::PlainText);
|
||||||
|
|
||||||
|
// setFixedHeight(fontMetrics().height()*2); //The theme sets this
|
||||||
|
leftMargin = height() / 3;
|
||||||
|
|
||||||
|
setSeparator(" --- ");
|
||||||
|
|
||||||
|
connect(&timer, SIGNAL(timeout()), this, SLOT(timer_timeout()));
|
||||||
|
timer.setInterval(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ScrollText::text() const { return _text; }
|
||||||
|
|
||||||
|
void ScrollText::setText(QString text)
|
||||||
|
{
|
||||||
|
_text = text;
|
||||||
|
updateText();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ScrollText::separator() const { return _separator; }
|
||||||
|
|
||||||
|
void ScrollText::setSeparator(QString separator)
|
||||||
|
{
|
||||||
|
_separator = separator;
|
||||||
|
updateText();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollText::updateText()
|
||||||
|
{
|
||||||
|
timer.stop();
|
||||||
|
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
|
||||||
|
singleTextWidth = fontMetrics().horizontalAdvance(_text);
|
||||||
|
#else
|
||||||
|
singleTextWidth = fontMetrics().boundingRect(_text).width();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
scrollEnabled = (singleTextWidth > width() - leftMargin * 2);
|
||||||
|
|
||||||
|
if (scrollEnabled) {
|
||||||
|
scrollPos = -64;
|
||||||
|
staticText.setText(_text + _separator);
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
staticText.setText(_text);
|
||||||
|
|
||||||
|
staticText.prepare(QTransform(), font());
|
||||||
|
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
|
||||||
|
wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()),
|
||||||
|
fontMetrics().height());
|
||||||
|
#else
|
||||||
|
wholeTextSize = QSize(fontMetrics().boundingRect(staticText.text()).width(),
|
||||||
|
fontMetrics().height());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollText::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QPainter p(this);
|
||||||
|
|
||||||
|
if (scrollEnabled) {
|
||||||
|
buffer.fill(qRgba(0, 0, 0, 0));
|
||||||
|
QPainter pb(&buffer);
|
||||||
|
pb.setPen(p.pen());
|
||||||
|
pb.setFont(p.font());
|
||||||
|
|
||||||
|
int x = qMin(-scrollPos, 0) + leftMargin;
|
||||||
|
while (x < width()) {
|
||||||
|
pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2),
|
||||||
|
staticText);
|
||||||
|
x += wholeTextSize.width();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply Alpha Channel
|
||||||
|
pb.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||||
|
pb.setClipRect(width() - 15, 0, 15, height());
|
||||||
|
pb.drawImage(0, 0, alphaChannel);
|
||||||
|
pb.setClipRect(0, 0, 15, height());
|
||||||
|
// initial situation: don't apply alpha channel in the left half of the
|
||||||
|
// image at all; apply it more and more until scrollPos gets positive
|
||||||
|
if (scrollPos < 0)
|
||||||
|
pb.setOpacity(static_cast<qreal>((qMax(-8, scrollPos) + 8) / 8.0));
|
||||||
|
pb.drawImage(0, 0, alphaChannel);
|
||||||
|
|
||||||
|
// pb.end();
|
||||||
|
p.drawImage(0, 0, buffer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.drawStaticText(
|
||||||
|
QPointF(leftMargin, (height() - wholeTextSize.height()) / 2),
|
||||||
|
staticText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollText::resizeEvent(QResizeEvent *)
|
||||||
|
{
|
||||||
|
// When the widget is resized, we need to update the alpha channel.
|
||||||
|
|
||||||
|
alphaChannel = QImage(size(), QImage::Format_ARGB32_Premultiplied);
|
||||||
|
buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied);
|
||||||
|
|
||||||
|
// Create Alpha Channel:
|
||||||
|
if (width() > 64) {
|
||||||
|
// create first scanline
|
||||||
|
QRgb *scanline1 = reinterpret_cast<QRgb *>(alphaChannel.scanLine(0));
|
||||||
|
for (int x = 1; x < 16; ++x)
|
||||||
|
scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4);
|
||||||
|
for (int x = 15; x < width() - 15; ++x)
|
||||||
|
scanline1[x] = qRgb(0, 0, 0);
|
||||||
|
// copy scanline to the other ones
|
||||||
|
for (int y = 1; y < height(); ++y)
|
||||||
|
memcpy(alphaChannel.scanLine(y), scanline1,
|
||||||
|
static_cast<uint>(width() * 4));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
alphaChannel.fill(qRgb(0, 0, 0));
|
||||||
|
|
||||||
|
// Update scrolling state
|
||||||
|
bool newScrollEnabled = (singleTextWidth > width() - leftMargin);
|
||||||
|
if (newScrollEnabled != scrollEnabled)
|
||||||
|
updateText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollText::timer_timeout()
|
||||||
|
{
|
||||||
|
scrollPos = (scrollPos + 2) % wholeTextSize.width();
|
||||||
|
update();
|
||||||
|
}
|