<commit_before>//===========================================
//  PC-BSD source code
//  Copyright (c) 2016, PC-BSD Software/iXsystems
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "mainUI.h"
#include "ui_mainUI.h"

// === PUBLIC ===
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
  ui->setupUi(this); //load the designer form
  ui->stackedWidget->setCurrentWidget(ui->page_auth);
  InitializeUI();
}

MainUI::~MainUI(){
	
}
// === PRIVATE ===
void MainUI::InitializeUI(){
  //First load any pre-existing settings
  bool haslocalhost = S_CORE->localhostAvailable();
  ui->actionLocalhost_Auto_Connect->setVisible(haslocalhost);
  ui->actionLocalhost_Auto_Connect->setEnabled(haslocalhost);
  ui->actionLocalhost_Auto_Connect->setChecked(false);
  if(haslocalhost){ 
    ui->actionLocalhost_Auto_Connect->setChecked(settings->value("auto-auth-localhost",true).toBool()); 
    ui->line_auth_host->setText("localhost");
    //Also load the currently-running user for this process and place that into the UI automatically
    //Note: This will only be valid on FreeBSD systems (since the server is only for FreeBSD)
    #ifdef __FreeBSD__
    #include <sys/types.h>
    #include <unistd.h>
    ui->line_auth_user->setText( getlogin() );
    #endif
    if(!ui->line_auth_user->text().isEmpty()){ ui->line_auth_pass->setFocus();  }
    else{ ui->line_auth_user->setFocus(); }
  }else{
    ui->line_auth_host->setFocus();
  }
  
  //Now setup the signals/slots
  connect(S_CORE, SIGNAL(clientAuthorized()), this, SLOT(Authorized()) );
  connect(S_CORE, SIGNAL(clientUnauthorized()), this, SLOT(NoAuthorization()) );
  connect(S_CORE, SIGNAL(clientDisconnected()), this, SLOT(NoAuthorization()) );<commit_msg>Move includes to top<commit_after>//===========================================
//  PC-BSD source code
//  Copyright (c) 2016, PC-BSD Software/iXsystems
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "mainUI.h"
#include "ui_mainUI.h"

#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#endif


// === PUBLIC ===
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
  ui->setupUi(this); //load the designer form
  ui->stackedWidget->setCurrentWidget(ui->page_auth);
  InitializeUI();
}

MainUI::~MainUI(){
	
}
// === PRIVATE ===
void MainUI::InitializeUI(){
  //First load any pre-existing settings
  bool haslocalhost = S_CORE->localhostAvailable();
  ui->actionLocalhost_Auto_Connect->setVisible(haslocalhost);
  ui->actionLocalhost_Auto_Connect->setEnabled(haslocalhost);
  ui->actionLocalhost_Auto_Connect->setChecked(false);
  if(haslocalhost){ 
    ui->actionLocalhost_Auto_Connect->setChecked(settings->value("auto-auth-localhost",true).toBool()); 
    ui->line_auth_host->setText("localhost");
    //Also load the currently-running user for this process and place that into the UI automatically
    //Note: This will only be valid on FreeBSD systems (since the server is only for FreeBSD)
    #ifdef __FreeBSD__
    ui->line_auth_user->setText( getlogin() );
    #endif
    if(!ui->line_auth_user->text().isEmpty()){ ui->line_auth_pass->setFocus();  }
    else{ ui->line_auth_user->setFocus(); }
  }else{
    ui->line_auth_host->setFocus();
  }
  
  //Now setup the signals/slots
  connect(S_CORE, SIGNAL(clientAuthorized()), this, SLOT(Authorized()) );
  connect(S_CORE, SIGNAL(clientUnauthorized()), this, SLOT(NoAuthorization()) );
  connect(S_CORE, SIGNAL(clientDisconnected()), this, SLOT(NoAuthorization()) );
{'fraction_non_alphanumeric': 0.19398084815321479, 'fraction_numerical': 0.0027359781121751026, 'mean_word_length': 5.06301824212272, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2180014', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1122, 'n_words': 244}