Skip to content

Commit a5d13d8

Browse files
v0.18
1 parent 61158c7 commit a5d13d8

19 files changed

+59
-234
lines changed

CMakeLists.txt

+13-107
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,15 @@
1-
# Do not export symbols by default
21
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
32
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
4-
5-
# Set the RPATH for the library lookup
6-
set(CMAKE_INSTALL_RPATH "$ORIGIN/../")
7-
8-
9-
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
10-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
11-
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
12-
endif()
13-
14-
15-
# FrontendPlugins
16-
17-
option(BUILD_WIDGETBOXMODEL "Build the frontend" ON)
18-
if (BUILD_WIDGETBOXMODEL)
19-
add_subdirectory(widgetboxmodel)
20-
endif()
21-
22-
option(BUILD_QMLBOXMODEL "Build the frontend" OFF)
23-
if (BUILD_QMLBOXMODEL)
24-
add_subdirectory(qmlboxmodel)
25-
endif()
26-
27-
28-
29-
# ExtensionPlugins
30-
31-
option(BUILD_APPLICATIONS "Build the extension" OFF)
32-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_APPLICATIONS)
33-
add_subdirectory(applications)
34-
endif()
35-
36-
option(BUILD_CALCULATOR "Build the extension" OFF)
37-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_CALCULATOR)
38-
add_subdirectory(calculator)
39-
endif()
40-
41-
option(BUILD_CHROMEBOOKMARKS "Build the extension" OFF)
42-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_CHROMEBOOKMARKS)
43-
add_subdirectory(chromium)
44-
endif()
45-
46-
option(BUILD_DEBUG "Build the extension" OFF)
47-
if (BUILD_DEBUG)
48-
add_subdirectory(debug)
49-
endif()
50-
51-
option(BUILD_FILES "Build the extension" OFF)
52-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_FILES)
53-
add_subdirectory(files)
54-
endif()
55-
56-
option(BUILD_FIREFOXBOOKMARKS "Build the extension" OFF)
57-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_FIREFOXBOOKMARKS)
58-
add_subdirectory(firefoxbookmarks)
59-
endif()
60-
61-
option(BUILD_HASHGENERATOR "Build the extension" OFF)
62-
if (BUILD_HASHGENERATOR)
63-
add_subdirectory(hashgenerator)
64-
endif()
65-
66-
option(BUILD_MPRIS "Build the extension" OFF)
67-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_MPRIS)
68-
add_subdirectory(mpris)
69-
endif()
70-
71-
option(BUILD_PYTHON "Build the extension" OFF)
72-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_PYTHOFF)
73-
add_subdirectory(python)
74-
endif()
75-
76-
option(BUILD_SNIPPETS "Build the extension" OFF)
77-
if (BUILD_SNIPPETS)
78-
add_subdirectory(snippets)
79-
endif()
80-
81-
option(BUILD_SSH "Build the extension" OFF)
82-
if (BUILD_SSH)
83-
add_subdirectory(ssh)
84-
endif()
85-
86-
option(BUILD_SYSTEM "Build the extension" OFF)
87-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_SYSTEM)
88-
add_subdirectory(system)
89-
endif()
90-
91-
option(BUILD_TEMPLATE "Build the extension" ON)
92-
if (BUILD_TEMPLATE)
93-
add_subdirectory(template)
94-
endif()
95-
96-
option(BUILD_TERMINAL "Build the extension" OFF)
97-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_TERMINAL)
98-
add_subdirectory(terminal)
99-
endif()
100-
101-
option(BUILD_VIRTUALBOX "Build the extension" OFF) # Deprecated
102-
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) AND BUILD_VIRTUALBOX)
103-
add_subdirectory(virtualbox)
104-
endif()
105-
106-
option(BUILD_WEBSEARCH "Build the extension" OFF)
107-
if (BUILD_WEBSEARCH)
108-
add_subdirectory(websearch)
109-
endif()
3+
set(CMAKE_INSTALL_RPATH "$ORIGIN")
4+
5+
# Auto import all plugins
6+
FILE(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
7+
FOREACH(child ${children})
8+
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${child})
9+
string(TOUPPER ${child} CHILD)
10+
option(BUILD_${CHILD} "Build ${child}" ON)
11+
if (BUILD_${CHILD})
12+
add_subdirectory(${child})
13+
endif()
14+
ENDIF()
15+
ENDFOREACH()

create_plugin.py

-76
This file was deleted.

mpris/src/item.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <QDBusMessage>
55
#include <QVariant>
66
#include <vector>
7-
#include "albert/util/standarditem.h"
7+
#include "albert/standarditem.h"
88
#include "player.h"
99
using std::vector;
1010
using std::shared_ptr;

qmlboxmodel/src/mainwindow.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <QPoint>
77
#include <QFileSystemWatcher>
88
#include <QIdentityProxyModel>
9-
#include "albert/util/history.h"
9+
#include "albert/history.h"
1010

1111
namespace QmlBoxModel {
1212

template/CMakeLists.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
cmake_minimum_required(VERSION 3.1.3)
22

3-
project(template)
4-
5-
file(GLOB_RECURSE SRC src/* metadata.json)
3+
project(template VERSION 0.0)
4+
configure_file("./metadata.json.in" "./metadata.json" @ONLY )
65

76
find_package(Qt5 5.5.0 REQUIRED COMPONENTS Widgets)
87

8+
file(GLOB SRC src/* metadata.json.in)
99
add_library(${PROJECT_NAME} SHARED ${SRC})
1010

11-
target_include_directories(${PROJECT_NAME} PRIVATE src/)
12-
1311
target_link_libraries(${PROJECT_NAME}
1412
PRIVATE
1513
Qt5::Widgets
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2-
"id": "template",
2+
"id": "@PROJECT_NAME@",
3+
"version": "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@",
34
"name": "Template",
4-
"version": "1.0",
55
"load_type": "user",
66
"authors": ["@manuelschneid3r"],
77
"library_dependencies": [],
88
"executable_dependencies": []
99
}
10+
11+

template/src/plugin.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ Plugin::Plugin()
1818
}
1919

2020

21-
QWidget *Plugin::settingsWidget()
21+
QWidget *Plugin::createSettingsWidget()
2222
{
23-
if (widget_)
24-
widget_ = new ConfigWidget;
25-
return widget_;
23+
return new ConfigWidget();
2624
}
2725

2826

29-
void Plugin::handleQuery(Core::Query *query) const
27+
void Plugin::handleQuery(Core::Query */*query*/) const
3028
{
3129
/*
3230
* Check the include headers to see how things work.

template/src/plugin.h

+4-10
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,19 @@
22

33
#pragma once
44
#include <QLoggingCategory>
5-
#include <QPointer>
65
#include "albert.h"
6+
//#include "logging.h"
77
Q_DECLARE_LOGGING_CATEGORY(qlc)
88

9-
class ConfigWidget;
109

11-
12-
class Plugin final :
13-
public Core::NativeExtensionPlugin,
14-
public Core::QueryHandler
10+
class Plugin final : public Core::QueryHandlerPlugin
1511
{
1612
Q_OBJECT
1713
ALBERT_PLUGIN
1814
public:
1915
Plugin();
2016

21-
QWidget* settingsWidget() override;
17+
QWidget* createSettingsWidget() override;
2218
void handleQuery(Core::Query * query) const override;
23-
24-
private:
25-
QPointer<ConfigWidget> widget_;
2619
};
20+

websearch/metadata.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "websearch",
3-
"name": "WebSearch",
4-
"version": "1.0",
3+
"name": "Web Search",
4+
"version": "1.1",
55
"authors": ["@manuelschneid3r"],
66
"enabledbydefault": true
77
}

websearch/src/plugin.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Q_LOGGING_CATEGORY(qlc, "websearch")
2424
#define INFO qCInfo(qlc,).noquote()
2525
#define WARN qCWarning(qlc,).noquote()
2626
#define CRIT qCCritical(qlc,).noquote()
27-
using namespace Core;
2827
using namespace std;
28+
using namespace Core;
2929

3030

3131
namespace {
@@ -50,7 +50,7 @@ shared_ptr<Core::Item> buildWebsearchItem(const SearchEngine &se, const QString
5050
se.iconPath,
5151
se.name,
5252
desc,
53-
ActionList{ makeUrlAction("Open URL", url) },
53+
Core::ActionList{ makeUrlAction("Open URL", url) },
5454
QString("%1%2").arg(se.trigger, searchterm));
5555
}
5656

@@ -63,7 +63,7 @@ Plugin::Plugin()
6363
{
6464
// Move config file from old location to new. (data -> config) TODO: REMOVE in 0.14
6565
QString oldpath = QDir(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation))
66-
.filePath(QString("%1.json").arg(Core::PluginInstance::id()));
66+
.filePath(QString("%1.json").arg(PluginInstance::id()));
6767
QString enginesJson = configLocation().filePath(ENGINES_FILE_NAME);
6868
if ( QFile::exists(oldpath) ) {
6969
if ( QFile::exists(enginesJson) )
@@ -92,7 +92,7 @@ Plugin::Plugin()
9292
}
9393

9494

95-
QWidget *Plugin::settingsWidget()
95+
QWidget *Plugin::createSettingsWidget()
9696
{
9797
if (widget_.isNull())
9898
widget_ = new ConfigWidget(this);
@@ -124,8 +124,8 @@ void Plugin::handleQuery(Core::Query * query) const
124124
// Check syntax and TLD validity
125125
if ( url.isValid() && ( query->string().startsWith("http://") || // explict scheme
126126
query->string().startsWith("https://") || // explict scheme
127-
( QRegularExpression(R"R(\S+\.\S+$)R").match(url.host()).hasMatch() &&
128-
!url.topLevelDomain().isNull()) ) ) { // valid TLD
127+
( QRegularExpression(R"R(\S+\.\S+$)R").match(url.host()).hasMatch()))) {// &&
128+
//!url.topLevelDomain().isNull()) ) ) { // valid TLD
129129

130130
QString icon = XDG::IconLookup::iconPath({"www", "web-browser", "emblem-web"});
131131

websearch/src/plugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Plugin final :
2121

2222
Plugin();
2323

24-
QWidget *settingsWidget() override;
24+
QWidget *createSettingsWidget() override;
2525
QStringList triggers() const override;
2626
void handleQuery(Core::Query * query) const override;
2727
std::vector<std::shared_ptr<Core::Item>> fallbacks(const QString &) override;

widgetboxmodel/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "widgetboxmodel",
33
"name": "Widget Box Model",
4-
"version": "1.0",
4+
"version": "1.1",
55
"load_type": "frontend",
66
"authors": ["@manuelschneider"]
77
}

widgetboxmodel/src/configwidget.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "configwidget.h"
1111
#include "frontendwidget.h"
1212
#include "ui_configwidget.h"
13-
using namespace Core;
1413

1514
class ConfigWidget::Private {
1615
public:

widgetboxmodel/src/configwidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ConfigWidget final : public QWidget
1111
Q_OBJECT
1212

1313
public:
14-
ConfigWidget(FrontendWidget *frontend, QWidget *parent);
14+
ConfigWidget(FrontendWidget *frontend, QWidget *parent = nullptr);
1515
~ConfigWidget();
1616

1717
private:

0 commit comments

Comments
 (0)