Adding upstream version 0.11.2.
Signed-off-by: Alf Gaida <agaida@siduction.org>
This commit is contained in:
parent
f70ba3e769
commit
a380285a82
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
build
|
||||
*.kdev4
|
||||
pcmanfm/translations/pcmanfm-qt
|
35
CHANGELOG
35
CHANGELOG
@ -1,7 +1,40 @@
|
||||
|
||||
pcmanfm-qt-0.11.1 / 2016-09-24
|
||||
pcmanfm-qt-0.11.2 / 2016-12-21
|
||||
==============================
|
||||
|
||||
* Use static_cast instead of the C style cast
|
||||
* Fix sign-compare warnings
|
||||
* Prevent wrong clearing of filter-bar with path buttons (#432)
|
||||
* bump patch version (#429)
|
||||
* Add *da.desktop files
|
||||
* Re-layout on Changing Display Name. (#355)
|
||||
* Add Pathbar Separator
|
||||
* New tab on middle clicking a path button
|
||||
* Make dialogue "About" point out it's the Qt version of PCManFM. (#421)
|
||||
* CMake: Drop finding XCB
|
||||
* Avoid code duplication.
|
||||
* Added a wallpaper zooming option
|
||||
* Implement a "Connect to server" dialog for easily mounting remote filesystems. Add new API PCManFM::MainWindow::lastActive() to get last active window.
|
||||
* Use the new button-style path bar by default. Properly handle the editing of button-style path bar.
|
||||
* Add missing ui file.
|
||||
* Move the pcmanfm-qt_pt_BR.ts file to lxqt-l10n repo.
|
||||
* Remove context menu from toolbar and menubar
|
||||
* Support button-style path bar and adjust the layout of the view menu slightly.
|
||||
* Create pcmanfm-qt_fr.desktop
|
||||
* Create pcmanfm-qt-desktop-pref_fr.desktop
|
||||
* Adds Build PROJECT_NAME with Qt version message
|
||||
* Moved LIBFM_DATA_DIR compile definition from libfm-qt
|
||||
* Use target_compile_definitions().
|
||||
* Use the new lxqt-build-tools package
|
||||
* Added very basic .gitattributes
|
||||
* remove "building with cpack" from CMakeLists.txt - not used anymore
|
||||
* Add Catalan translations
|
||||
* Added Brazilian Portuguese Translation (pt_BR)
|
||||
|
||||
0.11.1 / 2016-09-24
|
||||
===================
|
||||
|
||||
* Release 0.11.1: Add changelog
|
||||
* Bump version to 0.11.1 (#399)
|
||||
* Extend README.md
|
||||
* Ensure the existence of libfm dir.
|
||||
|
@ -8,9 +8,11 @@ endif (POLICY CMP0063)
|
||||
|
||||
set(PCMANFM_QT_VERSION_MAJOR 0)
|
||||
set(PCMANFM_QT_VERSION_MINOR 11)
|
||||
set(PCMANFM_QT_VERSION_PATCH 1)
|
||||
set(PCMANFM_QT_VERSION_PATCH 2)
|
||||
set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH})
|
||||
|
||||
set(LXQTBT_MINIMUM_VERSION "0.1.0")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
find_package(Qt5Widgets 5.2 REQUIRED)
|
||||
@ -18,11 +20,9 @@ find_package(Qt5DBus 5.2 REQUIRED)
|
||||
find_package(Qt5LinguistTools 5.2 REQUIRED)
|
||||
find_package(Qt5X11Extras 5.2 REQUIRED)
|
||||
find_package(fm-qt REQUIRED)
|
||||
#Note: no run-time dependency on liblxqt, just a build dependency for lxqt_translate_ts/desktop
|
||||
find_package(lxqt REQUIRED)
|
||||
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(LIB_XCB REQUIRED xcb)
|
||||
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION_STRING}")
|
||||
|
||||
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
|
||||
include(GNUInstallDirs)
|
||||
@ -61,18 +61,3 @@ if(BUILD_DOCUMENTATION)
|
||||
)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
||||
|
||||
# building tarball with CPack -------------------------------------------------
|
||||
# To create a source distribution, type:
|
||||
# make package_source
|
||||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||
set(CPACK_PACKAGE_VENDOR "")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${PCMANFM_QT_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${PCMANFM_QT_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${PCMANFM_QT_VERSION_PATCH})
|
||||
set(CPACK_GENERATOR TBZ2)
|
||||
set(CPACK_SOURCE_GENERATOR TBZ2)
|
||||
set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
|
||||
include(CPack)
|
||||
|
@ -12,6 +12,7 @@ set(pcmanfm_SRCS
|
||||
desktopwindow.cpp
|
||||
desktopitemdelegate.cpp
|
||||
autorundialog.cpp
|
||||
connectserverdialog.cpp
|
||||
settings.cpp
|
||||
)
|
||||
|
||||
@ -30,6 +31,7 @@ set(pcmanfm_UIS
|
||||
desktop-preferences.ui
|
||||
desktop-folder.ui
|
||||
autorun.ui
|
||||
connect.ui
|
||||
)
|
||||
|
||||
qt5_wrap_ui(pcmanfm_UIS_H ${pcmanfm_UIS})
|
||||
@ -58,16 +60,17 @@ add_executable(pcmanfm-qt
|
||||
${QM_FILES}
|
||||
${DESKTOP_FILES}
|
||||
)
|
||||
set_property(
|
||||
TARGET pcmanfm-qt APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
PCMANFM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/pcmanfm-qt"
|
||||
PCMANFM_QT_VERSION="${PCMANFM_QT_VERSION}"
|
||||
|
||||
target_compile_definitions(pcmanfm-qt
|
||||
PRIVATE
|
||||
PCMANFM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/pcmanfm-qt"
|
||||
PCMANFM_QT_VERSION="${PCMANFM_QT_VERSION}"
|
||||
LIBFM_DATA_DIR="${PKG_FM_PREFIX}/share/libfm"
|
||||
)
|
||||
|
||||
target_include_directories(pcmanfm-qt
|
||||
PRIVATE "${LIB_XCB_INDLUDE_DIRS}"
|
||||
"${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
PRIVATE
|
||||
"${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
target_link_libraries(pcmanfm-qt
|
||||
@ -75,7 +78,6 @@ target_link_libraries(pcmanfm-qt
|
||||
Qt5::Widgets
|
||||
Qt5::DBus
|
||||
fm-qt
|
||||
"${LIB_XCB_LIBRARIES}"
|
||||
)
|
||||
|
||||
install(TARGETS pcmanfm-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
@ -22,7 +22,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">PCManFM</span></p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">PCManFM-Qt</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
@ -106,7 +106,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>PCMan File Manager
|
||||
<string>PCManFM-Qt File Manager
|
||||
|
||||
Copyright (C) 2009 - 2014 洪任諭 (Hong Jen Yee)
|
||||
|
||||
|
@ -33,26 +33,28 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCommandLineParser>
|
||||
#include <QSocketNotifier>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "applicationadaptor.h"
|
||||
#include "preferencesdialog.h"
|
||||
#include "desktoppreferencesdialog.h"
|
||||
#include <libfm-qt/mountoperation.h>
|
||||
#include "autorundialog.h"
|
||||
#include "launcher.h"
|
||||
#include <libfm-qt/filesearchdialog.h>
|
||||
#include <libfm-qt/path.h>
|
||||
#include <libfm-qt/terminal.h>
|
||||
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
#include "applicationadaptor.h"
|
||||
#include "preferencesdialog.h"
|
||||
#include "desktoppreferencesdialog.h"
|
||||
#include "autorundialog.h"
|
||||
#include "launcher.h"
|
||||
#include "xdgdir.h"
|
||||
#include "connectserverdialog.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "xdgdir.h"
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
@ -191,7 +193,7 @@ bool Application::parseCommandLineArgs() {
|
||||
QCommandLineOption setWallpaperOption(QStringList() << "w" << "set-wallpaper", tr("Set desktop wallpaper from image FILE"), tr("FILE"));
|
||||
parser.addOption(setWallpaperOption);
|
||||
|
||||
QCommandLineOption wallpaperModeOption("wallpaper-mode", tr("Set mode of desktop wallpaper. MODE=(%1)").arg("color|stretch|fit|center|tile"), tr("MODE"));
|
||||
QCommandLineOption wallpaperModeOption("wallpaper-mode", tr("Set mode of desktop wallpaper. MODE=(%1)").arg("color|stretch|fit|center|tile|zoom"), tr("MODE"));
|
||||
parser.addOption(wallpaperModeOption);
|
||||
|
||||
QCommandLineOption showPrefOption("show-pref", tr("Open Preferences dialog on the page with the specified name"), tr("NAME"));
|
||||
@ -440,10 +442,21 @@ void Application::desktopPrefrences(QString page) {
|
||||
void Application::onFindFileAccepted() {
|
||||
Fm::FileSearchDialog* dlg = static_cast<Fm::FileSearchDialog*>(sender());
|
||||
Fm::Path uri = dlg->searchUri();
|
||||
// FIXME: we should be able to open it in an existing window
|
||||
Fm::PathList paths;
|
||||
paths.pushTail(uri);
|
||||
Launcher(NULL).launchPaths(NULL, paths);
|
||||
MainWindow* window = MainWindow::lastActive();
|
||||
Launcher(window).launchPaths(NULL, paths);
|
||||
}
|
||||
|
||||
void Application::onConnectToServerAccepted() {
|
||||
ConnectServerDialog* dlg = static_cast<ConnectServerDialog*>(sender());
|
||||
QString uri = dlg->uriText();
|
||||
Fm::Path path = Fm::Path::newForStr(uri.toUtf8().constData());
|
||||
qDebug() << uri << " => " << path.toStr();
|
||||
Fm::PathList paths;
|
||||
paths.pushTail(path);
|
||||
MainWindow* window = MainWindow::lastActive();
|
||||
Launcher(window).launchPaths(NULL, paths);
|
||||
}
|
||||
|
||||
void Application::findFiles(QStringList paths) {
|
||||
@ -454,6 +467,13 @@ void Application::findFiles(QStringList paths) {
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void Application::connectToServer() {
|
||||
ConnectServerDialog* dlg = new ConnectServerDialog();
|
||||
connect(dlg, &QDialog::accepted, this, &Application::onConnectToServerAccepted);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void Application::launchFiles(QString cwd, QStringList paths, bool inNewWindow) {
|
||||
Fm::PathList pathList;
|
||||
Fm::Path cwd_path;
|
||||
@ -532,9 +552,12 @@ void Application::setWallpaper(QString path, QString modeString) {
|
||||
}
|
||||
}
|
||||
// convert mode string to value
|
||||
for(int i = 0; i < G_N_ELEMENTS(valid_wallpaper_modes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(valid_wallpaper_modes); ++i) {
|
||||
if(modeString == valid_wallpaper_modes[i]) {
|
||||
mode = (DesktopWindow::WallpaperMode)i;
|
||||
// We don't take safety checks because valid_wallpaper_modes[] is
|
||||
// defined in this function and we can clearly see that it does not
|
||||
// overflow.
|
||||
mode = static_cast<DesktopWindow::WallpaperMode>(i);
|
||||
if(mode != settings_.wallpaperMode())
|
||||
changed = true;
|
||||
break;
|
||||
|
@ -37,6 +37,7 @@ class QFileSystemWatcher;
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
class MainWindow;
|
||||
class DesktopWindow;
|
||||
class PreferencesDialog;
|
||||
class DesktopPreferencesDialog;
|
||||
@ -76,6 +77,7 @@ public:
|
||||
void editBookmarks();
|
||||
void desktopManager(bool enabled);
|
||||
void findFiles(QStringList paths = QStringList());
|
||||
void connectToServer();
|
||||
|
||||
bool desktopManagerEnabled() {
|
||||
return enableDesktopManager_;
|
||||
@ -107,6 +109,7 @@ protected Q_SLOTS:
|
||||
void reloadDesktopsAsNeeded();
|
||||
|
||||
void onFindFileAccepted();
|
||||
void onConnectToServerAccepted();
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
173
pcmanfm/connect.ui
Normal file
173
pcmanfm/connect.ui
Normal file
@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConnectServerDialog</class>
|
||||
<widget class="QDialog" name="ConnectServerDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>256</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Connect to remote server</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset theme="folder-remote"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0" colspan="4">
|
||||
<widget class="QRadioButton" name="ananymousLogin">
|
||||
<property name="text">
|
||||
<string>Anonymous &login</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="path"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QRadioButton" name="loginAsUser">
|
||||
<property name="text">
|
||||
<string>Login as &user:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="userName"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="serverType"/>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="4">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Specify remote folder to connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="host"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="port">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ConnectServerDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>254</x>
|
||||
<y>249</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ConnectServerDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>322</x>
|
||||
<y>249</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>loginAsUser</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>userName</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>65</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>163</x>
|
||||
<y>184</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
89
pcmanfm/connectserverdialog.cpp
Normal file
89
pcmanfm/connectserverdialog.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include "connectserverdialog.h"
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
ConnectServerDialog::ConnectServerDialog(QWidget *parent): QDialog(parent) {
|
||||
serverTypes = QList<ServerType>{
|
||||
{tr("SSH"), "sftp", 22, false},
|
||||
{tr("FTP"), "ftp", 21, true},
|
||||
{tr("WebDav"), "dav", 80, true},
|
||||
{tr("Secure WebDav"), "davs", 443, false},
|
||||
{tr("HTTP"), "http", 80, true},
|
||||
{tr("HTTPS"), "https", 443, true},
|
||||
};
|
||||
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.serverType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &ConnectServerDialog::onCurrentIndexChanged);
|
||||
|
||||
connect(ui.host, &QLineEdit::textChanged, this, &ConnectServerDialog::checkInput);
|
||||
connect(ui.userName, &QLineEdit::textChanged, this, &ConnectServerDialog::checkInput);
|
||||
|
||||
for(const auto& serverType: serverTypes) {
|
||||
ui.serverType->addItem(serverType.name);
|
||||
}
|
||||
|
||||
ui.serverType->setCurrentIndex(0);
|
||||
onCurrentIndexChanged(0);
|
||||
}
|
||||
|
||||
ConnectServerDialog::~ConnectServerDialog() {
|
||||
}
|
||||
|
||||
|
||||
QString ConnectServerDialog::uriText() {
|
||||
QString uri;
|
||||
int serverTypeIdx = ui.serverType->currentIndex();
|
||||
const auto& serverType = serverTypes[serverTypeIdx];
|
||||
|
||||
// make an URI from the data
|
||||
uri = QString::fromLatin1(serverType.scheme);
|
||||
uri += QStringLiteral("://");
|
||||
if(ui.loginAsUser->isChecked()) {
|
||||
uri += ui.userName->text();
|
||||
uri += '@';
|
||||
}
|
||||
|
||||
uri += ui.host->text();
|
||||
int port = ui.port->value();
|
||||
if(port != serverType.defaultPort) {
|
||||
uri += ':';
|
||||
uri += QString::number(port);
|
||||
}
|
||||
|
||||
QString path = ui.path->text();
|
||||
if(path.isEmpty() || path[0] != '/') {
|
||||
uri += '/';
|
||||
}
|
||||
uri += path;
|
||||
return uri;
|
||||
}
|
||||
|
||||
void ConnectServerDialog::onCurrentIndexChanged(int index) {
|
||||
int serverTypeIdx = ui.serverType->currentIndex();
|
||||
const auto& serverType = serverTypes[serverTypeIdx];
|
||||
ui.port->setValue(serverType.defaultPort);
|
||||
ui.ananymousLogin->setEnabled(serverType.canAnonymous);
|
||||
if(serverType.canAnonymous)
|
||||
ui.ananymousLogin->setChecked(true);
|
||||
else
|
||||
ui.loginAsUser->setChecked(true);
|
||||
ui.host->setFocus();
|
||||
checkInput();
|
||||
}
|
||||
|
||||
void ConnectServerDialog::checkInput() {
|
||||
bool valid = true;
|
||||
if(ui.host->text().isEmpty()) {
|
||||
valid = false;
|
||||
}
|
||||
else if(ui.loginAsUser->isChecked() && ui.userName->text().isEmpty()) {
|
||||
valid = false;
|
||||
}
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
}
|
||||
|
||||
} // namespace PCManFM
|
38
pcmanfm/connectserverdialog.h
Normal file
38
pcmanfm/connectserverdialog.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef CONNECTSERVERDIALOG_H
|
||||
#define CONNECTSERVERDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include "ui_connect.h"
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
class ConnectServerDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConnectServerDialog(QWidget* parent=nullptr);
|
||||
virtual ~ConnectServerDialog();
|
||||
|
||||
QString uriText();
|
||||
|
||||
private:
|
||||
struct ServerType {
|
||||
QString name;
|
||||
const char* scheme;
|
||||
int defaultPort;
|
||||
bool canAnonymous;
|
||||
};
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCurrentIndexChanged(int index);
|
||||
void checkInput();
|
||||
|
||||
private:
|
||||
Ui::ConnectServerDialog ui;
|
||||
QList<ServerType> serverTypes;
|
||||
};
|
||||
|
||||
} // namespace PCManFM
|
||||
|
||||
#endif // CONNECTSERVERDIALOG_H
|
@ -54,6 +54,7 @@ DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFl
|
||||
ui.wallpaperMode->addItem(tr("Stretch to fit the screen"), DesktopWindow::WallpaperFit);
|
||||
ui.wallpaperMode->addItem(tr("Center on the screen"), DesktopWindow::WallpaperCenter);
|
||||
ui.wallpaperMode->addItem(tr("Tile the image to fill the entire screen"), DesktopWindow::WallpaperTile);
|
||||
ui.wallpaperMode->addItem(tr("Zoom the image to fill the entire screen"), DesktopWindow::WallpaperZoom);
|
||||
int i;
|
||||
switch(settings.wallpaperMode()) {
|
||||
case DesktopWindow::WallpaperNone:
|
||||
@ -71,6 +72,9 @@ DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFl
|
||||
case DesktopWindow::WallpaperTile:
|
||||
i = 4;
|
||||
break;
|
||||
case DesktopWindow::WallpaperZoom:
|
||||
i = 5;
|
||||
break;
|
||||
default:
|
||||
i = 0;
|
||||
}
|
||||
@ -80,7 +84,7 @@ DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFl
|
||||
qDebug("wallpaper: %s", settings.wallpaper().toUtf8().data());
|
||||
ui.imageFile->setText(settings.wallpaper());
|
||||
|
||||
for(int i = 0; i < G_N_ELEMENTS(iconSizes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(iconSizes); ++i) {
|
||||
int size = iconSizes[i];
|
||||
ui.iconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||
if(settings.desktopIconSize() == size)
|
||||
|
@ -104,6 +104,7 @@ DesktopWindow::DesktopWindow(int screenNum):
|
||||
connect(proxyModel_, &Fm::ProxyFolderModel::rowsAboutToBeRemoved, this, &DesktopWindow::onRowsAboutToBeRemoved);
|
||||
connect(proxyModel_, &Fm::ProxyFolderModel::layoutChanged, this, &DesktopWindow::onLayoutChanged);
|
||||
connect(proxyModel_, &Fm::ProxyFolderModel::sortFilterChanged, this, &DesktopWindow::onModelSortFilterChanged);
|
||||
connect(proxyModel_, &Fm::ProxyFolderModel::dataChanged, this, &DesktopWindow::onDataChanged);
|
||||
connect(listView_, &QListView::indexesMoved, this, &DesktopWindow::onIndexesMoved);
|
||||
}
|
||||
|
||||
@ -306,12 +307,13 @@ void DesktopWindow::updateWallpaper() {
|
||||
if(wallpaperMode_ == WallpaperCenter) {
|
||||
image = QImage(wallpaperFile_); // load original image
|
||||
}
|
||||
else if(wallpaperMode_ == WallpaperFit) {
|
||||
else if(wallpaperMode_ == WallpaperFit || wallpaperMode_ == WallpaperZoom) {
|
||||
// calculate the desired size
|
||||
QSize origSize = QImageReader(wallpaperFile_).size(); // get the size of the original file
|
||||
if(origSize.isValid()) {
|
||||
QSize desiredSize = origSize;
|
||||
desiredSize.scale(width(), height(), Qt::KeepAspectRatio);
|
||||
Qt::AspectRatioMode mode = (wallpaperMode_ == WallpaperFit ? Qt::KeepAspectRatio : Qt::KeepAspectRatioByExpanding);
|
||||
desiredSize.scale(width(), height(), mode);
|
||||
image = loadWallpaperFile(desiredSize); // load the scaled image
|
||||
}
|
||||
}
|
||||
@ -432,6 +434,33 @@ void DesktopWindow::onModelSortFilterChanged() {
|
||||
settings.setSesktopSortFolderFirst(proxyModel_->folderFirst());
|
||||
}
|
||||
|
||||
void DesktopWindow::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) {
|
||||
/****************************************************************************
|
||||
NOTE: The display names of desktop entries and shortcuts may change without
|
||||
their files being renamed and, on such occasions, a relayout will be needed.
|
||||
Since there is no signal for that, we use the signal dataChanged() and the
|
||||
QHash displayNames_, which remembers such display names with every relayout.
|
||||
****************************************************************************/
|
||||
if(topLeft.column() == 0) {
|
||||
bool relayout(false);
|
||||
for(int i = topLeft.row(); i <= bottomRight.row(); ++i) {
|
||||
QModelIndex index = topLeft.sibling(i, 0);
|
||||
if(index.isValid() && displayNames_.contains(index)) {
|
||||
Fm::FileInfo file = proxyModel_->fileInfoFromIndex(index);
|
||||
if(displayNames_[index] != file.getDispName()) {
|
||||
relayout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(relayout) {
|
||||
queueRelayout();
|
||||
// parts of the old display name might still be visible if it's long
|
||||
listView_->viewport()->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DesktopWindow::onIndexesMoved(const QModelIndexList& indexes) {
|
||||
// remember the custom position for the items
|
||||
Q_FOREACH(const QModelIndex& index, indexes) {
|
||||
@ -505,6 +534,7 @@ void DesktopWindow::removeBottomGap() {
|
||||
// QListView does item layout in a very inflexible way, so let's do our custom layout again.
|
||||
// FIXME: this is very inefficient, but due to the design flaw of QListView, this is currently the only workaround.
|
||||
void DesktopWindow::relayoutItems() {
|
||||
displayNames_.clear();
|
||||
loadItemPositions(); // something may have changed
|
||||
// qDebug("relayoutItems()");
|
||||
if(relayoutTimer_) {
|
||||
@ -534,6 +564,9 @@ void DesktopWindow::relayoutItems() {
|
||||
QModelIndex index = proxyModel_->index(row, 0);
|
||||
int itemWidth = delegate_->sizeHint(listView_->getViewOptions(), index).width();
|
||||
Fm::FileInfo file = proxyModel_->fileInfoFromIndex(index);
|
||||
// remember display names of desktop entries and shortcuts
|
||||
if(file.isDesktopEntry() || file.isShortcut())
|
||||
displayNames_[index] = QString(file.getDispName());
|
||||
QByteArray name = file.getName();
|
||||
QHash<QByteArray, QPoint>::iterator it = customItemPos_.find(name);
|
||||
if(it != customItemPos_.end()) { // the item has a custom position
|
||||
|
@ -50,7 +50,8 @@ public:
|
||||
WallpaperStretch,
|
||||
WallpaperFit,
|
||||
WallpaperCenter,
|
||||
WallpaperTile
|
||||
WallpaperTile,
|
||||
WallpaperZoom
|
||||
};
|
||||
|
||||
explicit DesktopWindow(int screenNum);
|
||||
@ -101,6 +102,7 @@ protected Q_SLOTS:
|
||||
void onLayoutChanged();
|
||||
void onModelSortFilterChanged();
|
||||
void onIndexesMoved(const QModelIndexList& indexes);
|
||||
void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||
|
||||
void relayoutItems();
|
||||
void onStickToCurrentPos(bool toggled);
|
||||
@ -136,6 +138,7 @@ private:
|
||||
|
||||
int screenNum_;
|
||||
QHash<QByteArray, QPoint> customItemPos_;
|
||||
QHash<QModelIndex, QString> displayNames_; // only for desktop entries and shortcuts
|
||||
QTimer* relayoutTimer_;
|
||||
};
|
||||
|
||||
|
@ -112,6 +112,9 @@
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::PreventContextMenu</enum>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
@ -170,6 +173,20 @@
|
||||
<addaction name="actionDetailedList"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuToolbars">
|
||||
<property name="title">
|
||||
<string>&Toolbars</string>
|
||||
</property>
|
||||
<addaction name="actionFilter"/>
|
||||
<addaction name="actionMenu_bar"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuPathBarStyle">
|
||||
<property name="title">
|
||||
<string>Path &Bar</string>
|
||||
</property>
|
||||
<addaction name="actionLocationBar"/>
|
||||
<addaction name="actionPathButtons"/>
|
||||
</widget>
|
||||
<addaction name="actionReload"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShowHidden"/>
|
||||
@ -177,8 +194,8 @@
|
||||
<addaction name="menu_View_2"/>
|
||||
<addaction name="actionPreserveView"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFilter"/>
|
||||
<addaction name="actionMenu_bar"/>
|
||||
<addaction name="menuToolbars"/>
|
||||
<addaction name="menuPathBarStyle"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Editw">
|
||||
<property name="title">
|
||||
@ -216,6 +233,8 @@
|
||||
<addaction name="actionGoBack"/>
|
||||
<addaction name="actionGoForward"/>
|
||||
<addaction name="actionGoUp"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionConnectToServer"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Tool">
|
||||
<property name="title">
|
||||
@ -235,6 +254,9 @@
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::PreventContextMenu</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Main Toolbar</string>
|
||||
</property>
|
||||
@ -255,8 +277,8 @@
|
||||
<addaction name="actionGoForward"/>
|
||||
<addaction name="actionGoUp"/>
|
||||
<addaction name="actionReload"/>
|
||||
<addaction name="actionGo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGo"/>
|
||||
<addaction name="actionMenu"/>
|
||||
</widget>
|
||||
<action name="actionGoUp">
|
||||
@ -756,7 +778,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Menu bar</string>
|
||||
<string>&Menu bar</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Menu bar</string>
|
||||
@ -785,6 +807,27 @@
|
||||
<string>&Preserve Settings for This Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConnectToServer">
|
||||
<property name="text">
|
||||
<string>Connect to &Server</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLocationBar">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Location</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPathButtons">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Path Buttons</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -41,22 +41,26 @@
|
||||
#include <libfm-qt/utilities.h>
|
||||
#include <libfm-qt/filepropsdialog.h>
|
||||
#include <libfm-qt/pathedit.h>
|
||||
#include <libfm-qt/pathbar.h>
|
||||
#include <libfm-qt/path.h>
|
||||
#include <libfm-qt/fileinfo.h>
|
||||
#include <libfm-qt/folder.h>
|
||||
#include "ui_about.h"
|
||||
#include "application.h"
|
||||
|
||||
// #include "qmodeltest/modeltest.h"
|
||||
|
||||
using namespace Fm;
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
// static
|
||||
MainWindow* MainWindow::lastActive_ = nullptr;
|
||||
|
||||
MainWindow::MainWindow(Path path):
|
||||
QMainWindow(),
|
||||
pathEntry_(nullptr),
|
||||
pathBar_(nullptr),
|
||||
fileLauncher_(this),
|
||||
rightClickIndex(-1),
|
||||
rightClickIndex_(-1),
|
||||
updatingViewMenu_(false) {
|
||||
|
||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||
@ -131,14 +135,15 @@ MainWindow::MainWindow(Path path):
|
||||
connect(ui.splitter, &QSplitter::splitterMoved, this, &MainWindow::onSplitterMoved);
|
||||
|
||||
// path bar
|
||||
pathEntry = new Fm::PathEdit(this);
|
||||
connect(pathEntry, &Fm::PathEdit::returnPressed, this, &MainWindow::onPathEntryReturnPressed);
|
||||
connect(pathEntry, &QLineEdit::textEdited, this, &MainWindow::onPathEntryEdited);
|
||||
ui.toolBar->insertWidget(ui.actionGo, pathEntry);
|
||||
createPathBar(settings.pathBarButtons());
|
||||
if(settings.pathBarButtons())
|
||||
ui.actionPathButtons->setChecked(true);
|
||||
else
|
||||
ui.actionLocationBar->setChecked(true);
|
||||
|
||||
// add filesystem info to status bar
|
||||
fsInfoLabel = new QLabel(ui.statusbar);
|
||||
ui.statusbar->addPermanentWidget(fsInfoLabel);
|
||||
fsInfoLabel_ = new QLabel(ui.statusbar);
|
||||
ui.statusbar->addPermanentWidget(fsInfoLabel_);
|
||||
|
||||
// setup the splitter
|
||||
ui.splitter->setStretchFactor(1, 1); // only the right pane can be stretched
|
||||
@ -148,8 +153,8 @@ MainWindow::MainWindow(Path path):
|
||||
ui.splitter->setSizes(sizes);
|
||||
|
||||
// load bookmark menu
|
||||
bookmarks = Fm::Bookmarks::dup();
|
||||
g_signal_connect(bookmarks, "changed", G_CALLBACK(onBookmarksChanged), this);
|
||||
bookmarks_ = Fm::Bookmarks::dup();
|
||||
g_signal_connect(bookmarks_, "changed", G_CALLBACK(onBookmarksChanged), this);
|
||||
loadBookmarksMenu();
|
||||
|
||||
// Fix the menu groups which is not done by Qt designer
|
||||
@ -174,6 +179,11 @@ MainWindow::MainWindow(Path path):
|
||||
group->addAction(ui.actionAscending);
|
||||
group->addAction(ui.actionDescending);
|
||||
|
||||
group = new QActionGroup(ui.menuPathBarStyle);
|
||||
group->setExclusive(true);
|
||||
group->addAction(ui.actionLocationBar);
|
||||
group->addAction(ui.actionPathButtons);
|
||||
|
||||
// Add menubar actions to the main window this is necessary so that actions
|
||||
// shortcuts are still working when the menubar is hidden.
|
||||
addActions(ui.menubar->actions());
|
||||
@ -190,13 +200,11 @@ MainWindow::MainWindow(Path path):
|
||||
ui.actionMenu->setMenu(menu);
|
||||
if(ui.actionMenu->icon().isNull())
|
||||
ui.actionMenu->setIcon(QIcon::fromTheme("applications-system"));
|
||||
QList<QToolButton *> list = ui.toolBar->findChildren<QToolButton *>();
|
||||
if (!list.isEmpty())
|
||||
list.at(list.count() - 1)->setPopupMode(QToolButton::InstantPopup);
|
||||
Q_FOREACH(QAction *action, ui.toolBar->actions()) {
|
||||
if(action->isSeparator())
|
||||
action->setVisible(!settings.showMenuBar());
|
||||
}
|
||||
QToolButton* menuBtn = static_cast<QToolButton*>(ui.toolBar->widgetForAction(ui.actionMenu));
|
||||
menuBtn->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
menuSep_ = ui.toolBar->insertSeparator(ui.actionMenu);
|
||||
menuSep_->setVisible(!settings.showMenuBar());
|
||||
ui.actionMenu->setVisible(!settings.showMenuBar());
|
||||
ui.menubar->setVisible(settings.showMenuBar());
|
||||
ui.actionMenu_bar->setChecked(settings.showMenuBar());
|
||||
@ -271,8 +279,8 @@ MainWindow::MainWindow(Path path):
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
if(!bookmarks.isNull()) {
|
||||
g_signal_handlers_disconnect_by_func(bookmarks, (gpointer)G_CALLBACK(onBookmarksChanged), this);
|
||||
if(!bookmarks_.isNull()) {
|
||||
g_signal_handlers_disconnect_by_func(bookmarks_, (gpointer)G_CALLBACK(onBookmarksChanged), this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,6 +294,23 @@ void MainWindow::chdir(Path path) {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::createPathBar(bool usePathButtons) {
|
||||
QWidget* bar;
|
||||
if(usePathButtons) {
|
||||
bar = pathBar_ = new Fm::PathBar(this);
|
||||
connect(pathBar_, &Fm::PathBar::chdir, this, &MainWindow::onPathBarChdir);
|
||||
connect(pathBar_, &Fm::PathBar::middleClickChdir, this, &MainWindow::onPathBarMiddleClickChdir);
|
||||
connect(pathBar_, &Fm::PathBar::editingFinished, this, &MainWindow::onResetFocus);
|
||||
}
|
||||
else {
|
||||
bar = pathEntry_ = new Fm::PathEdit(this);
|
||||
connect(pathEntry_, &Fm::PathEdit::returnPressed, this, &MainWindow::onPathEntryReturnPressed);
|
||||
connect(pathEntry_, &QLineEdit::textEdited, this, &MainWindow::onPathEntryEdited);
|
||||
}
|
||||
ui.toolBar->insertWidget(ui.actionGo, bar);
|
||||
ui.actionGo->setVisible(!usePathButtons);
|
||||
}
|
||||
|
||||
// add a new tab
|
||||
int MainWindow::addTab(Path path) {
|
||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||
@ -325,16 +350,13 @@ void MainWindow::toggleMenuBar(bool checked) {
|
||||
|
||||
ui.menubar->setVisible(showMenuBar);
|
||||
ui.actionMenu_bar->setChecked(showMenuBar);
|
||||
Q_FOREACH(QAction *action, ui.toolBar->actions()) {
|
||||
if(action->isSeparator())
|
||||
action->setVisible(!showMenuBar);
|
||||
}
|
||||
menuSep_->setVisible(!showMenuBar);
|
||||
ui.actionMenu->setVisible(!showMenuBar);
|
||||
settings.setShowMenuBar(showMenuBar);
|
||||
}
|
||||
|
||||
void MainWindow::onPathEntryReturnPressed() {
|
||||
QString text = pathEntry->text();
|
||||
QString text = pathEntry_->text();
|
||||
QByteArray utext = text.toUtf8();
|
||||
chdir(Fm::Path::newForDisplayName(utext));
|
||||
}
|
||||
@ -343,10 +365,22 @@ void MainWindow::onPathEntryEdited(const QString& text) {
|
||||
QString realText(text);
|
||||
if(realText == "~" || realText.startsWith("~/")) {
|
||||
realText.replace(0, 1, QDir::homePath());
|
||||
pathEntry->setText(realText);
|
||||
pathEntry_->setText(realText);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onPathBarChdir(FmPath* dirPath) {
|
||||
// call chdir() only when needed because otherwise
|
||||
// filter bar will be cleard on changing current tab
|
||||
TabPage* page = currentPage();
|
||||
if(page && dirPath != page->path())
|
||||
chdir(dirPath);
|
||||
}
|
||||
|
||||
void MainWindow::onPathBarMiddleClickChdir(FmPath* dirPath) {
|
||||
addTab(dirPath);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGoUp_triggered() {
|
||||
TabPage* page = currentPage();
|
||||
|
||||
@ -383,7 +417,13 @@ void MainWindow::on_actionHome_triggered() {
|
||||
|
||||
void MainWindow::on_actionReload_triggered() {
|
||||
currentPage()->reload();
|
||||
pathEntry->setText(currentPage()->pathName());
|
||||
if(pathEntry_ != nullptr)
|
||||
pathEntry_->setText(currentPage()->pathName());
|
||||
}
|
||||
|
||||
void MainWindow::on_actionConnectToServer_triggered() {
|
||||
Application* app = static_cast<Application*>(qApp);
|
||||
app->connectToServer();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGo_triggered() {
|
||||
@ -518,6 +558,32 @@ void MainWindow::on_actionFilter_triggered(bool checked) {
|
||||
static_cast<Application*>(qApp)->settings().setShowFilter(checked);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionLocationBar_triggered(bool checked) {
|
||||
if(checked) {
|
||||
// show current path in a location bar entry
|
||||
if(pathBar_ != nullptr) {
|
||||
delete pathBar_;
|
||||
pathBar_ = nullptr;
|
||||
}
|
||||
createPathBar(false);
|
||||
pathEntry_->setText(currentPage()->pathName());
|
||||
static_cast<Application*>(qApp)->settings().setPathBarButtons(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionPathButtons_triggered(bool checked) {
|
||||
if(checked && pathBar_ == nullptr) {
|
||||
// show current path as buttons
|
||||
if(pathEntry_ != nullptr) {
|
||||
delete pathEntry_;
|
||||
pathEntry_ = nullptr;
|
||||
}
|
||||
createPathBar(true);
|
||||
pathBar_->setPath(currentPage()->path());
|
||||
static_cast<Application*>(qApp)->settings().setPathBarButtons(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionComputer_triggered() {
|
||||
chdir(Fm::Path::newForUri("computer:///"));
|
||||
}
|
||||
@ -544,7 +610,7 @@ void MainWindow::on_actionAddToBookmarks_triggered() {
|
||||
Fm::Path cwd = page->path();
|
||||
if(!cwd.isNull()) {
|
||||
char* dispName = cwd.displayBasename();
|
||||
bookmarks.insert(cwd, dispName, -1);
|
||||
bookmarks_.insert(cwd, dispName, -1);
|
||||
g_free(dispName);
|
||||
}
|
||||
}
|
||||
@ -654,6 +720,9 @@ void MainWindow::resizeEvent(QResizeEvent *event) {
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if(lastActive_ == this)
|
||||
lastActive_ = nullptr;
|
||||
|
||||
QWidget::closeEvent(event);
|
||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||
if(settings.rememberWindowSize()) {
|
||||
@ -681,8 +750,8 @@ void MainWindow::updateStatusBarForCurrentPage() {
|
||||
ui.statusbar->showMessage(text);
|
||||
|
||||
text = tabPage->statusText(TabPage::StatusTextFSInfo);
|
||||
fsInfoLabel->setText(text);
|
||||
fsInfoLabel->setVisible(!text.isEmpty());
|
||||
fsInfoLabel_->setText(text);
|
||||
fsInfoLabel_->setVisible(!text.isEmpty());
|
||||
}
|
||||
|
||||
void MainWindow::updateViewMenuForCurrentPage() {
|
||||
@ -743,9 +812,14 @@ void MainWindow::updateUIForCurrentPage() {
|
||||
|
||||
if(tabPage) {
|
||||
setWindowTitle(tabPage->title());
|
||||
pathEntry->setText(tabPage->pathName());
|
||||
if(pathEntry_ != nullptr) {
|
||||
pathEntry_->setText(tabPage->pathName());
|
||||
}
|
||||
else if(pathBar_ != nullptr) {
|
||||
pathBar_->setPath(tabPage->path());
|
||||
}
|
||||
ui.statusbar->showMessage(tabPage->statusText());
|
||||
fsInfoLabel->setText(tabPage->statusText(TabPage::StatusTextFSInfo));
|
||||
fsInfoLabel_->setText(tabPage->statusText(TabPage::StatusTextFSInfo));
|
||||
tabPage->folderView()->childView()->setFocus();
|
||||
|
||||
// update side pane
|
||||
@ -804,8 +878,8 @@ void MainWindow::onTabPageStatusChanged(int type, QString statusText) {
|
||||
break;
|
||||
}
|
||||
case TabPage::StatusTextFSInfo:
|
||||
fsInfoLabel->setText(tabPage->statusText(TabPage::StatusTextFSInfo));
|
||||
fsInfoLabel->setVisible(!statusText.isEmpty());
|
||||
fsInfoLabel_->setText(tabPage->statusText(TabPage::StatusTextFSInfo));
|
||||
fsInfoLabel_->setVisible(!statusText.isEmpty());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -879,7 +953,7 @@ void MainWindow::onSplitterMoved(int pos, int index) {
|
||||
}
|
||||
|
||||
void MainWindow::loadBookmarksMenu() {
|
||||
GList* allBookmarks = bookmarks.getAll();
|
||||
GList* allBookmarks = bookmarks_.getAll();
|
||||
QAction* before = ui.actionAddToBookmarks;
|
||||
|
||||
for(GList* l = allBookmarks; l; l = l->next) {
|
||||
@ -999,6 +1073,16 @@ void MainWindow::setRTLIcons(bool isRTL) {
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::event(QEvent* event) {
|
||||
switch(event->type()) {
|
||||
case QEvent::WindowActivate:
|
||||
lastActive_ = this;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QMainWindow::event(event);
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent *event) {
|
||||
switch(event->type()) {
|
||||
case QEvent::LayoutDirectionChange:
|
||||
@ -1045,15 +1129,15 @@ void MainWindow::tabContextMenu(const QPoint& pos) {
|
||||
int tabNum = ui.tabBar->count();
|
||||
if(tabNum <= 1) return;
|
||||
|
||||
rightClickIndex = ui.tabBar->tabAt(pos);
|
||||
if(rightClickIndex < 0) return;
|
||||
rightClickIndex_ = ui.tabBar->tabAt(pos);
|
||||
if(rightClickIndex_ < 0) return;
|
||||
|
||||
QMenu menu;
|
||||
if(rightClickIndex > 0)
|
||||
if(rightClickIndex_ > 0)
|
||||
menu.addAction(ui.actionCloseLeft);
|
||||
if(rightClickIndex < tabNum - 1) {
|
||||
if(rightClickIndex_ < tabNum - 1) {
|
||||
menu.addAction(ui.actionCloseRight);
|
||||
if(rightClickIndex > 0) {
|
||||
if(rightClickIndex_ > 0) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(ui.actionCloseOther);
|
||||
}
|
||||
@ -1062,22 +1146,26 @@ void MainWindow::tabContextMenu(const QPoint& pos) {
|
||||
}
|
||||
|
||||
void MainWindow::closeLeftTabs() {
|
||||
while(rightClickIndex > 0) {
|
||||
closeTab(rightClickIndex - 1);
|
||||
--rightClickIndex;
|
||||
while(rightClickIndex_ > 0) {
|
||||
closeTab(rightClickIndex_ - 1);
|
||||
--rightClickIndex_;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeRightTabs() {
|
||||
if(rightClickIndex < 0) return;
|
||||
while(rightClickIndex < ui.tabBar->count() - 1)
|
||||
closeTab(rightClickIndex + 1);
|
||||
if(rightClickIndex_ < 0) return;
|
||||
while(rightClickIndex_ < ui.tabBar->count() - 1)
|
||||
closeTab(rightClickIndex_ + 1);
|
||||
}
|
||||
|
||||
void MainWindow::focusPathEntry() {
|
||||
if(pathEntry != nullptr) {
|
||||
pathEntry->setFocus();
|
||||
pathEntry->selectAll();
|
||||
// use text entry for the path bar
|
||||
if(pathEntry_ != nullptr) {
|
||||
pathEntry_->setFocus();
|
||||
pathEntry_->selectAll();
|
||||
}
|
||||
else if (pathBar_ != nullptr) { // use button-style path bar
|
||||
pathBar_->openEditor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,11 @@
|
||||
#include <libfm-qt/bookmarks.h>
|
||||
#include <libfm-qt/path.h>
|
||||
|
||||
namespace Fm {
|
||||
class PathEdit;
|
||||
class PathBar;
|
||||
}
|
||||
|
||||
namespace PCManFM {
|
||||
|
||||
class TabPage;
|
||||
@ -55,10 +60,16 @@ public:
|
||||
|
||||
void updateFromSettings(Settings& settings);
|
||||
|
||||
static MainWindow* lastActive() {
|
||||
return lastActive_;
|
||||
}
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
||||
void onPathEntryReturnPressed();
|
||||
void onPathEntryEdited(const QString& text);
|
||||
void onPathBarChdir(FmPath* dirPath);
|
||||
void onPathBarMiddleClickChdir(FmPath* dirPath);
|
||||
|
||||
void on_actionNewTab_triggered();
|
||||
void on_actionNewWin_triggered();
|
||||
@ -83,6 +94,7 @@ protected Q_SLOTS:
|
||||
void on_actionGoUp_triggered();
|
||||
void on_actionHome_triggered();
|
||||
void on_actionReload_triggered();
|
||||
void on_actionConnectToServer_triggered();
|
||||
|
||||
void on_actionIconView_triggered();
|
||||
void on_actionCompactView_triggered();
|
||||
@ -104,6 +116,9 @@ protected Q_SLOTS:
|
||||
void on_actionCaseSensitive_triggered(bool checked);
|
||||
void on_actionFilter_triggered(bool checked);
|
||||
|
||||
void on_actionLocationBar_triggered(bool checked);
|
||||
void on_actionPathButtons_triggered(bool checked);
|
||||
|
||||
void on_actionApplications_triggered();
|
||||
void on_actionComputer_triggered();
|
||||
void on_actionTrash_triggered();
|
||||
@ -160,27 +175,33 @@ protected Q_SLOTS:
|
||||
void toggleMenuBar(bool checked);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event);
|
||||
bool event(QEvent* event) override;
|
||||
void changeEvent(QEvent *event) override;
|
||||
void closeTab(int index);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private:
|
||||
static void onBookmarksChanged(FmBookmarks* bookmarks, MainWindow* pThis);
|
||||
static void onBookmarksChanged(FmBookmarks* bookmarks_, MainWindow* pThis);
|
||||
void loadBookmarksMenu();
|
||||
void updateUIForCurrentPage();
|
||||
void updateViewMenuForCurrentPage();
|
||||
void updateStatusBarForCurrentPage();
|
||||
void setRTLIcons(bool isRTL);
|
||||
void createPathBar(bool usePathButtons);
|
||||
|
||||
private:
|
||||
Ui::MainWindow ui;
|
||||
QLineEdit* pathEntry;
|
||||
QLabel* fsInfoLabel;
|
||||
Fm::Bookmarks bookmarks;
|
||||
Fm::PathEdit* pathEntry_;
|
||||
Fm::PathBar* pathBar_;
|
||||
QLabel* fsInfoLabel_;
|
||||
Fm::Bookmarks bookmarks_;
|
||||
Launcher fileLauncher_;
|
||||
int rightClickIndex;
|
||||
int rightClickIndex_;
|
||||
bool updatingViewMenu_;
|
||||
QAction* menuSep_;
|
||||
|
||||
static MainWindow* lastActive_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -132,14 +132,13 @@ void PreferencesDialog::initArchivers(Settings& settings) {
|
||||
void PreferencesDialog::initDisplayPage(Settings& settings) {
|
||||
initIconThemes(settings);
|
||||
// icon sizes
|
||||
int i;
|
||||
for(i = 0; i < G_N_ELEMENTS(bigIconSizes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(bigIconSizes); ++i) {
|
||||
int size = bigIconSizes[i];
|
||||
ui.bigIconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||
if(settings.bigIconSize() == size)
|
||||
ui.bigIconSize->setCurrentIndex(i);
|
||||
}
|
||||
for(i = 0; i < G_N_ELEMENTS(smallIconSizes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(smallIconSizes); ++i) {
|
||||
int size = smallIconSizes[i];
|
||||
QString text = QString("%1 x %1").arg(size);
|
||||
ui.smallIconSize->addItem(text, size);
|
||||
@ -150,7 +149,7 @@ void PreferencesDialog::initDisplayPage(Settings& settings) {
|
||||
if(settings.sidePaneIconSize() == size)
|
||||
ui.sidePaneIconSize->setCurrentIndex(i);
|
||||
}
|
||||
for(i = 0; i < G_N_ELEMENTS(thumbnailIconSizes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(thumbnailIconSizes); ++i) {
|
||||
int size = thumbnailIconSizes[i];
|
||||
ui.thumbnailIconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||
if(settings.thumbnailIconSize() == size)
|
||||
@ -196,7 +195,7 @@ void PreferencesDialog::initBehaviorPage(Settings& settings) {
|
||||
Fm::FolderView::ThumbnailMode,
|
||||
Fm::FolderView::DetailedListMode
|
||||
};
|
||||
for(int i = 0; i < G_N_ELEMENTS(modes); ++i) {
|
||||
for(std::size_t i = 0; i < G_N_ELEMENTS(modes); ++i) {
|
||||
if(modes[i] == settings.viewMode()) {
|
||||
ui.viewMode->setCurrentIndex(i);
|
||||
break;
|
||||
|
@ -91,6 +91,7 @@ Settings::Settings():
|
||||
sortFolderFirst_(true),
|
||||
sortCaseSensitive_(false),
|
||||
showFilter_(false),
|
||||
pathBarButtons_(true),
|
||||
// settings for use with libfm
|
||||
singleClick_(false),
|
||||
autoSelectionDelay_(600),
|
||||
@ -279,6 +280,7 @@ bool Settings::loadFile(QString filePath) {
|
||||
sidePaneMode_ = sidePaneModeFromString(settings.value("SidePaneMode").toString());
|
||||
showMenuBar_ = settings.value("ShowMenuBar", true).toBool();
|
||||
fullWidthTabBar_ = settings.value("FullWidthTabBar", true).toBool();
|
||||
pathBarButtons_ = settings.value("PathBarButtons", true).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
return true;
|
||||
@ -388,6 +390,7 @@ bool Settings::saveFile(QString filePath) {
|
||||
settings.setValue("SidePaneMode", sidePaneModeToString(sidePaneMode_));
|
||||
settings.setValue("ShowMenuBar", showMenuBar_);
|
||||
settings.setValue("FullWidthTabBar", fullWidthTabBar_);
|
||||
settings.setValue("PathBarButtons", pathBarButtons_);
|
||||
settings.endGroup();
|
||||
|
||||
// save per-folder settings
|
||||
@ -524,6 +527,9 @@ static const char* wallpaperModeToString(int value) {
|
||||
case DesktopWindow::WallpaperTile:
|
||||
ret = "tile";
|
||||
break;
|
||||
case DesktopWindow::WallpaperZoom:
|
||||
ret = "zoom";
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -538,6 +544,8 @@ static int wallpaperModeFromString(const QString str) {
|
||||
ret = DesktopWindow::WallpaperCenter;
|
||||
else if(str == "tile")
|
||||
ret = DesktopWindow::WallpaperTile;
|
||||
else if(str == "zoom")
|
||||
ret = DesktopWindow::WallpaperZoom;
|
||||
else
|
||||
ret = DesktopWindow::WallpaperNone;
|
||||
return ret;
|
||||
|
@ -534,6 +534,14 @@ public:
|
||||
showFilter_ = value;
|
||||
}
|
||||
|
||||
bool pathBarButtons() const {
|
||||
return pathBarButtons_;
|
||||
}
|
||||
|
||||
void setPathBarButtons(bool value) {
|
||||
pathBarButtons_ = value;
|
||||
}
|
||||
|
||||
// settings for use with libfm
|
||||
bool singleClick() const {
|
||||
return singleClick_;
|
||||
@ -790,6 +798,7 @@ private:
|
||||
bool sortFolderFirst_;
|
||||
bool sortCaseSensitive_;
|
||||
bool showFilter_;
|
||||
bool pathBarButtons_;
|
||||
|
||||
// settings for use with libfm
|
||||
bool singleClick_;
|
||||
|
3
pcmanfm/translations/pcmanfm-qt-desktop-pref_ca.desktop
Normal file
3
pcmanfm/translations/pcmanfm-qt-desktop-pref_ca.desktop
Normal file
@ -0,0 +1,3 @@
|
||||
Name[ca]=Escriptori
|
||||
GenericName[ca]=Ajusts de l'escriptori
|
||||
Comment[ca]=Canvieu les imatges dels fons i el comportament del gestor d'escriptoris
|
3
pcmanfm/translations/pcmanfm-qt-desktop-pref_da.desktop
Normal file
3
pcmanfm/translations/pcmanfm-qt-desktop-pref_da.desktop
Normal file
@ -0,0 +1,3 @@
|
||||
Name[da]=Skrivebord
|
||||
GenericName[da]=Skrivebordsindstillinger
|
||||
Comment[da]=Skift desktop managerens tapeter og adfærd
|
4
pcmanfm/translations/pcmanfm-qt-desktop-pref_fr.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt-desktop-pref_fr.desktop
Normal file
@ -0,0 +1,4 @@
|
||||
#Translations
|
||||
Name[fr]=Bureau
|
||||
GenericName[fr]=Paramétrage du bureau
|
||||
Comment[fr]=Paramètres tels que papier-peint et autres réglages du bureau
|
4
pcmanfm/translations/pcmanfm-qt_ca.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt_ca.desktop
Normal file
@ -0,0 +1,4 @@
|
||||
#Translations
|
||||
Name[ca]=Gestor de fitxers PCManFM
|
||||
GenericName[ca]=Gestor de fitxers
|
||||
Comment[ca]=Navegueu pel sistema de fitxers i gestioneu els fitxers
|
3
pcmanfm/translations/pcmanfm-qt_da.desktop
Normal file
3
pcmanfm/translations/pcmanfm-qt_da.desktop
Normal file
@ -0,0 +1,3 @@
|
||||
Name[da]=PCManFM-filhåndtering
|
||||
GenericName[da]=Filhåndtering
|
||||
Comment[da]=Gennemse filsystemet og håndtér filerne
|
4
pcmanfm/translations/pcmanfm-qt_fr.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt_fr.desktop
Normal file
@ -0,0 +1,4 @@
|
||||
#Translations
|
||||
Name[fr]=PCManFM-Qt
|
||||
GenericName[fr]=Gestionnaire de fichiers
|
||||
Comment[fr]=Gestionnaire de fichiers de l'environnement LXQt
|
4
pcmanfm/translations/pcmanfm-qt_pt_BR.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt_pt_BR.desktop
Normal file
@ -0,0 +1,4 @@
|
||||
#Translations
|
||||
Name[pt_BR]=Gerenciador de Arquivos PCManFM
|
||||
GenericName[pt_BR]=Gerenciador de Arquivos
|
||||
Comment[pt_BR]=Navegue pelo sistema de arquivos e gerencie arquivos e pastas
|
Loading…
x
Reference in New Issue
Block a user