diff --git a/calculationengine.cpp b/calculationengine.cpp index 6629c59..e6359c8 100644 --- a/calculationengine.cpp +++ b/calculationengine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/calculationengine.h b/calculationengine.h index e9db604..8899970 100644 --- a/calculationengine.h +++ b/calculationengine.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/config.cpp b/config.cpp index e2cb6b4..717b0e6 100644 --- a/config.cpp +++ b/config.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -87,12 +87,8 @@ EntryConfig ConfigReader::readFromDesktopFile(const QString &path) } } } - - } - } - return result; } diff --git a/config.h b/config.h index 57fd68a..3395e5d 100644 --- a/config.h +++ b/config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/configprovider.cpp b/configprovider.cpp index 448d8e9..743c3f4 100644 --- a/configprovider.cpp +++ b/configprovider.cpp @@ -12,7 +12,7 @@ QVector ConfigProvider::getUserEntries() return reader.readConfig(); } -QVector ConfigProvider::getSystemEntries() +QVector ConfigProvider::getSystemEntries() { QStringList systemApplicationsPaths = settings->value("sysAppsPaths", "/usr/share/applications/").toStringList(); ConfigReader systemConfigReader(systemApplicationsPaths); diff --git a/entrypushbutton.cpp b/entrypushbutton.cpp index 3aca82d..cf0649c 100644 --- a/entrypushbutton.cpp +++ b/entrypushbutton.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/entrypushbutton.h b/entrypushbutton.h index 4892cd1..a50b910 100644 --- a/entrypushbutton.h +++ b/entrypushbutton.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/main.cpp b/main.cpp index ac1da84..9392554 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/window.cpp b/window.cpp index 2fb3d31..44cbe51 100644 --- a/window.cpp +++ b/window.cpp @@ -1,18 +1,18 @@ /* - * Copyright (c) 2018 Albert S. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ +* Copyright (c) 2018-2019 Albert S. +* +* Permission to use, copy, modify, and distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ #include #include #include @@ -43,8 +43,6 @@ Window::Window(ConfigProvider &configProvider) calculationResultLabel.setAlignment(Qt::AlignCenter); calculationResultLabel.setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); connect(&calculationResultLabel, &QLabel::customContextMenuRequested, this, &Window::showCalculationResultContextMenu); - - } Window::~Window() @@ -53,9 +51,6 @@ Window::~Window() } - - - void Window::initFromConfig() { try @@ -207,7 +202,7 @@ void Window::addCalcResult(const QString &expression) int calculatedPointSize = currentFont.pointSize(); QFontMetrics fm(currentFont); 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; currentFont.setPointSize(calculatedPointSize); @@ -233,20 +228,17 @@ void Window::lineEditTextChanged(QString text) QString input = text.mid(1); if(text[0] == '=') { - addCalcResult(input); return; } - } filterGridFor(text); if(this->grid->count() == 0) { addPATHSuggestion(text); - if(this->grid->count() == 0) + if(this->grid->count() == 0) { - QStringList arguments = text.split(" "); EntryConfig e; e.name = "Execute: " + text; @@ -273,7 +265,6 @@ void Window::keyReleaseEvent(QKeyEvent *event) { button->showName(); } - } QWidget::keyReleaseEvent(event); @@ -288,20 +279,17 @@ void Window::keyPressEvent(QKeyEvent *event) if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0) { - if(event->key() == Qt::Key_L) { this->lineEdit->setFocus(); this->lineEdit->selectAll(); } - for(EntryPushButton *button : buttonsInGrid) { button->showShortcut(); } - QKeySequence seq(event->key()); QString key = seq.toString().toLower(); @@ -368,7 +356,7 @@ void Window::filterGridFor(QString filter) EntryPushButton * Window::createEntryButton(const EntryConfig &entry) { EntryPushButton *button = new EntryPushButton(entry); - connect(button, &EntryPushButton::clicked, this, &Window::buttonClick); + connect(button, &EntryPushButton::clicked, this, &Window::buttonClick); return button; } @@ -394,12 +382,8 @@ void Window::setSystemConfig(const QVector &config) this->systemEntryButtons = generateEntryButtons(config); } - - - bool Window::eventFilter(QObject *obj, QEvent *event) { - if(obj == this->lineEdit) { if (event->type() == QEvent::KeyPress) @@ -413,17 +397,15 @@ bool Window::eventFilter(QObject *obj, QEvent *event) this->lineEdit->setText(suggestions[0] + " "); this->lineEdit->setCursorPosition(this->lineEdit->text().length()+1); } - return true; } } } return QObject::eventFilter(obj, event); - } void Window::focusInput() { this->lineEdit->setFocus(); -} \ No newline at end of file +} diff --git a/window.h b/window.h index 476db59..f1f4296 100644 --- a/window.h +++ b/window.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Albert S. + * Copyright (c) 2018-2019 Albert S. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above