22// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
33#include " generalconf.h"
44#include " src/core/flameshot.h"
5- #include " src/utils/abstractlogger.h"
65#include " src/utils/confighandler.h"
7- #include " src/utils/logfile.h"
86#include < QCheckBox>
97#include < QComboBox>
108#include < QFile>
@@ -58,7 +56,6 @@ GeneralConf::GeneralConf(QWidget* parent)
5856 initAntialiasingPinZoom ();
5957 initUndoLimit ();
6058 initInsecurePixelate ();
61- initLogToFile ();
6259#ifdef ENABLE_IMGUR
6360 initCopyAndCloseAfterUpload ();
6461 initUploadWithoutConfirmation ();
@@ -124,9 +121,6 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
124121 if (allowEmptySavePath || !config.savePath ().isEmpty ()) {
125122 m_savePath->setText (config.savePath ());
126123 }
127- m_logToFile->setChecked (config.logToFile ());
128- m_logFilePath->setText (config.logFilePath ());
129-
130124#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
131125 m_showTray->setChecked (!config.disabledTrayIcon ());
132126#endif
@@ -250,7 +244,6 @@ void GeneralConf::resetConfiguration()
250244 if (reply == QMessageBox::Yes) {
251245 m_savePath->setText (
252246 QStandardPaths::writableLocation (QStandardPaths::PicturesLocation));
253- m_logFilePath->setText (LogFile::defaultLogFilePath ());
254247 ConfigHandler ().setDefaultSettings ();
255248 _updateComponents (true );
256249 }
@@ -719,33 +712,6 @@ void GeneralConf::changeSavePath()
719712 }
720713}
721714
722- void GeneralConf::changeLogFilePath ()
723- {
724- QString path = ConfigHandler ().logFilePath ();
725-
726- if (path.isEmpty ()) {
727- path = LogFile::defaultLogFilePath ();
728- }
729-
730- path = QFileDialog::getExistingDirectory (
731- this ,
732- tr (" Choose a Folder" ),
733- path,
734- QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
735-
736- if (!QFileInfo (path).isWritable ()) {
737- QMessageBox::about (
738- this , tr (" Error" ), tr (" Unable to write to directory." ));
739- path = QString ();
740- }
741-
742- if (!path.isEmpty ()) {
743- m_logFilePath->setText (path);
744- ConfigHandler ().setLogFilePath (path);
745- LogFile::resetLogFile ();
746- }
747- }
748-
749715void GeneralConf::initCopyPathAfterSave ()
750716{
751717 m_copyPathAfterSave = new QCheckBox (tr (" Copy file path after save" ), this );
@@ -920,7 +886,7 @@ void GeneralConf::initInsecurePixelate()
920886{
921887 m_insecurePixelate = new QCheckBox (tr (" Insecure Pixelate" ), this );
922888 m_insecurePixelate->setToolTip (
923- tr (" Draw the pixelation effect in an insecure but more aesthetic way." ));
889+ tr (" Draw the pixelation effect in an insecure but more asethetic way." ));
924890 m_insecurePixelate->setChecked (ConfigHandler ().insecurePixelate ());
925891 m_scrollAreaLayout->addWidget (m_insecurePixelate);
926892
@@ -930,70 +896,6 @@ void GeneralConf::initInsecurePixelate()
930896 &GeneralConf::setInsecurePixelate);
931897}
932898
933- void GeneralConf::initLogToFile ()
934- {
935- auto * box = new QGroupBox (tr (" Logging" ));
936- box->setFlat (true );
937- m_layout->addWidget (box);
938-
939- auto * vboxLayout = new QVBoxLayout ();
940- box->setLayout (vboxLayout);
941-
942- m_logToFile = new QCheckBox (tr (" Log to file" ), this );
943- m_logToFile->setToolTip (
944- tr (" Save all log messages produced by flameshot to a file" ));
945- m_logToFile->setChecked (ConfigHandler ().logToFile ());
946-
947- connect (m_logToFile, &QCheckBox::clicked, this , &GeneralConf::setLogToFile);
948- vboxLayout->addWidget (m_logToFile);
949-
950- auto * pathLayout = new QHBoxLayout ();
951-
952- QString path = ConfigHandler ().logFilePath ();
953- m_logFilePath = new QLineEdit (path, this );
954- m_logFilePath->setToolTip (
955- tr (" The directory where log files will be saved" ));
956- m_logFilePath->setDisabled (true );
957- QString foreground = this ->palette ().windowText ().color ().name ();
958- m_logFilePath->setStyleSheet (QStringLiteral (" color:%1" ).arg (foreground));
959- pathLayout->addWidget (m_logFilePath);
960-
961- m_changeLogFilePathButton = new QPushButton (tr (" Change..." ), this );
962- pathLayout->addWidget (m_changeLogFilePathButton);
963- connect (m_changeLogFilePathButton,
964- &QPushButton::clicked,
965- this ,
966- &GeneralConf::changeLogFilePath);
967-
968- vboxLayout->addLayout (pathLayout);
969-
970- auto * levelLayout = new QHBoxLayout ();
971- auto * levelLabel = new QLabel (tr (" Minimum Log Level" ));
972- levelLabel->setToolTip (
973- tr (" Specify the minimum severity level of log messages that "
974- " should be saved to disk" ));
975- levelLayout->addWidget (levelLabel);
976-
977- m_logFileLevel = new QComboBox (this );
978-
979- m_logFileLevel->addItem (tr (" Info (All Log Messages)" ),
980- AbstractLogger::Channel::Info);
981- m_logFileLevel->addItem (tr (" Warnings and Errors" ),
982- AbstractLogger::Channel::Warning);
983- m_logFileLevel->addItem (tr (" Errors" ), AbstractLogger::Channel::Error);
984-
985- auto level = ConfigHandler ().value (" logFileLevel" ).toInt ();
986- m_logFileLevel->setCurrentIndex (m_logFileLevel->findData (level));
987-
988- connect (
989- m_logFileLevel,
990- static_cast <void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged),
991- this ,
992- &GeneralConf::setLogFileLevel);
993- levelLayout->addWidget (m_logFileLevel);
994- vboxLayout->addLayout (levelLayout);
995- }
996-
997899void GeneralConf::setSelGeoHideTime (int v)
998900{
999901 ConfigHandler ().setValue (" showSelectionGeometryHideTime" , v);
@@ -1033,14 +935,4 @@ void GeneralConf::setReverseArrow(bool checked)
1033935void GeneralConf::setInsecurePixelate (bool checked)
1034936{
1035937 ConfigHandler ().setInsecurePixelate (checked);
1036- }
1037-
1038- void GeneralConf::setLogToFile (bool checked)
1039- {
1040- ConfigHandler ().setLogToFile (checked);
1041- }
1042-
1043- void GeneralConf::setLogFileLevel (int index)
1044- {
1045- ConfigHandler ().setValue (" logFileLevel" , m_logFileLevel->itemData (index));
1046- }
938+ }
0 commit comments