// File: /workspace/github_cpp_makefile_star2_O2/Stygain[P]bandwidth-monitor/src/settingsWindow.cpp
// Function: SettingsWindow::Selected()
SettingsWindowSelection SettingsWindow::Selected()
{
	if (this->activeItem != -1)
	{
		if (this->activeItem < settings->root["hiddenInterfaces"].size())
		{
			// Unhide this interface
			logger->Log("Selected interface: ");
			logger->Log(settings->root["hiddenInterfaces"][this->activeItem].asString());
			logger->Log("\n");

			Interface *toUnhide = getMatchingInterface(settings->root["hiddenInterfaces"][this->activeItem].asString().c_str());

			Json::Value newArr;
			for (int i = 0; i < settings->root["hiddenInterfaces"].size(); i++)
			{
				if (i != this->activeItem)
				{
					newArr.append(settings->root["hiddenInterfaces"][i].asString());
				}
			}
			settings->root["hiddenInterfaces"] = newArr;
			settings->SaveSettings();
			
			// Resize window
			this->activeItem = -1;
			this->Resize(this->placementX, this->placementY, this->width);
			this->Update();

			extern std::vector<InterfaceRow *> interfaceRows;
			extern std::vector<Interface *> interfaces;

			InterfaceRow *interfaceRow = new InterfaceRow(0, (interfaceRows.size() * 3) + 1, COLS, 3);
			interfaceRows.push_back(interfaceRow);
			toUnhide->AddToUI();
			toUnhide->setInterfaceRow(interfaceRow);

			// Return a value so that in main we create an interface row for the unhidden interface
			return CREATE_NEW_INTERFACE;
		}
		else if (this->activeItem == settings->root["hiddenInterfaces"].size())
		{
			settings->root["zeroOnStart"] = settings->root["zeroOnStart"] == 0 ? 1 : 0;
			settings->SaveSettings();

			this->Update();
		}
	}

	return NO_ACTION;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl 0x1c(%rdi), %r14d
pushq $0x1
popq %rbp
cmpl $-0x1, %r14d
je 0xa5d9
movq %rdi, %rbx
leaq 0x604c(%rip), %r15      # 0x10388
movq (%r15), %rdi
leaq 0xe38(%rip), %rsi       # 0xb17e
callq 0x3120
movq %rax, %rdi
callq 0x34e0
cmpl %eax, %r14d
jae 0xa48a
leaq 0x6015(%rip), %r13      # 0x10378
movq (%r13), %rdi
leaq 0x1620(%rip), %rsi      # 0xb98e
callq 0x97a6
movq (%r13), %r14
movq (%r15), %rdi
leaq 0xdfd(%rip), %rsi       # 0xb17e
callq 0x3120
movl 0x1c(%rbx), %esi
movq %rax, %rdi
callq 0x3300
leaq 0x58(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x3570
movq %r14, %rdi
movq %r12, %rsi
callq 0x97b8
leaq 0x58(%rsp), %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0xf02(%rip), %rsi       # 0xb2c3
callq 0x97a6
movq (%r15), %rdi
leaq 0xdae(%rip), %rsi       # 0xb17e
callq 0x3120
movl 0x1c(%rbx), %esi
movq %rax, %rdi
callq 0x3300
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x3570
movq (%r14), %rdi
callq 0x9645
movq %rax, 0x28(%rsp)
movq %rsp, %rdi
callq 0x3170
movq %rsp, %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x3150
leaq 0xd68(%rip), %r12       # 0xb17e
leaq 0x78(%rsp), %r13
leaq 0x30(%rsp), %r14
movq (%r15), %rdi
movq %r12, %rsi
callq 0x3120
movq %rax, %rdi
callq 0x34e0
cmpl %eax, %ebp
jae 0xa529
cmpl 0x1c(%rbx), %ebp
je 0xa486
movq (%r15), %rdi
movq %r12, %rsi
callq 0x3120
movq %rax, %rdi
movl %ebp, %esi
callq 0x3300
movq %r13, %rdi
movq %rax, %rsi
callq 0x3570
movq %r14, %rdi
movq %r13, %rsi
callq 0x34c0
movq %rsp, %rdi
movq %r14, %rsi
callq 0x33e0
movq %r14, %rdi
callq 0x31b0
movq %r13, %rdi
callq 0x3170
incl %ebp
jmp 0xa420
movl 0x1c(%rbx), %r14d
movq (%r15), %rdi
leaq 0xce6(%rip), %rsi       # 0xb17e
callq 0x3120
movq %rax, %rdi
callq 0x34e0
cmpl %eax, %r14d
jne 0xa5d9
movq (%r15), %rdi
leaq 0xe48(%rip), %rsi       # 0xb300
callq 0x3120
movq %rax, %r14
leaq 0x30(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x3200
movq %r14, %rdi
movq %r12, %rsi
callq 0x33d0
movzbl %al, %esi
movq %rsp, %rdi
callq 0x3200
movq (%r15), %rdi
leaq 0xe11(%rip), %rsi       # 0xb300
callq 0x3120
movq %rsp, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x3370
movq %r14, %rdi
callq 0x31b0
leaq 0x30(%rsp), %rdi
callq 0x31b0
movq (%r15), %rdi
callq 0x9a70
movq %rbx, %rdi
callq 0xa034
jmp 0xa5d9
movq (%r15), %rdi
leaq 0xc4b(%rip), %rsi       # 0xb17e
callq 0x3120
movq %rsp, %rsi
movq %rax, %rdi
callq 0x3410
movq (%r15), %rdi
callq 0x9a70
orl $-0x1, 0x1c(%rbx)
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
movl 0x10(%rbx), %ecx
movq %rbx, %rdi
callq 0xa258
movq %rbx, %rdi
callq 0xa034
pushq $0x18
popq %rdi
callq 0x32c0
movq 0x28(%rsp), %rbx
movq %rax, %r14
leaq 0x5d89(%rip), %rax      # 0x10308
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
leal (%rcx,%rcx,2), %edx
incl %edx
movq 0x5a2a(%rip), %rax      # 0xffc0
movl (%rax), %ecx
pushq $0x3
popq %r8
movq %r14, %rdi
xorl %esi, %esi
callq 0x8b06
leaq 0x30(%rsp), %rsi
movq %r14, (%rsi)
leaq 0x5d53(%rip), %rdi      # 0x10308
callq 0x6ccc
movq %rbx, %rdi
callq 0x92c2
movq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x92aa
movq %rsp, %rdi
callq 0x31b0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x31b0
jmp 0xa615
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x32d0
jmp 0xa652
movq %rax, %rbx
movq %rsp, %rdi
jmp 0xa624
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0xa655
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3170
jmp 0xa65a
jmp 0xa64f
jmp 0xa64f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x31b0
jmp 0xa641
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3170
jmp 0xa652
jmp 0xa64f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x3540