Commit 6d935102 authored by ChangZhuo Chen's avatar ChangZhuo Chen

Imported Upstream version 0.2.0

parent c2b8d98a
......@@ -62,3 +62,16 @@ If you prefer, you can start Zeal with a query from command line:
## Creating your own docsets
You can use [Dash's instructions for generating docsets](https://kapeli.com/docsets).
## Contact and Support
We want your feedback! Here's a list of different ways to contact developers and request help:
* Report bugs and submit feature requests to [GitHub issues](https://github.com/zealdocs/zeal/issues).
* Ask any questions in our [Google Group](https://groups.google.com/d/forum/zealdocs). You can simply send an email to zealdocs@googlegroups.com.
* For a quick chat with developers and other Zeal users use our IRC channel: #zealdocs on [Freenode](https://freenode.net/). Also available through Kiwi IRC [web interface](https://kiwiirc.com/client/irc.freenode.net/#zealdocs). Please, take into consideration possible time zone differences.
* Finally, for a private communications send us [email](mailto:zeal@zealdocs.org).
* And do not forget to follow [@zealdocs](https://twitter.com/zealdocs) on Twitter!
## License
This software is licensed under the terms of the GNU General Public License version 3 (GPLv3). Full text of the license is available in the [COPYING](https://github.com/zealdocs/zeal/blob/master/COPYING) file and [online](http://opensource.org/licenses/gpl-3.0.html).
......@@ -69,7 +69,10 @@ Application::Application(const SearchQuery &query, QObject *parent) :
m_networkManager = new QNetworkAccessManager(this);
m_extractorThread = new QThread(this);
m_extractor = new Extractor();
m_docsetRegistry = new DocsetRegistry();
m_docsetRegistry->init(m_settings->docsetPath);
m_mainWindow = new MainWindow(this);
// Server for detecting already running instances
......
......@@ -72,7 +72,7 @@ CommandLineParameters parseCommandLine(const QStringList &arguments)
/// TODO: [Qt 5.4] parser.addOption({{"f", "force"}, "Force the application run."});
parser.addOption(QCommandLineOption({QStringLiteral("f"), QStringLiteral("force")},
QObject::tr("Force the application run.")));
/// TODO: [0.2.0] Remove --query support
/// TODO: [0.3.0] Remove --query support
parser.addOption(QCommandLineOption({QStringLiteral("q"), QStringLiteral("query")},
QObject::tr("[DEPRECATED] Query <search term>."),
QStringLiteral("term")));
......
......@@ -344,9 +344,6 @@ QList<SearchResult> Docset::relatedLinks(const QUrl &url) const
sectionPath += query.value(3).toString();
}
//QString parentName;
//normalizeName(sectionName, parentName);
results.append(SearchResult{sectionName, QString(),
parseSymbolType(query.value(1).toString()),
const_cast<Docset *>(this), sectionPath, QString()});
......@@ -363,22 +360,6 @@ QSqlDatabase Docset::database() const
return QSqlDatabase::database(m_name, true);
}
void Docset::normalizeName(QString &name, QString &parentName)
{
QRegExp matchMethodName(QStringLiteral("^([^\\(]+)(?:\\(.*\\))?$"));
if (matchMethodName.indexIn(name) != -1)
name = matchMethodName.cap(1);
const QStringList separators = {QStringLiteral("."), QStringLiteral("::"), QStringLiteral("/")};
for (const QString &sep : separators) {
if (name.indexOf(sep) != -1 && name.indexOf(sep) != 0) {
const QStringList splitted = name.split(sep);
name = splitted.at(splitted.size()-1);
parentName = splitted.at(splitted.size()-2);
}
}
}
void Docset::loadMetadata()
{
const QDir dir(m_path);
......
......@@ -62,14 +62,9 @@ public:
QList<SearchResult> search(const QString &query) const;
QList<SearchResult> relatedLinks(const QUrl &url) const;
QSqlDatabase database() const;
/// FIXME: This is an ugly workaround before we have a proper docset sources implementation
bool hasUpdate = false;
/// FIXME: Get rid of it
static void normalizeName(QString &name, QString &parentName);
private:
enum class Type {
Invalid,
......@@ -77,6 +72,7 @@ private:
ZDash
};
QSqlDatabase database() const;
void loadMetadata();
void countSymbols();
void loadSymbols(const QString &symbolType) const;
......
......@@ -193,6 +193,10 @@ void ListModel::addDocset(const QString &name)
void ListModel::removeDocset(const QString &name)
{
const int index = m_docsetItems.keys().indexOf(name);
/// TODO: Investigate why this can happen (see #420)
if (index == -1)
return;
beginRemoveRows(QModelIndex(), index, index);
DocsetItem *docsetItem = m_docsetItems.take(name);
......
......@@ -15,7 +15,7 @@ portable {
DEFINES += PORTABLE_BUILD
}
VERSION = 0.1.2
VERSION = 0.2.0
DEFINES += ZEAL_VERSION=\\\"$${VERSION}\\\"
HEADERS += \
......
......@@ -96,8 +96,6 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) :
// initialise key grabber
connect(m_globalShortcut, &QxtGlobalShortcut::activated, this, &MainWindow::toggleWindow);
m_application->docsetRegistry()->init(m_settings->docsetPath);
// initialise ui
ui->setupUi(this);
......@@ -128,10 +126,6 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) :
// "QAction::eventFilter: Ambiguous shortcut overload: Ctrl+Q"
ui->actionQuit->setShortcuts(QList<QKeySequence>{QKeySequence::Quit});
}
addAction(ui->actionQuit);
connect(ui->actionQuit, &QAction::triggered, [=]() {
m_settings->windowGeometry = saveGeometry();
});
connect(ui->actionQuit, &QAction::triggered, qApp, &QCoreApplication::quit);
connect(ui->actionOptions, &QAction::triggered, [=]() {
......
......@@ -140,7 +140,8 @@ void SearchEdit::showCompletions(const QString &newValue)
const int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
const int textWidth = fontMetrics().width(newValue);
m_prefixCompleter->setCompletionPrefix(text());
if (!m_prefixCompleter)
m_prefixCompleter->setCompletionPrefix(text());
const QString completed = currentCompletion(newValue).mid(newValue.size());
const QSize labelSize(fontMetrics().width(completed), size().height());
......@@ -152,7 +153,7 @@ void SearchEdit::showCompletions(const QString &newValue)
QString SearchEdit::currentCompletion(const QString &text) const
{
if (text.isEmpty())
if (text.isEmpty() || !m_prefixCompleter)
return QString();
return m_prefixCompleter->currentCompletion();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment