small fixes
This commit is contained in:
parent
8d672465dc
commit
ae1f145e17
|
@ -259,7 +259,6 @@ std::unique_ptr<Package> AlpmDatabase::emptyPackage()
|
||||||
*/
|
*/
|
||||||
void AlpmDatabase::databaseDownloadFinished()
|
void AlpmDatabase::databaseDownloadFinished()
|
||||||
{
|
{
|
||||||
removeBusyFlag();
|
|
||||||
auto *reply = static_cast<QNetworkReply *>(sender());
|
auto *reply = static_cast<QNetworkReply *>(sender());
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
bool filesDatabase = reply->property("filesDatabase").toBool();
|
bool filesDatabase = reply->property("filesDatabase").toBool();
|
||||||
|
@ -274,6 +273,7 @@ void AlpmDatabase::databaseDownloadFinished()
|
||||||
if(!QFile::rename(newDatabasePath, backupFile)) {
|
if(!QFile::rename(newDatabasePath, backupFile)) {
|
||||||
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to rename present database file." << endl;
|
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to rename present database file." << endl;
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
|
removeBusyFlag();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,10 +285,11 @@ void AlpmDatabase::databaseDownloadFinished()
|
||||||
QWriteLocker locker(lock());
|
QWriteLocker locker(lock());
|
||||||
m_dbPath = newDatabasePath;
|
m_dbPath = newDatabasePath;
|
||||||
}
|
}
|
||||||
initAsSoonAsPossible();
|
init();
|
||||||
} else {
|
} else {
|
||||||
locker.relock();
|
locker.relock();
|
||||||
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to create/write output file." << endl;
|
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to create/write output file." << endl;
|
||||||
|
removeBusyFlag();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
|
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
|
||||||
|
@ -296,6 +297,8 @@ void AlpmDatabase::databaseDownloadFinished()
|
||||||
cerr << "-> Attempting to download regular database file instead of files database file." << endl;
|
cerr << "-> Attempting to download regular database file instead of files database file." << endl;
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
downloadDatabase(m_downloadTargetDir, false);
|
downloadDatabase(m_downloadTargetDir, false);
|
||||||
|
} else {
|
||||||
|
removeBusyFlag();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,8 +498,8 @@ void Manager::initAlpmDataBases()
|
||||||
if(localDatabase()) {
|
if(localDatabase()) {
|
||||||
loaders << static_cast<AlpmPackageLoader *>(localDatabase()->init());
|
loaders << static_cast<AlpmPackageLoader *>(localDatabase()->init());
|
||||||
}
|
}
|
||||||
for(auto &syncDbEntry : m_syncDbMap) {
|
for(auto &syncDb : m_syncDbs) {
|
||||||
loaders << static_cast<AlpmPackageLoader *>(syncDbEntry.second->init());
|
loaders << static_cast<AlpmPackageLoader *>(syncDb->init());
|
||||||
}
|
}
|
||||||
for(auto *loader : loaders) {
|
for(auto *loader : loaders) {
|
||||||
if(loader) {
|
if(loader) {
|
||||||
|
|
|
@ -58,17 +58,17 @@ public:
|
||||||
void setWriteCacheBeforeGone(bool writeCacheBeforeGone);
|
void setWriteCacheBeforeGone(bool writeCacheBeforeGone);
|
||||||
bool isAutoCacheMaintenanceEnabled() const;
|
bool isAutoCacheMaintenanceEnabled() const;
|
||||||
void setAutoCacheMaintenanceEnabled(bool enabled);
|
void setAutoCacheMaintenanceEnabled(bool enabled);
|
||||||
void writeCache();
|
Q_SLOT void writeCache();
|
||||||
void restoreCache();
|
Q_SLOT void restoreCache();
|
||||||
void cleanCache();
|
Q_SLOT void cleanCache();
|
||||||
void wipeCache();
|
Q_SLOT void wipeCache();
|
||||||
void maintainCache();
|
Q_SLOT void maintainCache();
|
||||||
|
|
||||||
// updating
|
// updating
|
||||||
bool isAutoUpdateEnabled() const;
|
bool isAutoUpdateEnabled() const;
|
||||||
void setAutoUpdateEnabled(bool enabled);
|
void setAutoUpdateEnabled(bool enabled);
|
||||||
void updateAlpmDatabases();
|
Q_SLOT void updateAlpmDatabases();
|
||||||
void forceUpdateAlpmDatabases();
|
Q_SLOT void forceUpdateAlpmDatabases();
|
||||||
|
|
||||||
// package lookup
|
// package lookup
|
||||||
AlpmPackage *packageFromDatabase(const QString &dbName, const QString &pkgName);
|
AlpmPackage *packageFromDatabase(const QString &dbName, const QString &pkgName);
|
||||||
|
|
10
gui/main.cpp
10
gui/main.cpp
|
@ -58,6 +58,7 @@ int main(int argc, char *argv[])
|
||||||
if(qtConfigArgs.qtWidgetsGuiArg().isPresent()) {
|
if(qtConfigArgs.qtWidgetsGuiArg().isPresent()) {
|
||||||
// configure Qt
|
// configure Qt
|
||||||
qtConfigArgs.applySettings();
|
qtConfigArgs.applySettings();
|
||||||
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
// find directory with web files
|
// find directory with web files
|
||||||
QString webdir;
|
QString webdir;
|
||||||
|
@ -67,11 +68,6 @@ int main(int argc, char *argv[])
|
||||||
webdir = QStringLiteral("/usr/share/" PROJECT_NAME "/web");
|
webdir = QStringLiteral("/usr/share/" PROJECT_NAME "/web");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create app
|
|
||||||
QApplication application(argc, argv);
|
|
||||||
MainWindow mainWindow(webdir);
|
|
||||||
mainWindow.show();
|
|
||||||
|
|
||||||
// setup manager
|
// setup manager
|
||||||
Manager manager(config);
|
Manager manager(config);
|
||||||
cerr << shchar << "Loading databases ..." << endl;
|
cerr << shchar << "Loading databases ..." << endl;
|
||||||
|
@ -89,6 +85,10 @@ int main(int argc, char *argv[])
|
||||||
manager.setAutoCacheMaintenanceEnabled(true);
|
manager.setAutoCacheMaintenanceEnabled(true);
|
||||||
manager.setAutoUpdateEnabled(true);
|
manager.setAutoUpdateEnabled(true);
|
||||||
|
|
||||||
|
// create app
|
||||||
|
MainWindow mainWindow(webdir, &manager);
|
||||||
|
mainWindow.show();
|
||||||
|
|
||||||
// run Qt event loop
|
// run Qt event loop
|
||||||
return application.exec();
|
return application.exec();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "./mainwindow.h"
|
#include "./mainwindow.h"
|
||||||
#include "./webpage.h"
|
#include "./webpage.h"
|
||||||
|
|
||||||
|
#include "../alpm/manager.h"
|
||||||
|
|
||||||
#include "resources/config.h"
|
#include "resources/config.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
@ -17,7 +19,9 @@ namespace RepoIndex {
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructs a new main window.
|
* \brief Constructs a new main window.
|
||||||
*/
|
*/
|
||||||
MainWindow::MainWindow(const QString &webdir)
|
MainWindow::MainWindow(const QString &webdir, Manager *manager) :
|
||||||
|
m_manager(manager),
|
||||||
|
m_contextMenu(nullptr)
|
||||||
{
|
{
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||||
setWindowTitle(QStringLiteral(APP_NAME));
|
setWindowTitle(QStringLiteral(APP_NAME));
|
||||||
|
@ -79,12 +83,24 @@ bool MainWindow::event(QEvent *event)
|
||||||
*/
|
*/
|
||||||
void MainWindow::showInfoWebViewContextMenu(const QPoint &)
|
void MainWindow::showInfoWebViewContextMenu(const QPoint &)
|
||||||
{
|
{
|
||||||
QAction copyAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), nullptr);
|
if(!m_contextMenu) {
|
||||||
copyAction.setDisabled(m_webView.selectedText().isEmpty());
|
m_contextMenu = new QMenu(this);
|
||||||
connect(©Action, &QAction::triggered, this, &MainWindow::copyInfoWebViewSelection);
|
auto *reloadAction = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), tr("Reload UI"), m_contextMenu);
|
||||||
QMenu menu;
|
connect(reloadAction, &QAction::triggered, &m_webView, &WEB_VIEW_PROVIDER::reload);
|
||||||
menu.addAction(©Action);
|
m_copyAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), m_contextMenu);
|
||||||
menu.exec(QCursor::pos());
|
connect(m_copyAction, &QAction::triggered, this, &MainWindow::copyInfoWebViewSelection);
|
||||||
|
auto *updateAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-download")), tr("Update sync-databases"), m_contextMenu);
|
||||||
|
connect(updateAction, &QAction::triggered, m_manager, &Manager::forceUpdateAlpmDatabases);
|
||||||
|
auto *wipeCacheAction = new QAction(QIcon::fromTheme(QStringLiteral("document-revert")), tr("Wipe cached packages"), m_contextMenu);
|
||||||
|
connect(wipeCacheAction, &QAction::triggered, m_manager, &Manager::wipeCache);
|
||||||
|
m_contextMenu->addAction(m_copyAction);
|
||||||
|
m_contextMenu->addAction(reloadAction);
|
||||||
|
m_contextMenu->addSeparator();
|
||||||
|
m_contextMenu->addAction(updateAction);
|
||||||
|
m_contextMenu->addAction(wipeCacheAction);
|
||||||
|
}
|
||||||
|
m_copyAction->setDisabled(m_webView.selectedText().isEmpty());
|
||||||
|
m_contextMenu->exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -12,11 +12,13 @@
|
||||||
|
|
||||||
namespace RepoIndex {
|
namespace RepoIndex {
|
||||||
|
|
||||||
|
class Manager;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow(const QString &webdir);
|
MainWindow(const QString &webdir, Manager *manager);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event);
|
bool event(QEvent *event);
|
||||||
|
@ -26,7 +28,10 @@ private slots:
|
||||||
void copyInfoWebViewSelection();
|
void copyInfoWebViewSelection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Manager *m_manager;
|
||||||
WEB_VIEW_PROVIDER m_webView;
|
WEB_VIEW_PROVIDER m_webView;
|
||||||
|
QMenu *m_contextMenu;
|
||||||
|
QAction *m_copyAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,17 @@
|
||||||
if(color) {
|
if(color) {
|
||||||
this.rowElement.style.backgroundColor = color;
|
this.rowElement.style.backgroundColor = color;
|
||||||
}
|
}
|
||||||
this.rowElement.onclick = function(e) {
|
this.rowElement.onmousedown = function(e) {
|
||||||
repoindex.pageManager.packageManager.showPackageInfoForIndex(this.entry.index, typeof e === "object" && e.button === 1);
|
if(!repoindex.isFirefox) {
|
||||||
|
repoindex.pageManager.packageManager.showPackageInfoForIndex(this.entry.index, typeof e === "object" && (e.button === 1 || e.button === 2));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.rowElement.oncontextmenu = function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// Firefox doesn't support properly support mouse events -> use context menu event to show package info
|
||||||
|
if(repoindex.isFirefox) {
|
||||||
|
repoindex.pageManager.packageManager.showPackageInfoForIndex(this.entry.index, true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.initTableRow = function() {
|
this.initTableRow = function() {
|
||||||
|
@ -155,6 +164,9 @@
|
||||||
repoindex.addField(tb, "Repository", repoindex.makeStr(entry.info.repo));
|
repoindex.addField(tb, "Repository", repoindex.makeStr(entry.info.repo));
|
||||||
}
|
}
|
||||||
repoindex.addField(tb, "Version", repoindex.makeStr(basics.ver));
|
repoindex.addField(tb, "Version", repoindex.makeStr(basics.ver));
|
||||||
|
if(basics.fdate) {
|
||||||
|
repoindex.addField(tb, "Out-of-date", "since " + repoindex.makeStr(basics.fdate)).style.color = "red";
|
||||||
|
}
|
||||||
repoindex.addField(tb, "Description", repoindex.makeStr(basics.desc));
|
repoindex.addField(tb, "Description", repoindex.makeStr(basics.desc));
|
||||||
if(basics.arch) {
|
if(basics.arch) {
|
||||||
repoindex.addField(tb, "Architecture", repoindex.makeStr(basics.arch));
|
repoindex.addField(tb, "Architecture", repoindex.makeStr(basics.arch));
|
||||||
|
@ -204,9 +216,6 @@
|
||||||
if(details.main) {
|
if(details.main) {
|
||||||
repoindex.addField(tb, "Maintainer", repoindex.makeStr(details.main));
|
repoindex.addField(tb, "Maintainer", repoindex.makeStr(details.main));
|
||||||
}
|
}
|
||||||
if(basics.flagdate) {
|
|
||||||
repoindex.addField(tb, "Out-of-date", repoindex.makeStr(basics.flagdate));
|
|
||||||
}
|
|
||||||
if(details.fsub) {
|
if(details.fsub) {
|
||||||
repoindex.addField(tb, "First submitted", repoindex.makeStr(details.fsub));
|
repoindex.addField(tb, "First submitted", repoindex.makeStr(details.fsub));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
var repoindex = (function(repoindex) {
|
var repoindex = (function(repoindex) {
|
||||||
|
|
||||||
/*!
|
// Adds a bootstrap pagination to the HTML element with the specified id
|
||||||
* \brief Adds a bootstrap pagination to the HTML element with the specified id.
|
|
||||||
*/
|
|
||||||
repoindex.Pagination = function(containerId) {
|
repoindex.Pagination = function(containerId) {
|
||||||
// basic initialization
|
// basic initialization
|
||||||
this.containerId = containerId;
|
this.containerId = containerId;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
var repoindex = (function(repoindex) {
|
var repoindex = (function(repoindex) {
|
||||||
|
|
||||||
/*!
|
// Adds bootstrap tabs to the HTML element with the specified id.
|
||||||
* \brief Adds bootstrap tabs to the HTML element with the specified id.
|
|
||||||
*/
|
|
||||||
repoindex.Tabbing = function(containerId) {
|
repoindex.Tabbing = function(containerId) {
|
||||||
// assemble required element structure
|
// assemble required element structure
|
||||||
this.containerElement = document.createElement("div");
|
this.containerElement = document.createElement("div");
|
||||||
|
|
|
@ -385,7 +385,9 @@
|
||||||
return function() {
|
return function() {
|
||||||
func.call(obj, args);
|
func.call(obj, args);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
repoindex.isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
|
||||||
|
|
||||||
return repoindex;
|
return repoindex;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue