Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging New threshold branch back #22

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ddb7927
Use the first occurency of entries on .desktop files. Some .desktop f…
Oct 26, 2015
eb191ce
Honor absolute path to icons.
Oct 26, 2015
8af86bb
Remove uncommented code for caching. It's done in platform_unix_util.…
Oct 26, 2015
c4b9376
Add some missing themes and fix xdgDataDirs (/icons will be later in …
Oct 27, 2015
769c30c
Search in the subdirectories of pixmaps. Some needed icons are there,…
Oct 27, 2015
be5eda0
rework build file so it work with git
Oct 27, 2015
408d687
fix -Wreorder warning from gcc
Oct 29, 2015
1caac25
kill warning -Wunused-parameter without refactoring interface
Oct 29, 2015
c65f369
remove commented code
Oct 29, 2015
2e46494
fix -Wreorder warning from gcc: fix the crashes from the original fix
Oct 30, 2015
5d7967a
honor XDGBaseDirectorySpecification from debian for config directories
Oct 30, 2015
acefbcf
fix warning: KeySym XKeycodeToKeysym(Display*, KeyCode, int) is depre…
Oct 30, 2015
bde8de2
fix nasty bug on plugin list in ui. If a row was selected and you cli…
Oct 31, 2015
57b4855
clean up commented code in source and remove unused files
Oct 31, 2015
78f4803
add basic description
Oct 31, 2015
77b0db5
Update README.md
wofwofwof Oct 31, 2015
26b6fc6
Update README.md
wofwofwof Oct 31, 2015
45c0c68
Update README.md
wofwofwof Oct 31, 2015
fbf58fa
Merge pull request #7 from wofwofwof/master
OpenNingia Jan 26, 2016
436e780
Merge branch 'release/march_2017'
OpenNingia Mar 9, 2017
6ee839d
removed old files
OpenNingia Mar 9, 2017
dd36b9f
calcy: fix dialog display cut off
shirosaki Mar 7, 2017
f9e4b5c
Merge pull request #18 from shirosaki/fix_calcy_dialog
OpenNingia Mar 10, 2017
e7ee002
Fix lupdate very slow with Boost
shirosaki Mar 10, 2017
5fb0b49
Merge pull request #19 from shirosaki/fix_lupdate
OpenNingia Mar 12, 2017
2a6799a
Fix icon transparency on Windows 10
shirosaki Jan 17, 2018
d9c2762
Merge pull request #21 from shirosaki/fix_icon
OpenNingia Mar 13, 2018
ed89f8a
new threshold for old items
OpenNingia Mar 13, 2018
c48aeb6
updated setup script
OpenNingia Mar 13, 2018
d8ed09c
Revert "updated setup script"
OpenNingia Apr 23, 2018
c472ffb
updated .gitignore to ignore vscode private dir
OpenNingia Apr 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.pydevproject
.project
.metadata
.vscode
bin/
tmp/
*.tmp
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Launchy is a smart search launcher for installed programs or files.

[![Build status](https://ci.appveyor.com/api/projects/status/e2uhgtuarx38ix3f?svg=true)](https://ci.appveyor.com/project/OpenNingia/launchy)

[ ![Download](https://api.bintray.com/packages/openningia/Launchy/LaunchyInstaller/images/download.svg) ](https://bintray.com/openningia/Launchy/LaunchyInstaller/_latestVersion)

It is the most efficient way to open files, folders, websites,
and programs on your computer. Instead of having to browse the menus
to find an application, Launchy is a smart search program which tries
Expand All @@ -17,15 +19,14 @@ If you'd like to run a program with a second parameter then use tab. E.g.
```
gedit [tab] ~/textfile.txt [tab] [return]
```
runs
runs
```
gedit ~/textfile.txt
```
===

As there seems to be not many people work on this nice program I've tried to fix
the bugs and misssing feature request that I need. My main focus is on Launchy_QT
for Windows.
the bugs and misssing feature request that I need. My main focus is on Launchy for Windows.

This fork is from
- https://github.com/OpenNingia/Launchy
Expand All @@ -35,7 +36,3 @@ The original Homepage of the project is


Thanks to all who have developed this nice piece of software.




122 changes: 114 additions & 8 deletions launchy/platforms/win/WinIconProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,119 @@ bool WinIconProvider::addIconFromImageList(int imageListIndex, int iconIndex, QI
}


/*
* anonymous namespace contains helper functions from gui/image/qpixmap_win.cpp used by fixed_qt_pixmapFromWinHBitmap
*/
namespace{
/*
* from gui/image/qpixmap_win.cpp
*/
static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih)
{
memset(bih, 0, sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = width;
bih->biHeight = topToBottom ? -height : height;
bih->biPlanes = 1;
bih->biBitCount = 32;
bih->biCompression = BI_RGB;
bih->biSizeImage = width * height * 4;
}

/*
* from gui/image/qpixmap_win.cpp
*/
static inline void initBitMapInfo(int width, int height, bool topToBottom, BITMAPINFO *bmi)
{
initBitMapInfoHeader(width, height, topToBottom, &bmi->bmiHeader);
memset(bmi->bmiColors, 0, sizeof(RGBQUAD));
}

/*
* from gui/image/qpixmap_win.cpp
*/
static inline uchar *getDiBits(HDC hdc, HBITMAP bitmap, int width, int height, bool topToBottom = true)
{
BITMAPINFO bmi;
initBitMapInfo(width, height, topToBottom, &bmi);
uchar *result = new uchar[bmi.bmiHeader.biSizeImage];
if (!GetDIBits(hdc, bitmap, 0, height, result, &bmi, DIB_RGB_COLORS)) {
delete [] result;
qErrnoWarning("%s: GetDIBits() failed to get bitmap bits.", __FUNCTION__);
return 0;
}
return result;
}

/*
* from gui/image/qpixmap_win.cpp
*/
static inline void copyImageDataCreateAlpha(const uchar *data, QImage *target)
{
const uint mask = target->format() == QImage::Format_RGB32 ? 0xff000000 : 0;
const int height = target->height();
const int width = target->width();
const int bytesPerLine = width * int(sizeof(QRgb));
for (int y = 0; y < height; ++y) {
QRgb *dest = reinterpret_cast<QRgb *>(target->scanLine(y));
const QRgb *src = reinterpret_cast<const QRgb *>(data + y * bytesPerLine);
for (int x = 0; x < width; ++x) {
const uint pixel = src[x];
if ((pixel & 0xff000000) == 0 && (pixel & 0x00ffffff) != 0)
dest[x] = pixel | 0xff000000;
else
dest[x] = pixel | mask;
}
}
}
}

/*
* fixed version of qt_pixmapFromWinHBitmap
*/
QPixmap fixed_qt_pixmapFromWinHBitmap(HBITMAP bitmap, int hbitmapformat = 0){
// Verify size
BITMAP bitmap_info;
memset(&bitmap_info, 0, sizeof(BITMAP));

const int res = GetObject(bitmap, sizeof(BITMAP), &bitmap_info);
if (!res) {
qErrnoWarning("QPixmap::fromWinHBITMAP(), failed to get bitmap info");
return QPixmap();
}
const int w = bitmap_info.bmWidth;
const int h = bitmap_info.bmHeight;

// Get bitmap bits
HDC display_dc = GetDC(0);
QScopedArrayPointer<uchar> data(getDiBits(display_dc, bitmap, w, h, true));
if (data.isNull()) {
ReleaseDC(0, display_dc);
return QPixmap();
}
/********
* BEGIN Changed Code
********/
const QImage::Format imageFormat = hbitmapformat == QtWin::HBitmapNoAlpha ?
QImage::Format_RGB32 : hbitmapformat == QtWin::HBitmapPremultipliedAlpha ?
QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32;
/********
* END Changed Code
********/

// Create image and copy data into image.
QImage image(w, h, imageFormat);
if (image.isNull()) { // failed to alloc?
ReleaseDC(0, display_dc);
qWarning("%s, failed create image of %dx%d", __FUNCTION__, w, h);
return QPixmap();
}
copyImageDataCreateAlpha(data.data(), &image);
ReleaseDC(0, display_dc);
return QPixmap::fromImage(image);
}


// On Vista or 7 we could use SHIL_JUMBO to get a 256x256 icon,
// but we'll use SHCreateItemFromParsingName as it'll give an identical
// icon to the one shown in explorer and it scales automatically.
Expand All @@ -249,17 +362,10 @@ bool WinIconProvider::addIconFromShellFactory(QString filePath, QIcon& icon) con
if (hr == S_OK)
{
#if QT_VERSION >= 0x050000
QPixmap iconPixmap = QtWin::fromHBITMAP(iconBitmap, QtWin::HBitmapPremultipliedAlpha);
QPixmap iconPixmap = fixed_qt_pixmapFromWinHBitmap(iconBitmap, QtWin::HBitmapAlpha);
#else
QPixmap iconPixmap = QPixmap::fromWinHBITMAP(iconBitmap, QPixmap::PremultipliedAlpha);
#endif
// Compose proper image with icon alpha channel
QImage iconImage = QImage(iconPixmap.size(), QImage::Format_ARGB32);
QPainter painter(&iconImage);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.drawPixmap(0, 0, iconPixmap);
iconPixmap = QPixmap::fromImage(iconImage);

icon.addPixmap(iconPixmap);
DeleteObject(iconBitmap);
}
Expand Down
3 changes: 3 additions & 0 deletions launchy/plugins/calcy/calcy.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ VPATH += ../../src/

INCLUDEPATH += ../../src/
INCLUDEPATH += $$(BOOST_DIR)

TR_EXCLUDE += $$(BOOST_DIR)/*

PRECOMPILED_HEADER = precompiled.h

greaterThan(QT_MAJOR_VERSION, 4): QT += gui widgets
Expand Down
6 changes: 3 additions & 3 deletions launchy/plugins/calcy/dlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<rect>
<x>10</x>
<y>10</y>
<width>350</width>
<width>320</width>
<height>91</height>
</rect>
</property>
Expand All @@ -40,14 +40,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="chkDigitGrouping">
<property name="text">
<string>Show digit grouping symbol</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="chkCopyToClipboard">
<property name="text">
<string>Copy result to clipboard when pressing Enter</string>
Expand Down
2 changes: 1 addition & 1 deletion launchy/plugins/controly/controly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void controlyPlugin::addCatItem(QString text, QList<CatItem>* results, QString f
{
if (text.length() == 0 || isMatch(shortName, text))
{
CatItem& item = CatItem(fullName, shortName, HASH_controly, getIconPath() + fullName.toLower() + ".png");
CatItem item(fullName, shortName, HASH_controly, getIconPath() + fullName.toLower() + ".png");
item.usage = (*settings)->value("controly/" + shortName.replace(" ", "") , 0).toInt();
results->push_back(item);
}
Expand Down
12 changes: 6 additions & 6 deletions launchy/plugins/controly/fhoreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// currently, we assume that all reg values are returned as strings

HKEY FhoReg::OpenKey(HKEY baseKey, QString &subKeyName, DWORD options) {
HKEY FhoReg::OpenKey(HKEY baseKey, QString const& subKeyName, DWORD options) {
HKEY k;

LONG l = RegOpenKeyEx(baseKey,
Expand All @@ -27,7 +27,7 @@ void FhoReg::CloseKey(HKEY key) {
}
}

QStringList* FhoReg::EnumValues(HKEY parentKey, QString &parentSubKeyName) {
QStringList* FhoReg::EnumValues(HKEY parentKey, QString const& parentSubKeyName) {
QStringList *resultList = new QStringList();

HKEY k = OpenKey(parentKey, parentSubKeyName, KEY_QUERY_VALUE);
Expand Down Expand Up @@ -99,7 +99,7 @@ QStringList* FhoReg::EnumSubKeys(HKEY key) {
return resultList;
}

QStringList* FhoReg::EnumSubKeys(HKEY parentKey, QString &parentSubKeyName) {
QStringList* FhoReg::EnumSubKeys(HKEY parentKey, QString const& parentSubKeyName) {
QStringList *resultList;

HKEY k = OpenKey(parentKey, parentSubKeyName, KEY_ENUMERATE_SUB_KEYS);
Expand All @@ -115,7 +115,7 @@ QStringList* FhoReg::EnumSubKeys(HKEY parentKey, QString &parentSubKeyName) {
return resultList;
}

QString FhoReg::GetKeyValue(HKEY key, QString &valueName) {
QString FhoReg::GetKeyValue(HKEY key, QString const& valueName) {
DWORD type;
BYTE keyVal[maxSize];
DWORD sz = maxSize;
Expand All @@ -134,7 +134,7 @@ QString FhoReg::GetKeyValue(HKEY key, QString &valueName) {
return NULL;
}

QString FhoReg::GetKeyValue(HKEY parentKey, QString &parentSubKeyName, QString &valueName) {
QString FhoReg::GetKeyValue(HKEY parentKey, QString const& parentSubKeyName, QString const& valueName) {
HKEY k = OpenKey(parentKey, parentSubKeyName, KEY_QUERY_VALUE);

QString value;
Expand All @@ -152,7 +152,7 @@ QString FhoReg::GetKeyDefaultValue(HKEY key) {
return GetKeyValue(key, QString());
}

QString FhoReg::GetKeyDefaultValue(HKEY parentKey, QString &parentSubKeyName) {
QString FhoReg::GetKeyDefaultValue(HKEY parentKey, QString const& parentSubKeyName) {
HKEY k = OpenKey(parentKey, parentSubKeyName, KEY_QUERY_VALUE);

QString value;
Expand Down
12 changes: 6 additions & 6 deletions launchy/plugins/controly/fhoreg.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ class FhoReg {
static const DWORD maxSize = 256;

public:
static HKEY OpenKey(HKEY baseKey, QString &subKeyName, DWORD options);
static HKEY OpenKey(HKEY baseKey, QString const& subKeyName, DWORD options);
static void CloseKey(HKEY key);

static QString GetKeyValue(HKEY key, QString &valueName);
static QString GetKeyValue(HKEY parentKey, QString &parentSubKeyName, QString &valueName);
static QString GetKeyValue(HKEY key, QString const& valueName);
static QString GetKeyValue(HKEY parentKey, QString const& parentSubKeyName, QString const& valueName);
static QString GetKeyDefaultValue(HKEY key);
static QString GetKeyDefaultValue(HKEY parentKey, QString &parentSubKeyName);
static QString GetKeyDefaultValue(HKEY parentKey, QString const& parentSubKeyName);

static QStringList* EnumValues(HKEY parentKey, QString &parentSubKeyName);
static QStringList* EnumValues(HKEY parentKey, QString const& parentSubKeyName);
static QStringList* EnumSubKeys(HKEY key);
static QStringList* EnumSubKeys(HKEY parentKey, QString &parentSubKeyName);
static QStringList* EnumSubKeys(HKEY parentKey, QString const& parentSubKeyName);

};

Expand Down
1 change: 0 additions & 1 deletion launchy/src/catalog_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class CatalogBuilder : public QThread, public INotifyProgressStep
CatalogBuilder(PluginHandler* plugs);
Catalog* getCatalog() const { return catalog; }
int getProgress() const { return progress; }
//int isRunning() const { return progress < CATALOG_PROGRESS_MAX; }
bool progressStep(int newStep);
void run();

Expand Down
Loading