formating fixes / copyright update...

This commit is contained in:
Albert S. 2019-09-30 21:58:11 +02:00
parent fe5b358ace
commit d6ec7a7e1c
10 changed files with 27 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -87,12 +87,8 @@ EntryConfig ConfigReader::readFromDesktopFile(const QString &path)
} }
} }
} }
} }
} }
return result; return result;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -12,7 +12,7 @@ QVector<EntryConfig> ConfigProvider::getUserEntries()
return reader.readConfig(); return reader.readConfig();
} }
QVector<EntryConfig> ConfigProvider::getSystemEntries() QVector<EntryConfig> ConfigProvider::getSystemEntries()
{ {
QStringList systemApplicationsPaths = settings->value("sysAppsPaths", "/usr/share/applications/").toStringList(); QStringList systemApplicationsPaths = settings->value("sysAppsPaths", "/usr/share/applications/").toStringList();
ConfigReader systemConfigReader(systemApplicationsPaths); ConfigReader systemConfigReader(systemApplicationsPaths);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View File

@ -1,18 +1,18 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <QProcess> #include <QProcess>
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include <QDirIterator> #include <QDirIterator>
@ -43,8 +43,6 @@ Window::Window(ConfigProvider &configProvider)
calculationResultLabel.setAlignment(Qt::AlignCenter); calculationResultLabel.setAlignment(Qt::AlignCenter);
calculationResultLabel.setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); calculationResultLabel.setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
connect(&calculationResultLabel, &QLabel::customContextMenuRequested, this, &Window::showCalculationResultContextMenu); connect(&calculationResultLabel, &QLabel::customContextMenuRequested, this, &Window::showCalculationResultContextMenu);
} }
Window::~Window() Window::~Window()
@ -53,9 +51,6 @@ Window::~Window()
} }
void Window::initFromConfig() void Window::initFromConfig()
{ {
try try
@ -207,7 +202,7 @@ void Window::addCalcResult(const QString &expression)
int calculatedPointSize = currentFont.pointSize(); int calculatedPointSize = currentFont.pointSize();
QFontMetrics fm(currentFont); QFontMetrics fm(currentFont);
int contentWidth = calculationResultLabel.contentsRect().width() - calculationResultLabel.margin(); int contentWidth = calculationResultLabel.contentsRect().width() - calculationResultLabel.margin();
while(calculatedPointSize < 48 && fm.boundingRect(labelText).width() < contentWidth) while(calculatedPointSize < 48 && fm.boundingRect(labelText).width() < contentWidth)
{ {
calculatedPointSize += 1; calculatedPointSize += 1;
currentFont.setPointSize(calculatedPointSize); currentFont.setPointSize(calculatedPointSize);
@ -233,20 +228,17 @@ void Window::lineEditTextChanged(QString text)
QString input = text.mid(1); QString input = text.mid(1);
if(text[0] == '=') if(text[0] == '=')
{ {
addCalcResult(input); addCalcResult(input);
return; return;
} }
} }
filterGridFor(text); filterGridFor(text);
if(this->grid->count() == 0) if(this->grid->count() == 0)
{ {
addPATHSuggestion(text); addPATHSuggestion(text);
if(this->grid->count() == 0) if(this->grid->count() == 0)
{ {
QStringList arguments = text.split(" "); QStringList arguments = text.split(" ");
EntryConfig e; EntryConfig e;
e.name = "Execute: " + text; e.name = "Execute: " + text;
@ -273,7 +265,6 @@ void Window::keyReleaseEvent(QKeyEvent *event)
{ {
button->showName(); button->showName();
} }
} }
QWidget::keyReleaseEvent(event); QWidget::keyReleaseEvent(event);
@ -288,20 +279,17 @@ void Window::keyPressEvent(QKeyEvent *event)
if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0) if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0)
{ {
if(event->key() == Qt::Key_L) if(event->key() == Qt::Key_L)
{ {
this->lineEdit->setFocus(); this->lineEdit->setFocus();
this->lineEdit->selectAll(); this->lineEdit->selectAll();
} }
for(EntryPushButton *button : buttonsInGrid) for(EntryPushButton *button : buttonsInGrid)
{ {
button->showShortcut(); button->showShortcut();
} }
QKeySequence seq(event->key()); QKeySequence seq(event->key());
QString key = seq.toString().toLower(); QString key = seq.toString().toLower();
@ -368,7 +356,7 @@ void Window::filterGridFor(QString filter)
EntryPushButton * Window::createEntryButton(const EntryConfig &entry) EntryPushButton * Window::createEntryButton(const EntryConfig &entry)
{ {
EntryPushButton *button = new EntryPushButton(entry); EntryPushButton *button = new EntryPushButton(entry);
connect(button, &EntryPushButton::clicked, this, &Window::buttonClick); connect(button, &EntryPushButton::clicked, this, &Window::buttonClick);
return button; return button;
} }
@ -394,12 +382,8 @@ void Window::setSystemConfig(const QVector<EntryConfig> &config)
this->systemEntryButtons = generateEntryButtons(config); this->systemEntryButtons = generateEntryButtons(config);
} }
bool Window::eventFilter(QObject *obj, QEvent *event) bool Window::eventFilter(QObject *obj, QEvent *event)
{ {
if(obj == this->lineEdit) if(obj == this->lineEdit)
{ {
if (event->type() == QEvent::KeyPress) if (event->type() == QEvent::KeyPress)
@ -413,17 +397,15 @@ bool Window::eventFilter(QObject *obj, QEvent *event)
this->lineEdit->setText(suggestions[0] + " "); this->lineEdit->setText(suggestions[0] + " ");
this->lineEdit->setCursorPosition(this->lineEdit->text().length()+1); this->lineEdit->setCursorPosition(this->lineEdit->text().length()+1);
} }
return true; return true;
} }
} }
} }
return QObject::eventFilter(obj, event); return QObject::eventFilter(obj, event);
} }
void Window::focusInput() void Window::focusInput()
{ {
this->lineEdit->setFocus(); this->lineEdit->setFocus();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Albert S. <mail at quitesimple dot org> * Copyright (c) 2018-2019 Albert S. <mail at quitesimple dot org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above