Fixed query visibility setting

This commit is contained in:
WolverinDEV 2019-02-17 12:51:42 +01:00
parent 525d2ceb29
commit fea3819024
4 changed files with 100 additions and 92 deletions

View file

@ -7,6 +7,7 @@
- Improved error handling within the codecs - Improved error handling within the codecs
- Fixed the vertical sliders for touch devices - Fixed the vertical sliders for touch devices
- Added an effect on slider select/move - Added an effect on slider select/move
- Fixed query visibility setting
* **15.02.19** * **15.02.19**
- Fixed MS Edge loading/document issues - Fixed MS Edge loading/document issues

View file

@ -907,14 +907,17 @@ class ConnectionCommandHandler {
} else { } else {
client = new ClientEntry(parseInt(json["clid"]), json["client_nickname"]); client = new ClientEntry(parseInt(json["clid"]), json["client_nickname"]);
} }
client.properties.client_type = parseInt(json["client_type"]);
client = tree.insertClient(client, channel); client = tree.insertClient(client, channel);
} else { } else {
if(client == this.connection._client.getClient()) if(client == this.connection._client.getClient())
chat.channelChat().name = channel.channelName(); chat.channelChat().name = channel.channelName();
tree.moveClient(client, channel); tree.moveClient(client, channel);
} }
const own_channel = this.connection._client.getClient().currentChannel();
if(this.connection._client.controlBar.query_visible || client.properties.client_type != ClientType.CLIENT_QUERY) {
const own_channel = this.connection._client.getClient().currentChannel();
if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) { if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) {
if(own_channel == channel) if(own_channel == channel)
if(old_channel) if(old_channel)
@ -950,6 +953,7 @@ class ConnectionCommandHandler {
} else { } else {
console.warn(tr("Unknown reasonid for %o"), json["reasonid"]); console.warn(tr("Unknown reasonid for %o"), json["reasonid"]);
} }
}
let updates: { let updates: {
key: string, key: string,
@ -995,11 +999,11 @@ class ConnectionCommandHandler {
return; return;
} }
if(this.connection._client.controlBar.query_visible || client.properties.client_type != ClientType.CLIENT_QUERY) {
const own_channel = this.connection._client.getClient().currentChannel(); const own_channel = this.connection._client.getClient().currentChannel();
let channel_from = tree.findChannel(json["cfid"]); let channel_from = tree.findChannel(json["cfid"]);
let channel_to = tree.findChannel(json["ctid"]); let channel_to = tree.findChannel(json["ctid"]);
if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) { if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) {
chat.serverChat().appendMessage(tr("{0} disappeared from {1} to {2}"), true, client.createChatTag(true), channel_from.generate_tag(true), channel_to.generate_tag(true)); chat.serverChat().appendMessage(tr("{0} disappeared from {1} to {2}"), true, client.createChatTag(true), channel_from.generate_tag(true), channel_to.generate_tag(true));
@ -1048,6 +1052,7 @@ class ConnectionCommandHandler {
} else { } else {
console.error(tr("Unknown client left reason!")); console.error(tr("Unknown client left reason!"));
} }
}
tree.deleteClient(client); tree.deleteClient(client);
} }

View file

@ -96,9 +96,9 @@ class ControlBar {
} }
//Need an initialise //Need an initialise
this.muteInput = settings.global("mute_input") == "1"; this.muteInput = settings.static_global("mute_input", false);
this.muteOutput = settings.global("mute_output") == "1"; this.muteOutput = settings.static_global("mute_output", false);
this.query_visibility = settings.global("show_server_queries") == "1"; this.query_visible = settings.static_global("show_server_queries", false);
} }
@ -412,21 +412,22 @@ class ControlBar {
Modals.spawnBookmarkModal(); Modals.spawnBookmarkModal();
} }
get query_visibility() { get query_visible() {
return this._query_visible; return this._query_visible;
} }
set query_visibility(flag: boolean) { set query_visible(flag: boolean) {
console.error(flag);
if(this._query_visible == flag) return; if(this._query_visible == flag) return;
this._query_visible = flag; this._query_visible = flag;
settings.global("show_server_queries", flag); settings.changeGlobal("show_server_queries", flag);
this.update_query_visibility_button(); this.update_query_visibility_button();
this.handle.channelTree.toggle_server_queries(flag); this.handle.channelTree.toggle_server_queries(flag);
} }
private on_query_visibility_toggle() { private on_query_visibility_toggle() {
this.query_visibility = !this._query_visible; this.query_visible = !this._query_visible;
this.update_query_visibility_button(); this.update_query_visibility_button();
} }

View file

@ -295,15 +295,17 @@ class ChannelTree {
else else
this.clients.push(client); this.clients.push(client);
if(!this._show_queries && client.properties.client_type == ClientType.CLIENT_QUERY)
client.tag.hide();
client.channelTree = this; client.channelTree = this;
client["_channel"] = channel; client["_channel"] = channel;
let tag = client.tag; let tag = client.tag;
if(!this._tree_detached)
tag.css({display: "none"}).fadeIn("slow");
if(!this._show_queries && client.properties.client_type == ClientType.CLIENT_QUERY)
client.tag.hide();
else if(!this._tree_detached)
tag.css("display", "none").fadeIn("slow");
tag.appendTo(channel.clientTag()); tag.appendTo(channel.clientTag());
client.currentChannel().reorderClients(); client.currentChannel().reorderClients();
@ -730,7 +732,6 @@ class ChannelTree {
if(this._show_queries == flag) return; if(this._show_queries == flag) return;
this._show_queries = flag; this._show_queries = flag;
//FIXME resize channels
const channels: ChannelEntry[] = [] const channels: ChannelEntry[] = []
for(const client of this.clients) for(const client of this.clients)
if(client.properties.client_type == ClientType.CLIENT_QUERY) { if(client.properties.client_type == ClientType.CLIENT_QUERY) {