mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
[win-nix] refactoring
This commit is contained in:
@ -241,8 +241,8 @@ int CAscTabWidget::addEditor(COpenOptions& opts)
|
||||
if (res_open) {
|
||||
CAscTabData * data = new CAscTabData(opts.name);
|
||||
data->setUrl(opts.wurl);
|
||||
data->setIsLocal( opts.type == etLocalFile || opts.type == etNewFile ||
|
||||
(opts.type == etRecentFile && !CExistanceController::isFileRemote(opts.url)) );
|
||||
data->setIsLocal(opts.type == etLocalFile || opts.type == etNewFile ||
|
||||
(opts.type == etRecentFile && !CExistanceController::isFileRemote(opts.url)));
|
||||
|
||||
pView->setData(data);
|
||||
tab_index = addTab(panelwidget, opts.name);
|
||||
@ -891,7 +891,7 @@ void CAscTabWidget::setEditorOptions(int id, const wstring& option)
|
||||
|
||||
void CAscTabWidget::setFocusedView(int index)
|
||||
{
|
||||
if (!m_pMainWidget->isHidden())
|
||||
if (!isActive())
|
||||
{
|
||||
if (!QCefView::IsSupportLayers())
|
||||
{
|
||||
|
||||
@ -116,7 +116,6 @@ class CAscTabWidget : public QTabWidget, public CScalingWrapper
|
||||
typedef std::map< int, std::pair<QString, QString> > CTabIconSet;
|
||||
|
||||
public:
|
||||
QWidget* m_pMainWidget;
|
||||
QPushButton* m_pMainButton;
|
||||
|
||||
private:
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "clangater.h"
|
||||
#include "cmessage.h"
|
||||
#include "ceditortools.h"
|
||||
#include "cfilechecker.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "csplash.h"
|
||||
@ -358,6 +359,10 @@ bool CAscApplicationManagerWrapper::processCommonEvent(NSEditorApi::CAscCefMenuE
|
||||
|
||||
topWindow()->mainPanel()->createLocalFile(AscAppManager::newFileName(_f), _f);
|
||||
return true;
|
||||
} else
|
||||
if ( !(cmd.find(L"files:check") == std::wstring::npos) ) {
|
||||
CExistanceController::check(QString::fromStdWString(pData->get_Param()));
|
||||
return true;
|
||||
}
|
||||
|
||||
break; }
|
||||
@ -732,6 +737,11 @@ void CAscApplicationManagerWrapper::initializeApp()
|
||||
mainFont.setStyleStrategy( QFont::PreferAntialias );
|
||||
QApplication::setFont( mainFont );
|
||||
|
||||
wstring wparams = QString("lang=%1&username=%3&location=%2").arg(CLangater::getCurrentLangCode(), Utils::systemLocationCode()).toStdWString();
|
||||
wstring user_name = Utils::appUserName();
|
||||
|
||||
wparams.replace(wparams.find(L"%3"), 2, user_name);
|
||||
AscAppManager::getInstance().InitAdditionalEditorParams(wparams);
|
||||
}
|
||||
|
||||
CMainWindow * CAscApplicationManagerWrapper::createMainWindow(QRect& rect)
|
||||
|
||||
@ -205,10 +205,6 @@ void CCefEventsTransformer::OnEvent(QObject * target, NSEditorApi::CAscCefMenuEv
|
||||
if (cmd.compare(L"portal:logout") == 0) {
|
||||
QMetaObject::invokeMethod( target, "onPortalLogout", Qt::QueuedConnection, Q_ARG(std::wstring, pData->get_Param()) );
|
||||
} else
|
||||
if ( !(cmd.find(L"files:check") == std::wstring::npos) ) {
|
||||
QMetaObject::invokeMethod( target, "onLocalFilesCheck", Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromStdWString(pData->get_Param())) );
|
||||
} else
|
||||
if ( !(cmd.find(L"files:explore") == std::wstring::npos) ) {
|
||||
QMetaObject::invokeMethod( target, "onLocalFileLocation", Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromStdWString(pData->get_Param())) );
|
||||
|
||||
@ -93,9 +93,7 @@ public:
|
||||
|
||||
CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, uchar dpi_ratio)
|
||||
: QWidget(parent),
|
||||
CScalingWrapper(dpi_ratio),
|
||||
m_pButtonMinimize(NULL), m_pButtonMaximize(NULL), m_pButtonClose(NULL),
|
||||
m_isMaximized(false)
|
||||
CScalingWrapper(dpi_ratio)
|
||||
, m_isCustomWindow(isCustomWindow)
|
||||
, m_printData(new printdata)
|
||||
, m_mainWindowState(Qt::WindowNoState)
|
||||
@ -103,7 +101,6 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, uchar dpi_ratio)
|
||||
, m_saveAction(0)
|
||||
{
|
||||
setObjectName("mainPanel");
|
||||
connect(CExistanceController::getInstance(), &CExistanceController::checked, this, &CMainPanel::onFileChecked);
|
||||
|
||||
QGridLayout *mainGridLayout = new QGridLayout();
|
||||
mainGridLayout->setSpacing( 0 );
|
||||
@ -692,23 +689,6 @@ void CMainPanel::onLocalFilesOpen(void * data)
|
||||
RELEASEINTERFACE(pData);
|
||||
}
|
||||
|
||||
void CMainPanel::onLocalFilesCheck(QString json)
|
||||
{
|
||||
CExistanceController::check(json);
|
||||
}
|
||||
|
||||
void CMainPanel::onFileChecked(const QString& name, int uid, bool exists)
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
|
||||
if ( !exists ) {
|
||||
QJsonObject _json_obj{{QString::number(uid), exists}};
|
||||
QString json = QJsonDocument(_json_obj).toJson(QJsonDocument::Compact);
|
||||
|
||||
AscAppManager::sendCommandTo(QCEF_CAST(m_pMainWidget), "files:checked", json);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainPanel::onLocalFileLocation(QString path)
|
||||
{
|
||||
Utils::openFileLocation(path);
|
||||
|
||||
@ -137,7 +137,6 @@ public slots:
|
||||
void onLocalFilesOpen(void *);
|
||||
void onLocalFileRecent(void *);
|
||||
virtual void onLocalFileSaveAs(void *);
|
||||
void onLocalFilesCheck(QString);
|
||||
void onLocalFileLocation(QString);
|
||||
void onFileLocation(int, QString);
|
||||
void onPortalOpen(QString);
|
||||
@ -149,8 +148,6 @@ public slots:
|
||||
void onEditorAllowedClose(int);
|
||||
void onWebTitleChanged(int, std::wstring json){}
|
||||
|
||||
void onFileChecked(const QString&, int, bool);
|
||||
|
||||
protected:
|
||||
CAscTabWidget * m_pTabs;
|
||||
QPushButton* m_pButtonMain;
|
||||
@ -161,16 +158,16 @@ protected:
|
||||
private:
|
||||
std::wstring m_sDownloadName;
|
||||
|
||||
QWidget* m_pMainWidget;
|
||||
QWidget* m_pMainWidget = nullptr;
|
||||
|
||||
QPushButton* m_pButtonMinimize;
|
||||
QPushButton* m_pButtonMaximize;
|
||||
QPushButton* m_pButtonClose;
|
||||
QPushButton* m_pButtonMinimize = nullptr;
|
||||
QPushButton* m_pButtonMaximize = nullptr;
|
||||
QPushButton* m_pButtonClose = nullptr;
|
||||
QPushButton* m_pButtonProfile;
|
||||
|
||||
QHBoxLayout * m_layoutBtns;
|
||||
QWidget * m_boxTitleBtns;
|
||||
bool m_isMaximized;
|
||||
bool m_isMaximized = false;
|
||||
|
||||
CDownloadWidget * m_pWidgetDownload = Q_NULLPTR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user