Skip to content

Commit

Permalink
Merge pull request #1 from cohoe/2.6
Browse files Browse the repository at this point in the history
Bump version to 2.6-01
  • Loading branch information
cohoe committed May 11, 2017
2 parents 1e32608 + 8e10550 commit 42a4298
Show file tree
Hide file tree
Showing 74 changed files with 2,460 additions and 2,364 deletions.
7 changes: 3 additions & 4 deletions BUILD.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Building on Linux:

For Debian and Ubuntu:
sudo apt-get install libqt4-dev libboost-dev g++ dh-make
For debian and ubuntu:
sudo apt-get install libqt4-dev libboost-dev g++ dh_make
qmake -r Launchy.pro ; make ; sudo make install

To build a deb package:
Expand All @@ -11,7 +11,6 @@ cd linux ; ./build_deb.sh <version> such as ./buid_deb.sh 2.2

Building and installing on Mac OS X:

0) Install the boost C++ library
1) Install the QT SDK
2) qmake Launchy.pro -spec macx-g++ -r CONFIG+=release
3) make ; make install
Expand All @@ -23,7 +22,7 @@ Building and installing on Mac OS X:



Building on Windows:
Building on WINDOWS:

Requirements:
1) Visual Studio 2005 w/ SP1
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
launchy
=======

Open-Source Keystroke Launcher

# About
Launchy is a free cross-platform utility designed to help you forget about
your start menu, the icons on your desktop, and even your file manager.
Launchy indexes the programs in your start menu and can launch your documents,
project files, folders, and bookmarks with just a few keystrokes!

Further information can be found in the [readmes](/readmes) directory.

# This Release
The original author has abandoned this project. As such several bugs
critical to the use of Launchy have gone unfixed. The user community on
Github has patched several of these, but none have hit them all. This
repository hits the ones I cared about!

* Config files being placed in your homedir (e.g., ~/launchy.ini).
* Desktop files with double-quotes not launching properly.
* Desktop files with multiple sections not indexing at all.

# Contributors
* Josh Karlin: Creator and Author
* Simon Capewell: Developer
* Lukas Zapletal: Fedora package maintainer
* Pablo Russo: Desktop file patch
* Leonid Shevtsov: Quote launch patch
Binary file removed Readme.pdf
Binary file not shown.
13 changes: 11 additions & 2 deletions platforms/unix/platform_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void PlatformUnix::alterItem(CatItem* item) {

line = QString::fromUtf8(file.readLine());

while(!file.atEnd() && !line.startsWith("[", Qt::CaseInsensitive)) {
while(!line.startsWith("[", Qt::CaseInsensitive)) {

if (line.startsWith("Name[" + locale, Qt::CaseInsensitive))
name = line.split("=")[1].trimmed();
Expand All @@ -179,7 +179,16 @@ void PlatformUnix::alterItem(CatItem* item) {
else if (line.startsWith("NoDisplay"))
nodisplay = line.split("=")[1].trimmed();

line = QString::fromUtf8(file.readLine());
// Fix for regression where we were ignoring the
// last line line in the file (which if it was an icon
// would be fatal.
if (!file.atEnd()) {
line = QString::fromUtf8(file.readLine());
continue;
}

// We're done now.
break;
}

}
Expand Down
4 changes: 2 additions & 2 deletions platforms/unix/platform_unix_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ UnixIconProvider::UnixIconProvider() {
QStringList spl = line.split("=");
xdgDataDirs = spl[1].split(":");
}
// Fedora patch file launchy-xdg-icon-path.patch (original author unknown)
xdgDataDirs += "/usr/share/";
xdgDataDirs += "/usr/share/icons/";
// Patch from Fedora (original author unknown)
xdgDataDirs += "/usr/share/";
}


Expand Down
28 changes: 8 additions & 20 deletions platforms/win/WinIconProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ void WinIconProvider::setPreferredIconSize(int size)


// This also exists in plugin_interface, need to remove both if I make a 64 build
QString wicon_aliasTo64(QString path)
{
QString wicon_aliasTo64(QString path)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment ();
QString pf32 = env.value("PROGRAMFILES");
QString pf64 = env.value("PROGRAMW6432");
Expand All @@ -99,8 +99,8 @@ QString wicon_aliasTo64(QString path)
path = path32.replace("system32", "sysnative");
}
}
}
return path;
}
return path;
}

QIcon WinIconProvider::icon(const QFileInfo& info) const
Expand Down Expand Up @@ -131,22 +131,10 @@ QIcon WinIconProvider::icon(const QFileInfo& info) const
// Get the icon index using SHGetFileInfo
SHFILEINFO sfi = {0};

QRegExp re("\\\\\\\\([a-z0-9\\-]+\\\\?)?$", Qt::CaseInsensitive);
if (re.exactMatch(filePath))
{
// To avoid network hangs, explicitly fetch the My Computer icon for UNCs
LPITEMIDLIST pidl;
if (SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidl) == S_OK)
{
SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_PIDL | SHGFI_SYSICONINDEX);
// Set the file path to the My Computer GUID for any later fetches
filePath = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
}
}
if (sfi.iIcon == 0)
{
SHGetFileInfo(filePath.utf16(), 0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX);
}
// To avoid network hangs, explicitly fetch the My Computer icon for UNCs
QRegExp re("\\\\\\\\([a-z]+\\\\?)?$", Qt::CaseInsensitive);
SHGetFileInfo(re.exactMatch(filePath) ? L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" : filePath.utf16(),
0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX);

// An icon index of 3 is the generic file icon
if (sfi.iIcon > 0 && sfi.iIcon != 3)
Expand Down
34 changes: 5 additions & 29 deletions platforms/win/platform_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "main.h"
#include "platform_win.h"
#include "WinIconProvider.h"
#include "minidump.h"


// Override the main widget to handle incoming system messages. We could have done this in the QApplication
Expand All @@ -48,11 +47,6 @@ class LaunchyWidgetWin : public LaunchyWidget
}
break;

case WM_ENDSESSION:
// Ensure settings are saved
saveSettings();
break;

// Might need to capture these two messages if Vista gives any problems with alpha borders
// when restoring from standby
case WM_POWERBROADCAST:
Expand Down Expand Up @@ -85,10 +79,9 @@ LaunchyWidget* createLaunchyWidget(CommandFlags command)


PlatformWin::PlatformWin(int& argc, char** argv) :
PlatformBase(argc, argv),
minidumper(_T("Launchy"))
PlatformBase(argc, argv)
{
instance = new LimitSingleInstance(_T("Local\\{ASDSAD0-DCC6-49b5-9C61-ASDSADIIIJJL}"));
instance = new LimitSingleInstance(TEXT("Local\\{ASDSAD0-DCC6-49b5-9C61-ASDSADIIIJJL}"));

// Create local and global application mutexes so that installer knows when
// Launchy is running
Expand Down Expand Up @@ -209,27 +202,8 @@ bool PlatformWin::supportsAlphaBorder() const
return true;
}


bool PlatformWin::getComputers(QStringList& computers) const
bool PlatformWin::getComputers(QList<QString>& computers) const
{
// Get a list of domains. This should return nothing or fail when we're on a workgroup
QStringList domains;
if (EnumerateNetworkServers(domains, SV_TYPE_DOMAIN_ENUM))
{
foreach(QString domain, domains)
{
EnumerateNetworkServers(computers, SV_TYPE_WORKSTATION | SV_TYPE_SERVER, domain.utf16());
}

// If names have been retrieved from more than one domain, they'll need sorting
if (domains.length() > 1)
{
computers.sort();
}

return true;
}

return EnumerateNetworkServers(computers, SV_TYPE_WORKSTATION | SV_TYPE_SERVER);
}

Expand All @@ -239,3 +213,5 @@ QApplication* createApplication(int& argc, char** argv)
{
return new PlatformWin(argc, argv);
}


4 changes: 1 addition & 3 deletions platforms/win/platform_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "platform_base.h"
#include "platform_win_util.h"
#include "platform_base_hotkey.h"
#include "minidump.h"


class PlatformWin : public PlatformBase
Expand All @@ -44,12 +43,11 @@ class PlatformWin : public PlatformBase
virtual bool supportsAlphaBorder() const;
virtual bool isAlreadyRunning() const;
virtual void sendInstanceCommand(int command);
virtual bool getComputers(QStringList& computers) const;
virtual bool getComputers(QList<QString>& computers) const;

private:
HANDLE localMutex, globalMutex;
LimitSingleInstance* instance;
MiniDumper minidumper;
};


Expand Down
2 changes: 1 addition & 1 deletion platforms/win/platform_win_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ QString GetShellDirectory(int type)
}


bool EnumerateNetworkServers(QStringList& items, DWORD serverType, const wchar_t* domain)
bool EnumerateNetworkServers(QList<QString>& items, DWORD serverType, const wchar_t* domain)
{
SERVER_INFO_100* serverInfo = 0;
DWORD read, totalOnNetwork;
Expand Down
2 changes: 1 addition & 1 deletion platforms/win/platform_win_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

void UpdateEnvironment();
QString GetShellDirectory(int type);
bool EnumerateNetworkServers(QStringList& items, DWORD serverType, const wchar_t* domain = NULL);
bool EnumerateNetworkServers(QList<QString>& items, DWORD serverType, const wchar_t* domain = NULL);


class LimitSingleInstance
Expand Down
57 changes: 22 additions & 35 deletions plugins/calcy/calcy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ bool DoCalculation(QString str, double& result)
calculator calc;
double n = 0;


QLocale locale;
str = str.replace(locale.groupSeparator(), "");
str = str.replace(locale.decimalPoint(), ".");
wchar_t* wstr = new wchar_t[str.length()+1];
str.toWCharArray(wstr);
wstr[str.length()] = 0;
Expand All @@ -114,7 +116,8 @@ bool DoCalculation(QString str, double& result)
calcyPlugin* gPlugin;


calcyPlugin::calcyPlugin()
calcyPlugin::calcyPlugin() :
reg(".*[\\-\\+\\*\\/]+[\\d\\s\\-\\+\\*\\/\\(\\)\\.]+")
{
gPlugin = this;
HASH_CALCY = qHash(QString("calcy"));
Expand All @@ -128,11 +131,6 @@ calcyPlugin::~calcyPlugin()

void calcyPlugin::init()
{
QString decimal = (*settings)->value("calcy/useCommaForDecimal", false).toBool() ? "," : ".";
QString group = (*settings)->value("calcy/useCommaForDecimal", false).toBool() ? "." : ",";

QString pattern = QString("^[\\(\\+\\-]*([\\d\\%1]?(\\%2\\d+)?)").arg(group).arg(decimal);
reg.setPattern(pattern);
}


Expand All @@ -153,8 +151,8 @@ void calcyPlugin::getLabels(QList<InputData>* id)
if (id->count() > 1)
return;

QString text = id->last().getText().replace(" ", "");
if (reg.indexIn(text) == 0)
const QString& text = id->last().getText();
if (reg.indexIn(text) != -1)
{
id->last().setLabel(HASH_CALCY);
}
Expand All @@ -165,35 +163,25 @@ void calcyPlugin::getResults(QList<InputData>* id, QList<CatItem>* results)
{
if (id->last().hasLabel(HASH_CALCY))
{
QString text = id->last().getText();
const QString & text = id->last().getText();
double res = 0.0;

QString decimal = (*settings)->value("calcy/useCommaForDecimal", false).toBool() ? "," : ".";
QString group = (*settings)->value("calcy/useCommaForDecimal", false).toBool() ? "." : ",";

QLocale c = (*settings)->value("calcy/useCommaForDecimal", false).toBool() ? QLocale(QLocale::German) : QLocale(QLocale::C);


text = text.replace(group, "");
text = text.replace(decimal, ".");


//double dbl = c.toDouble(text);
//qDebug() << text << dbl;
//text = QString::number(dbl);

if (!DoCalculation(text, res))
return;

QString szRes = c.toString(res, 'f', (*settings)->value("calcy/outputRounding", 10).toInt());

// Remove any trailing fractional zeros
if (szRes.contains(decimal))
QLocale locale;
locale.setNumberOptions(
(*settings)->value("calcy/outputGroupSeparator", true).toBool() ? QLocale::NumberOption() : QLocale::OmitGroupSeparator);
QString szRes = locale.toString(res, 'f', (*settings)->value("calcy/outputRounding", 10).toInt());
// Remove any trailing factional zeros
if (szRes.contains(locale.decimalPoint()))
{
while (szRes.endsWith("0"))
szRes.chop(1);
if (szRes.endsWith(decimal))
szRes.chop(1);
while (szRes.endsWith(locale.zeroDigit()))
{
szRes.truncate(szRes.length()-1);
}
if (szRes.endsWith(locale.decimalPoint()))
{
szRes.truncate(szRes.length()-1);
}
}
results->push_front(CatItem(szRes + ".calcy", szRes, HASH_CALCY, getIcon()));
}
Expand Down Expand Up @@ -228,7 +216,6 @@ void calcyPlugin::doDialog(QWidget* parent, QWidget** newDlg)
return;
gui.reset(new Gui(parent));
*newDlg = gui.get();
init();
}


Expand Down
7 changes: 4 additions & 3 deletions plugins/calcy/calcy.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ SOURCES = plugin_interface.cpp \
TARGET = calcy
win32 {
CONFIG -= embed_manifest_dll
LIBS += user32.lib shell32.lib
QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /DEBUG
LIBS += shell32.lib
LIBS += user32.lib
% LIBS += Gdi32.lib
% LIBS += comctl32.lib
}
if(!debug_and_release|build_pass):CONFIG(debug, debug|release):DESTDIR = ../../debug/plugins
if(!debug_and_release|build_pass):CONFIG(release, debug|release):DESTDIR = ../../release/plugins
Expand Down
Loading

0 comments on commit 42a4298

Please sign in to comment.