Skip to content

Commit

Permalink
import from Fedora package source archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Cohoe committed May 11, 2017
1 parent 1e32608 commit 38c56bc
Show file tree
Hide file tree
Showing 71 changed files with 2,445 additions and 2,404 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
Binary file modified Readme.doc
Binary file not shown.
Binary file modified Readme.pdf
Binary file not shown.
52 changes: 18 additions & 34 deletions platforms/unix/platform_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ QHash<QString, QList<QString> > PlatformUnix::getDirectories() {
out["plugins"] += QDir::homePath() + "/.launchy/plugins";
out["plugins"] += PLUGINS_PATH;

out["config"] += QDir::homePath() + "/.launchy";
out["config"] += QDir::homePath();
out["portableConfig"] += qApp->applicationDirPath();

if (QFile::exists(out["skins"].last() + "/Default"))
Expand Down Expand Up @@ -157,41 +157,25 @@ void PlatformUnix::alterItem(CatItem* item) {
QString name = "";
QString icon = "";
QString exe = "";
QString nodisplay = "false";
while(!file.atEnd()) {

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

if (line.startsWith("[Desktop Entry]", Qt::CaseInsensitive)) {

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

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

if (line.startsWith("Name[" + locale, Qt::CaseInsensitive))
name = line.split("=")[1].trimmed();
else if (line.startsWith("Name=", Qt::CaseInsensitive))
name = line.split("=")[1].trimmed();
else if (line.startsWith("Icon", Qt::CaseInsensitive))
icon = line.split("=")[1].trimmed();
else if (line.startsWith("Exec", Qt::CaseInsensitive))
exe = line.split("=")[1].trimmed();
else if (line.startsWith("NoDisplay"))
nodisplay = line.split("=")[1].trimmed();

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

}
QString line = file.readLine();

if (line.startsWith("Name[" + locale, Qt::CaseInsensitive))
name = line.split("=")[1].trimmed();


else if (line.startsWith("Name=", Qt::CaseInsensitive))
name = line.split("=")[1].trimmed();

else if (line.startsWith("Icon", Qt::CaseInsensitive))
icon = line.split("=")[1].trimmed();
else if (line.startsWith("Exec", Qt::CaseInsensitive))
exe = line.split("=")[1].trimmed();
}
if (name.size() >= item->shortName.size() - 8) {
item->shortName = name;
item->lowName = item->shortName.toLower();
}

if (nodisplay.startsWith("true", Qt::CaseInsensitive))
return;

//if (name.size() >= item->shortName.size() - 8) {
item->shortName = name;
item->lowName = item->shortName.toLower();
//}

// Don't index desktop items wthout icons
if (icon.trimmed() == "")
Expand Down
2 changes: 0 additions & 2 deletions platforms/unix/platform_unix_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ 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/";
}

Expand Down
4 changes: 2 additions & 2 deletions platforms/unix/unix.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ LIBS += -lX11 -lXext -lXrender
unix {
PREFIX = /usr
DEFINES += SKINS_PATH=\\\"$$PREFIX/share/launchy/skins/\\\" \
PLUGINS_PATH=\\\"$$PREFIX/lib64/launchy/plugins/\\\" \
PLATFORMS_PATH=\\\"$$PREFIX/lib64/launchy/\\\"
PLUGINS_PATH=\\\"$$PREFIX/lib/launchy/plugins/\\\" \
PLATFORMS_PATH=\\\"$$PREFIX/lib/launchy/\\\"
target.path = $$PREFIX/lib/launchy/
INSTALLS += target
}
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
11 changes: 6 additions & 5 deletions plugins/calcy/calcy.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ 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


unix:!macx {
PREFIX = /usr
target.path = $$PREFIX/lib64/launchy/plugins/
icon.path = $$PREFIX/lib64/launchy/plugins/icons/
target.path = $$PREFIX/lib/launchy/plugins/
icon.path = $$PREFIX/lib/launchy/plugins/icons/
icon.files = calcy.png
INSTALLS += target \
icon
Expand Down
Loading

0 comments on commit 38c56bc

Please sign in to comment.