-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
934 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build | ||
tools | ||
*.exe | ||
*.pro.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "hotkey"] | ||
path = hotkey | ||
url = https://github.com/Skycoder42/QHotkey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
# nsclip | ||
# nsClip | ||
|
||
Simple application that removes whitespace from clipboard. | ||
|
||
## Workflow | ||
|
||
* Copy some text (``Ctrl+C``) | ||
* Remove whitespace (``Alt+Win+C``) | ||
* Paste text (``Ctrl+V``) | ||
|
||
## How does it work? | ||
|
||
The application runs in the background and when activated (``Alt+Win+C``) will strip whitespace from the current clipboard text. | ||
|
||
### Input | ||
|
||
``` | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est purus, ultrices in porttitor | ||
in, accumsan non quam. Nam consectetur porttitor rhoncus. Curabitur eu est et leo feugiat | ||
auctor vel quis lorem. Ut et ligula dolor, sit amet consequat lorem. Aliquam porta eros sed | ||
velit imperdiet egestas. Maecenas tempus eros ut diam ullamcorper id dictum libero | ||
tempor. Donec quis augue quis magna condimentum lobortis. Quisque imperdiet ipsum vel | ||
magna viverra rutrum. Cras viverra molestie urna, vitae vestibulum turpis varius id. | ||
``` | ||
|
||
### Output | ||
|
||
``` | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est purus, ultrices in porttitor in, accumsan non quam. Nam consectetur porttitor rhoncus. Curabitur eu est et leo feugiat auctor vel quis lorem. Ut et ligula dolor, sit amet consequat lorem. Aliquam porta eros sed velit imperdiet egestas. Maecenas tempus eros ut diam ullamcorper id dictum libero tempor. Donec quis augue quis magna condimentum lobortis. Quisque imperdiet ipsum vel magna viverra rutrum. Cras viverra molestie urna, vitae vestibulum turpis varius id. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
# | ||
# nsClip - https://github.com/nettstudio/nsclip | ||
# | ||
# Copyright (c) 2022 NettStudio AS <https://nettstudio.no>. | ||
# All rights reserved. | ||
# | ||
# This program 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. | ||
# | ||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/> | ||
# | ||
*/ | ||
|
||
#include "nsclip.h" | ||
|
||
#include <QObject> | ||
#include <QGuiApplication> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication a(argc, argv); | ||
QGuiApplication::setApplicationDisplayName("nsClip"); | ||
QGuiApplication::setApplicationName("nsClip"); | ||
QGuiApplication::setOrganizationName("NettStudio AS"); | ||
QGuiApplication::setOrganizationDomain("nettstudio.no"); | ||
|
||
nsClip clip; | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@echo off | ||
|
||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 %* | ||
|
||
set CWD=%cd% | ||
set TOOLS=%CWD%\tools | ||
set QT_MAJOR=5 | ||
set QT_MINOR=12 | ||
set QT_PATCH=12 | ||
set QT_VERSION=%QT_MAJOR%.%QT_MINOR%.%QT_PATCH% | ||
set QT_DIR=%TOOLS%\qt | ||
|
||
set PATH=%QT_DIR%\bin;%ProgramFiles%\7-Zip;%PATH% | ||
|
||
set QTBASE=qtbase-everywhere-src-%QT_VERSION% | ||
set QTTOOLS=qttools-everywhere-src-%QT_VERSION% | ||
set QT_URL=https://mirrors.dotsrc.org/qtproject/archive/qt/%QT_MAJOR%.%QT_MINOR%/%QT_VERSION%/submodules | ||
set QTBASE_URL=%QT_URL%/%QTBASE%.zip | ||
set QTTOOLS_URL=%QT_URL%/%QTTOOLS%.zip | ||
|
||
@RD /S /Q build | ||
mkdir build | ||
mkdir "%TOOLS%" | ||
|
||
if not exist "%QT_DIR%\bin\qmake.exe" ( | ||
if not exist "%TOOLS%\%QTBASE%.zip" ( | ||
curl --url %QTBASE_URL% -o "%TOOLS%\%QTBASE%.zip" | ||
) | ||
cd "%CWD%\build" | ||
7z x "%TOOLS%\%QTBASE%.zip" | ||
cd "%QTBASE%" | ||
configure.bat -static -release -prefix "%QT_DIR%" -platform win32-msvc2019 -opensource -confirm-license -nomake examples -nomake tests -static-runtime -opengl desktop -optimize-size -no-pch -no-glib -no-dbus -no-sse4.2 -no-avx -no-avx2 -no-avx512 -strip -no-openssl -no-gif -no-ico | ||
nmake | ||
nmake install | ||
) | ||
|
||
cd "%CWD%\build" | ||
qmake.exe CONFIG+=release .. | ||
nmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
# | ||
# nsClip - https://github.com/nettstudio/nsclip | ||
# | ||
# Copyright (c) 2022 NettStudio AS <https://nettstudio.no>. | ||
# All rights reserved. | ||
# | ||
# This program 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. | ||
# | ||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/> | ||
# | ||
*/ | ||
|
||
#include "nsclip.h" | ||
|
||
#include <QGuiApplication> | ||
#include <QClipboard> | ||
#include <QHotkey> | ||
#include <QDebug> | ||
|
||
nsClip::nsClip(QObject *parent) | ||
: QObject{parent} | ||
, _tray(nullptr) | ||
{ | ||
_tray = new QSystemTrayIcon(this); | ||
_tray->setIcon( QIcon(":/nsclip.png") ); | ||
_tray->setToolTip("nsClip"); | ||
_tray->show(); | ||
|
||
QHotkey *hotkey1 = new QHotkey(QKeySequence("Alt+Meta+C"), | ||
true, | ||
this); | ||
QObject::connect(hotkey1, | ||
&QHotkey::activated, | ||
this, | ||
&nsClip::handleSimplifyClipboard); | ||
} | ||
|
||
void nsClip::handleSimplifyClipboard() | ||
{ | ||
QString text = QGuiApplication::clipboard()->text(); | ||
if ( text.isEmpty() ) { return; } | ||
|
||
qDebug() << "IN" << text; | ||
qDebug() << "OUT" << text.simplified(); | ||
|
||
QGuiApplication::clipboard()->setText( text.simplified() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
# | ||
# nsClip - https://github.com/nettstudio/nsclip | ||
# | ||
# Copyright (c) 2022 NettStudio AS <https://nettstudio.no>. | ||
# All rights reserved. | ||
# | ||
# This program 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. | ||
# | ||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/> | ||
# | ||
*/ | ||
|
||
#ifndef NSCLIP_H | ||
#define NSCLIP_H | ||
|
||
#include <QObject> | ||
#include <QSystemTrayIcon> | ||
|
||
class nsClip : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit nsClip(QObject *parent = nullptr); | ||
|
||
private: | ||
QSystemTrayIcon *_tray; | ||
|
||
private slots: | ||
void handleSimplifyClipboard(); | ||
}; | ||
|
||
#endif // NSCLIP_H |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# nsClip - https://github.com/nettstudio/nsclip | ||
# | ||
# Copyright (c) 2022 NettStudio AS <https://nettstudio.no>. | ||
# All rights reserved. | ||
# | ||
# This program 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. | ||
# | ||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/> | ||
# | ||
|
||
VERSION= 2022.9.9 | ||
TEMPLATE = app | ||
|
||
QT += core gui widgets | ||
CONFIG += c++11 | ||
SOURCES += main.cpp nsclip.cpp | ||
HEADERS += nsclip.h | ||
RESOURCES += nsclip.qrc | ||
|
||
CONFIG(release, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT | ||
|
||
QMAKE_TARGET_PRODUCT = "nsClip" | ||
QMAKE_TARGET_DESCRIPTION = "nsClip" | ||
QMAKE_TARGET_COPYRIGHT = "NettStudio AS" | ||
QMAKE_TARGET_COMPANY = "NettStudio AS" | ||
|
||
win32: RC_ICONS += nsclip.ico | ||
|
||
include(hotkey/qhotkey.pri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>nsclip.png</file> | ||
</qresource> | ||
</RCC> |