diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/README.md b/README.md new file mode 100644 index 0000000..b28453e --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# dischrome 〜chromeを煽るだけ〜 + +### これはなに +最近LinuxラヴなM社がchromeを起動するとやたらとedgeを推すと言うかchromeディスってくるのでついカッとなって1時間で移植。 + +さあみんなchromeより安全で高速でクールでキュートなブラウザに乗り換えるんだ!。 + +### コンパイル +`$ lrelease dischrome.pro` +してから +`$ qmake` +`$ make` +どうぞ。 + +### 使い方 +起動するとトレイに居座るのでchromeを起動してみよう。 + +### 終わり方 +トレイアイコンを右クリックして「終了」を選べ。 + +### Linux以外でも使える? +`~/.config/google-chrome/SingletonLock`を定期チェックする仕組みだから無理じゃない?。 + +### で? +誤解するなよ、俺はchrome嫌いじゃないぞ。 + +あとこのプログラムは今後更新しませんそらするわけねえわ。 diff --git a/dischrome.cpp b/dischrome.cpp new file mode 100644 index 0000000..d8cfee6 --- /dev/null +++ b/dischrome.cpp @@ -0,0 +1,98 @@ +/*** + +The MIT License + +Copyright (c) 2018 Teppei Tamra (TAM) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +***/ + +#include "dischrome.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DisChrome::DisChrome() +{ + QImage icon(":/icons/thumbsdown.svg"); + setIcon(QIcon(QPixmap::fromImage(icon.scaled(QSize(44,44))))); + now = false; + auto menu = new QMenu(); + auto quitaction =new QAction(tr("Quit"),this); + connect(quitaction,&QAction::triggered,[](){ + QApplication::quit(); + }); + menu->addAction(quitaction); + setContextMenu(menu); + check(); +} + +bool DisChrome::findChromeInstance() +{ + QFile file(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/google-chrome/"); + return file.exists(); +} + +const QString DisChrome::message() +{ + int t = QDateTime::currentMSecsSinceEpoch() % 6; + switch (t) { + case 0: + return tr("w3m is faster than chrome."); + break; + case 1: + return tr("lynx is safer than chrome."); + break; + case 2: + return tr("Firefox icon is cute than chrome icon."); + break; + case 3: + return tr("Falkon is more cool for KDE users than chrome."); + break; + case 4: + return tr("wget is more faster and safer than chrome."); + break; + case 5: + return tr("wget is more faster and safer than chrome."); + break; + default: + return ""; + break; + } +} + +void DisChrome::check() +{ + if (findChromeInstance()) { + if (!now) { + now = true; + showMessage(tr("Are you still using chrome?"),message()); + } + } else { + now = false; + } + QTimer::singleShot(1000,this,&DisChrome::check); +} diff --git a/dischrome.h b/dischrome.h new file mode 100644 index 0000000..9d7cfc3 --- /dev/null +++ b/dischrome.h @@ -0,0 +1,49 @@ +/*** + +The MIT License + +Copyright (c) 2018 Teppei Tamra (TAM) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +***/ + +#ifndef DISCHROME_H +#define DISCHROME_H + +#include + +class DisChrome : public QSystemTrayIcon +{ + Q_OBJECT + +public: + DisChrome(); + +protected: + bool now; + +protected: + bool findChromeInstance(); + const QString message(); + void check(); + +}; + +#endif // DISCHROME_H diff --git a/dischrome.pro b/dischrome.pro new file mode 100644 index 0000000..76ca202 --- /dev/null +++ b/dischrome.pro @@ -0,0 +1,22 @@ +QT += core widgets + +TARGET = dischrome +TEMPLATE = app + +SOURCES += \ + main.cpp \ + dischrome.cpp + +HEADERS += \ + dischrome.h + +RESOURCES += \ + dischrome.qrc + +TRANSLATIONS += \ + dischrome_ja.ts + +DISTFILES += \ + dischrome.ts \ + dischrome_ja.ts \ + README.md diff --git a/dischrome.qrc b/dischrome.qrc new file mode 100644 index 0000000..1b0ac50 --- /dev/null +++ b/dischrome.qrc @@ -0,0 +1,8 @@ + + + thumbsdown.svg + + + dischrome_ja.qm + + diff --git a/dischrome.ts b/dischrome.ts new file mode 100644 index 0000000..ef5748c --- /dev/null +++ b/dischrome.ts @@ -0,0 +1,43 @@ + + + + + DisChrome + + + Quit + + + + + w3m is faster than chrome. + + + + + lynx is safer than chrome. + + + + + Firefox icon is cute than chrome icon. + + + + + Falkon is more cool for KDE users than chrome. + + + + + + wget is more faster and safer than chrome. + + + + + Are you still using chrome? + + + + diff --git a/dischrome_ja.ts b/dischrome_ja.ts new file mode 100644 index 0000000..8e789d4 --- /dev/null +++ b/dischrome_ja.ts @@ -0,0 +1,43 @@ + + + + + DisChrome + + + Quit + 終了 + + + + w3m is faster than chrome. + w3mはchromeより高速です。きっと。 + + + + lynx is safer than chrome. + lynxはchromeより安全です。多分。 + + + + Firefox icon is cute than chrome icon. + Firefoxはchromeよりもアイコンが可愛いです。 + + + + Falkon is more cool for KDE users than chrome. + FalkonはKDEユーザの方々にとってchromeよりも超クールなはずです。 + + + + + wget is more faster and safer than chrome. + wgetはchromeより高速で安全なんじゃないですか。 + + + + Are you still using chrome? + おやおや?、まだchromeをお使いで?。 + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..57a925e --- /dev/null +++ b/main.cpp @@ -0,0 +1,40 @@ +/*** + +The MIT License + +Copyright (c) 2018 Teppei Tamra (TAM) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +***/ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QTranslator translator; + translator.load(":/lang/dischrome.qm"); + a.installTranslator(&translator); + DisChrome s; + s.show(); + return a.exec(); +} diff --git a/thumbsdown.svg b/thumbsdown.svg new file mode 100644 index 0000000..e66e1d1 --- /dev/null +++ b/thumbsdown.svg @@ -0,0 +1,13 @@ + + + + + + + +