Skip to content

Commit

Permalink
[Fix] Fix and improvement for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
alphaonex86 committed Jul 3, 2019
1 parent 59e1a7b commit f4f607b
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 7 deletions.
1 change: 1 addition & 0 deletions CopyEngineManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra
pluginList[index].intances.push_back(pluginList.at(index).factory->getInstance());
temp.engine=pluginList.at(index).intances.back();
temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
temp.havePause=pluginList.at(index).factory->havePause();
temp.type=pluginList.at(index).type;
temp.transferListOperation=pluginList.at(index).transferListOperation;
return temp;
Expand Down
1 change: 1 addition & 0 deletions CopyEngineManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CopyEngineManager : public QObject
{
PluginInterface_CopyEngine * engine; ///< The copy engine instance
bool canDoOnlyCopy; ///< true if can do only the copy (not move)
bool havePause;
Ultracopier::CopyType type; ///< Kind of copy what it can do
Ultracopier::TransferListOperation transferListOperation;
};
Expand Down
2 changes: 2 additions & 0 deletions Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,co
newItem.action=Ultracopier::Idle;
newItem.lastProgression=0;//store the real byte transfered, used in time remaining calculation
newItem.isPaused=false;
newItem.havePause=returnInformations.havePause;
newItem.isRunning=false;
newItem.haveError=false;
newItem.lastConditionalSync.start();
Expand Down Expand Up @@ -741,6 +742,7 @@ void Core::connectInterfaceAndSync(const unsigned int &index)
currentCopyInstance.interface->setTransferListOperation(currentCopyInstance.transferListOperation);
currentCopyInstance.interface->actionInProgess(currentCopyInstance.action);
currentCopyInstance.interface->isInPause(currentCopyInstance.isPaused);
currentCopyInstance.interface->havePause(currentCopyInstance.havePause);
if(currentCopyInstance.haveError)
currentCopyInstance.interface->errorDetected();
QWidget *tempWidget=currentCopyInstance.interface->getOptionsEngineWidget();
Expand Down
1 change: 1 addition & 0 deletions Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Core : public QObject
std::string collisionAction;
std::string errorAction;
bool isPaused;
bool havePause;
bool isRunning;
Ultracopier::CopyType type;
Ultracopier::TransferListOperation transferListOperation;
Expand Down
4 changes: 3 additions & 1 deletion interface/PluginInterface_CopyEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class PluginInterface_CopyEngineFactory : public QObject
virtual std::vector<std::string> supportedProtocolsForTheDestination() const = 0;
/// \brief to get the options of the copy engine
virtual QWidget * options() = 0;
/// \brief to get if have pause
virtual bool havePause() = 0;
public slots:
/// \brief to reset the options
virtual void resetOptions() = 0;
Expand All @@ -204,7 +206,7 @@ class PluginInterface_CopyEngineFactory : public QObject
};

#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
Q_DECLARE_INTERFACE(PluginInterface_CopyEngineFactory,"first-world.info.ultracopier.PluginInterface.CopyEngineFactory/1.2.4.0");
Q_DECLARE_INTERFACE(PluginInterface_CopyEngineFactory,"first-world.info.ultracopier.PluginInterface.CopyEngineFactory/2.0.0.0");
#endif

#endif // PLUGININTERFACE_COPYENGINE_H
2 changes: 1 addition & 1 deletion interface/PluginInterface_Listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PluginInterface_Listener : public QObject
};

#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
Q_DECLARE_INTERFACE(PluginInterface_Listener,"first-world.info.ultracopier.PluginInterface.Listener/1.2.4.0");
Q_DECLARE_INTERFACE(PluginInterface_Listener,"first-world.info.ultracopier.PluginInterface.Listener/2.0.0.0");
#endif

#endif // PLUGININTERFACE_LISTENER_H
2 changes: 1 addition & 1 deletion interface/PluginInterface_PluginLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PluginInterface_PluginLoader : public QObject
};

#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
Q_DECLARE_INTERFACE(PluginInterface_PluginLoader,"first-world.info.ultracopier.PluginInterface.PluginLoader/1.2.4.0");
Q_DECLARE_INTERFACE(PluginInterface_PluginLoader,"first-world.info.ultracopier.PluginInterface.PluginLoader/2.0.0.0");
#endif

#endif // PLUGININTERFACE_PLUGINLOADER_H
2 changes: 1 addition & 1 deletion interface/PluginInterface_SessionLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PluginInterface_SessionLoader : public QObject
};

#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
Q_DECLARE_INTERFACE(PluginInterface_SessionLoader,"first-world.info.ultracopier.PluginInterface.SessionLoader/1.2.4.0");
Q_DECLARE_INTERFACE(PluginInterface_SessionLoader,"first-world.info.ultracopier.PluginInterface.SessionLoader/2.0.0.0");
#endif

#endif // PLUGININTERFACE_SESSIONLOADER_H
4 changes: 3 additions & 1 deletion interface/PluginInterface_Themes.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class PluginInterface_Themes : public QWidget
virtual void haveExternalOrder() = 0;
/// \brief set if is in pause
virtual void isInPause(const bool &isInPause) = 0;
/// \brief set if is in pause
virtual void havePause(const bool &havePause) = 0;
// signal to implement
signals:
//set the transfer list
Expand Down Expand Up @@ -113,7 +115,7 @@ class PluginInterface_ThemesFactory : public QObject
};

#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
Q_DECLARE_INTERFACE(PluginInterface_ThemesFactory,"first-world.info.ultracopier.PluginInterface.ThemesFactory/1.2.4.0");
Q_DECLARE_INTERFACE(PluginInterface_ThemesFactory,"first-world.info.ultracopier.PluginInterface.ThemesFactory/2.0.0.0");
#endif

#endif // PLUGININTERFACE_THEMES_H
6 changes: 6 additions & 0 deletions plugins/CopyEngine/Ultracopier-Spec/CopyEngineFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ bool CopyEngineFactory::canDoOnlyCopy() const
return false;
}

/// \brief to get if have pause
bool CopyEngineFactory::havePause()
{
return false;
}

void CopyEngineFactory::resetOptions()
{
auto options=optionsEngine;
Expand Down
2 changes: 2 additions & 0 deletions plugins/CopyEngine/Ultracopier-Spec/CopyEngineFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class CopyEngineFactory : public PluginInterface_CopyEngineFactory
std::vector<std::string> supportedProtocolsForTheDestination() const;
/// \brief to get the options of the copy engine
QWidget * options();
/// \brief to get if have pause
bool havePause();

private:
Ui::copyEngineOptions *ui;
Expand Down
5 changes: 4 additions & 1 deletion plugins/CopyEngine/Ultracopier-Spec/ScanFileOrFolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ void ScanFileOrFolder::run()
else
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"source: "+source+" is file or symblink");
emit fileTransfer(source,destination+text_slash+TransferThread::resolvedName(source),mode);
if(stringEndsWith(destination,'/') || stringEndsWith(destination,'\\'))
emit fileTransfer(source,destination+TransferThread::resolvedName(source),mode);
else
emit fileTransfer(source,destination+text_slash+TransferThread::resolvedName(source),mode);
}
sourceIndex++;
}
Expand Down
6 changes: 6 additions & 0 deletions plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ QWidget * CopyEngineFactory::options()
return tempWidget;
}

/// \brief to get if have pause
bool CopyEngineFactory::havePause()
{
return true;
}

void CopyEngineFactory::setDoRightTransfer(bool doRightTransfer)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
Expand Down
2 changes: 2 additions & 0 deletions plugins/CopyEngine/Ultracopier/CopyEngineFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class CopyEngineFactory : public PluginInterface_CopyEngineFactory
std::vector<std::string> supportedProtocolsForTheDestination() const;
/// \brief to get the options of the copy engine
QWidget * options();
/// \brief to get if have pause
bool havePause();

private:
Ui::copyEngineOptions *ui;
Expand Down
6 changes: 6 additions & 0 deletions plugins/Themes/Oxygen/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,12 @@ void Themes::isInPause(const bool &isInPause)
updatePause();
}

/// \brief set have pause
void Themes::havePause(const bool &havePause)
{
ui->pauseButton->setEnabled(havePause);
}

void Themes::updatePause()
{
if(storeIsInPause)
Expand Down
2 changes: 2 additions & 0 deletions plugins/Themes/Oxygen/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class Themes : public PluginInterface_Themes
void haveExternalOrder();
/// \brief set if is in pause
void isInPause(const bool &);
/// \brief set if have pause
void havePause(const bool &);
/// \brief get the widget for the copy engine
QWidget * getOptionsEngineWidget();
/// \brief to set if the copy engine is found
Expand Down
46 changes: 45 additions & 1 deletion plugins/Themes/Oxygen2/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,15 @@ void Themes::isInPause(const bool &isInPause)
updatePause();
}

/// \brief set have pause
void Themes::havePause(const bool &havePause)
{
if(darkUi)
pauseButton->setEnabled(havePause);
else
ui->pauseButton->setEnabled(havePause);
}

void Themes::updatePause()
{
if(storeIsInPause)
Expand All @@ -851,7 +860,42 @@ void Themes::updateCurrentFileInformation()
TransferModel::currentTransfertItem transfertItem=transferModel.getCurrentTransfertItem();
if(transfertItem.haveItem)
{
QString newPath=QString::fromStdString(transfertItem.from);
std::string from=transfertItem.from;
std::string::size_type pos=from.rfind('/');
if(pos == std::string::npos)
{
#ifdef Q_OS_WIN32
std::string::size_type pos=from.rfind('\\');
if(pos != std::string::npos)
if(pos < from.size()-1)
from=from.substr(0,pos);
#endif
}
else if(pos < from.size()-1)
{
#ifdef Q_OS_WIN32
std::string::size_type pos2=from.rfind('\\');
if(pos2 != std::string::npos)
{
std::string::size_type pos=from.rfind('\\');
if(pos != std::string::npos)
{
if(pos2 < from.size()-1)
{
if(pos<pos2)
from=from.substr(0,pos2);
else
from=from.substr(0,pos);
}
}
else
from=from.substr(0,pos);
}
else
#endif
from=from.substr(0,pos);
}
QString newPath=QString::fromStdString(from);
if(newPath.size()>(64+3))
newPath=newPath.mid(0,32)+QStringLiteral("...")+newPath.mid(newPath.size()-32,32);
ui->from->setText(newPath);
Expand Down
2 changes: 2 additions & 0 deletions plugins/Themes/Oxygen2/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class Themes : public PluginInterface_Themes
void doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList);
/// \brief set if is in pause
void isInPause(const bool &);
/// \brief set if have pause
void havePause(const bool &);
/// \brief get the widget for the copy engine
QWidget * getOptionsEngineWidget();
/// \brief to set if the copy engine is found
Expand Down

0 comments on commit f4f607b

Please sign in to comment.