<commit_before>/**
 * Kryvos - Encrypts and decrypts files.
 * Copyright (C) 2014, 2015 <NAME>
 *
 * This file is part of Kryvos.
 *
 * Kryvos is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Kryvos is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kryvos.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact : <EMAIL>
 */

#ifndef KRYVOS_GUI_MAINWINDOW_HPP_
#define KRYVOS_GUI_MAINWINDOW_HPP_

#include "settings/Settings.hpp"
#include "gui/SettingsFrame.hpp"
#include "gui/HeaderFrame.hpp"
#include "gui/FileListFrame.hpp"
#include "gui/MessageFrame.hpp"
#include "gui/PasswordFrame.hpp"
#include "gui/ControlButtonFrame.hpp"
#include "utility/pimpl.h"
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QVBoxLayout>

/*!
 * \brief The MainWindow class is the main window for the application.
 */
class MainWindow : public QMainWindow {
  Q_OBJECT

 public:
  /*!
   * \brief MainWindow Constructs the application's main window.
   * \param parent Widget parent of this main window
   */
  explicit MainWindow(Settings* settings = nullptr, QWidget* parent = nullptr);

  /*!
   * \brief ~MainWindow Destroys the application's main window.
   */
  virtual ~MainWindow();

 signals:
  /*!
   * \brief encrypt Emitted when the user provides all required data for
   * encryption and clicks the Encrypt push button.
   * \param passphrase String representing the user supplied passphrase
   * \param inputFileNames List of input file strings
   * \param algorithmName String representing the current algorithm.
   * Example: "AES-128/GCM" will encrypt files with AES 128-bit key size in
   * Gallois Counter Mode.
   * \param keySize Key size
   */
  void encrypt(const QString& passphrase,
               const QStringList& inputFileNames,
               const QString& algorithmName,
               const std::size_t& keySize);

  /*!
   * \brief decrypt Emitted when the user provides all required data for
   * decryption and clicks the Decrypt push button.
   * \param passphrase String representing the user supplied passphrase
   * \param inputFileNames List of input file strings
   */
  void decrypt(const QString& passphrase, const QStringList& inputFileNames);

  /*!
   * \brief pauseCipher Emitted when the user toggles the Pause push button.
   * \param pause Boolean representing the pause status
   */
  void pauseCipher(const bool pause);

  /*!
   * \brief stopCipher Emitted when the user clicks the Clear Files push button.
   */
  void abortCipher();

  /*!
   * \brief stopFile Emitted when the user clicks a remove file button.
   */
  void stopFile(const QString& fileName);

 public slots:
  /*!
   * \brief addFiles Executed when the Add Files toolbar push button is clicked.
   */
  void addFiles();

  /*!
   * \brief removeFiles Executed when the Remove All Files toolbar push
   * button is clicked.
   */
  void removeFiles();

  /*!
   * \brief processFiles Executed when the encrypt or decrypt push button is
   * clicked. Starts the encryption or decryption operation using the passphrase
   * from the password line edit, the file list from the file list model, and
   * the algorithm name from the settings panel.
   * \param cryptFlag Boolean representing encrypt (true) or decrypt (false)
   */
  void processFiles(const bool cryptFlag);

  /*!
   * \brief updateProgress Executed when the cipher operation progress is
   * updated. Updates the progress bar for the item at the specified index.
   * \param index Integer representing the file list index to update
   * \param percent Integer representing the current progress in percent
   */
  void updateProgress(const QString& path, const qint64 percent);

  /*!
   * \brief updateStatusMessage Executed when a message should be displayed to
   * the user. Updates the message text edit text to the message.
   * \param message String representing the message.
   */
  void updateStatusMessage(const QString& message);

  /*!
   * \brief updateError Executed when a cipher operation fails.
   * \param index Integer representing the file list index to update
   * \param message String representing the error message
   */
  void updateError(const QString& path, const QString& message);

  /*!
   * \brief updateBusyStatus Executed when the cipher operation updates its busy
   * status. Stores the status to allow the GUI to decide when the user can
   * request new encryption events.<commit_msg>Update documentation<commit_after>/**
 * Kryvos - Encrypts and decrypts files.
 * Copyright (C) 2014, 2015 <NAME>
 *
 * This file is part of Kryvos.
 *
 * Kryvos is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Kryvos is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kryvos.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact : <EMAIL>
 */

#ifndef KRYVOS_GUI_MAINWINDOW_HPP_
#define KRYVOS_GUI_MAINWINDOW_HPP_

#include "settings/Settings.hpp"
#include "gui/SettingsFrame.hpp"
#include "gui/HeaderFrame.hpp"
#include "gui/FileListFrame.hpp"
#include "gui/MessageFrame.hpp"
#include "gui/PasswordFrame.hpp"
#include "gui/ControlButtonFrame.hpp"
#include "utility/pimpl.h"
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QVBoxLayout>

/*!
 * \brief The MainWindow class is the main window for the application.
 */
class MainWindow : public QMainWindow {
  Q_OBJECT

 public:
  /*!
   * \brief MainWindow Constructs the application's main window.
   * \param parent Widget parent of this main window
   */
  explicit MainWindow(Settings* settings = nullptr, QWidget* parent = nullptr);

  /*!
   * \brief ~MainWindow Destroys the application's main window.
   */
  virtual ~MainWindow();

 signals:
  /*!
   * \brief encrypt Emitted when the user provides all required data for
   * encryption and clicks the Encrypt push button.
   * \param passphrase String representing the user supplied passphrase
   * \param inputFileNames List of input file strings
   * \param algorithmName String representing the current algorithm.
   * Example: "AES-128/GCM" will encrypt files with AES 128-bit key size in
   * Gallois Counter Mode.
   * \param keySize Key size
   */
  void encrypt(const QString& passphrase,
               const QStringList& inputFileNames,
               const QString& algorithmName,
               const std::size_t& keySize);

  /*!
   * \brief decrypt Emitted when the user provides all required data for
   * decryption and clicks the Decrypt push button.
   * \param passphrase String representing the user supplied passphrase
   * \param inputFileNames List of input file strings
   */
  void decrypt(const QString& passphrase, const QStringList& inputFileNames);

  /*!
   * \brief pauseCipher Emitted when the user toggles the Pause push button.
   * \param pause Boolean representing the pause status
   */
  void pauseCipher(const bool pause);

  /*!
   * \brief abortCipher Emitted when the user clicks the Clear Files push
   * button.
   */
  void abortCipher();

  /*!
   * \brief stopFile Emitted when the user clicks a remove file button.
   */
  void stopFile(const QString& fileName);

 public slots:
  /*!
   * \brief addFiles Executed when the Add Files toolbar push button is clicked.
   */
  void addFiles();

  /*!
   * \brief removeFiles Executed when the Remove All Files toolbar push
   * button is clicked.
   */
  void removeFiles();

  /*!
   * \brief processFiles Executed when the encrypt or decrypt push button is
   * clicked. Starts the encryption or decryption operation using the passphrase
   * from the password line edit, the file list from the file list model, and
   * the algorithm name from the settings panel.
   * \param cryptFlag Boolean representing encrypt (true) or decrypt (false)
   */
  void processFiles(const bool cryptFlag);

  /*!
   * \brief updateProgress Executed when the cipher operation progress is
   * updated. Updates the progress bar for the item at the specified index.
   * \param index Integer representing the file list index to update
   * \param percent Integer representing the current progress in percent
   */
  void updateProgress(const QString& path, const qint64 percent);

  /*!
   * \brief updateStatusMessage Executed when a message should be displayed to
   * the user. Updates the message text edit text to the message.
   * \param message String representing the message.
   */
  void updateStatusMessage(const QString& message);

  /*!
   * \brief updateError Executed when a cipher operation fails.
   * \param index Integer representing the file list index to update
   * \param message String representing the error message
   */
  void updateError(const QString& path, const QString& message);

  /*!
   * \brief updateBusyStatus Executed when the cipher operation updates its busy
   * status. Stores the status to allow the GUI to decide when the user can
   * request new encryption.
{'fraction_non_alphanumeric': 0.07419222062152707, 'fraction_numerical': 0.003498662276188516, 'mean_word_length': 3.443987197073617, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '200558', 'n_tokens_mistral': 2663, 'n_tokens_neox': 2560, 'n_words': 1147}