work on nodejs int
This commit is contained in:
		
							parent
							
								
									ddb805438f
								
							
						
					
					
						commit
						beb9c5a263
					
				
					 32 changed files with 53249 additions and 1486 deletions
				
			
		|  | @ -1,11 +1,13 @@ | |||
| if(UPDATE_TRANSLATIONS) | ||||
|   # Regenerate "en" .ts file. | ||||
|   file(GLOB_RECURSE ALL_SOURCES | ||||
|     "${CMAKE_SOURCE_DIR}/src/librssguard/*.cpp") | ||||
|     "${CMAKE_SOURCE_DIR}/src/librssguard/*.cpp" | ||||
|     "${CMAKE_SOURCE_DIR}/src/librssguard/*.ui") | ||||
| 
 | ||||
|   qt_add_lupdate(rssguard | ||||
|     TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/rssguard_en.ts" | ||||
|     SOURCES ${ALL_SOURCES} | ||||
|     INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/src/librssguard" | ||||
|     OPTIONS "-no-obsolete") | ||||
| endif() | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -2,8 +2,9 @@ | |||
| 
 | ||||
| #include "exceptions/processexception.h" | ||||
| 
 | ||||
| ProcessException::ProcessException(int exit_code, QProcess::ExitStatus exit_status, const QString& message) | ||||
|   : ApplicationException(message), m_exitStatus(exit_status), m_exitCode(exit_code) {} | ||||
| ProcessException::ProcessException(int exit_code, QProcess::ExitStatus exit_status, | ||||
|                                    QProcess::ProcessError error, const QString& message) | ||||
|   : ApplicationException(message), m_error(error), m_exitStatus(exit_status), m_exitCode(exit_code) {} | ||||
| 
 | ||||
| QProcess::ExitStatus ProcessException::exitStatus() const { | ||||
|   return m_exitStatus; | ||||
|  | @ -12,3 +13,7 @@ QProcess::ExitStatus ProcessException::exitStatus() const { | |||
| int ProcessException::exitCode() const { | ||||
|   return m_exitCode; | ||||
| } | ||||
| 
 | ||||
| QProcess::ProcessError ProcessException::error() const { | ||||
|   return m_error; | ||||
| } | ||||
|  |  | |||
|  | @ -9,12 +9,15 @@ | |||
| 
 | ||||
| class ProcessException : public ApplicationException { | ||||
|   public: | ||||
|     ProcessException(int exit_code, QProcess::ExitStatus exit_status, const QString& message = QString()); | ||||
|     ProcessException(int exit_code, QProcess::ExitStatus exit_status, | ||||
|                      QProcess::ProcessError error, const QString& message = QString()); | ||||
| 
 | ||||
|     QProcess::ExitStatus exitStatus() const; | ||||
|     int exitCode() const; | ||||
|     QProcess::ProcessError error() const; | ||||
| 
 | ||||
|   private: | ||||
|     QProcess::ProcessError m_error; | ||||
|     QProcess::ExitStatus m_exitStatus; | ||||
|     int m_exitCode; | ||||
| }; | ||||
|  |  | |||
|  | @ -105,7 +105,7 @@ void SettingsNodejs::saveSettings() { | |||
| 
 | ||||
| void SettingsNodejs::testNodejs() { | ||||
|   try { | ||||
|     QString node_version = qApp->nodejs()->nodejsVersion(m_ui.m_tbNodeExecutable->lineEdit()->text()); | ||||
|     QString node_version = qApp->nodejs()->nodeJsVersion(m_ui.m_tbNodeExecutable->lineEdit()->text()); | ||||
| 
 | ||||
|     m_ui.m_tbNodeExecutable->setStatus(WidgetWithStatus::StatusType::Ok, | ||||
|                                        tr("Node.js has version %1.").arg(node_version)); | ||||
|  |  | |||
|  | @ -671,9 +671,9 @@ void Application::downloadRequested(QWebEngineDownloadItem* download_item) { | |||
| void Application::onAdBlockFailure() { | ||||
|   qApp->showGuiMessage(Notification::Event::GeneralEvent, { | ||||
|     tr("AdBlock needs to be configured"), | ||||
|     tr("AdBlock component is not configured properly. Go to \"Settings\" -> \"Node.js\" and check " | ||||
|     tr("AdBlock is not configured properly. Go to \"Settings\" -> \"Node.js\" and check " | ||||
|        "if your Node.js is properly configured."), | ||||
|     QSystemTrayIcon::MessageIcon::Critical }, {}); | ||||
|     QSystemTrayIcon::MessageIcon::Critical }, { true, true, false }); | ||||
| 
 | ||||
|   qApp->settings()->setValue(GROUP(AdBlock), AdBlock::AdBlockEnabled, false); | ||||
| } | ||||
|  |  | |||
|  | @ -140,7 +140,12 @@ QString IOFactory::startProcessGetOutput(const QString& executable, | |||
|     return proc.readAllStandardOutput(); | ||||
|   } | ||||
|   else { | ||||
|     throw ProcessException(proc.exitCode(), proc.exitStatus(), proc.readAllStandardError().simplified()); | ||||
|     QString err_output = proc.readAllStandardError().simplified(); | ||||
| 
 | ||||
|     throw ProcessException(proc.exitCode(), | ||||
|                            proc.exitStatus(), | ||||
|                            proc.error(), | ||||
|                            err_output.isEmpty() ? proc.errorString() : err_output); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -61,7 +61,7 @@ QString NodeJs::processedPackageFolder() const { | |||
|   return QDir::toNativeSeparators(path); | ||||
| } | ||||
| 
 | ||||
| QString NodeJs::nodejsVersion(const QString& nodejs_exe) const { | ||||
| QString NodeJs::nodeJsVersion(const QString& nodejs_exe) const { | ||||
|   if (nodejs_exe.simplified().isEmpty()) { | ||||
|     throw ApplicationException(tr("file not found")); | ||||
|   } | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ class NodeJs : public QObject { | |||
|     QString processedPackageFolder() const; | ||||
|     void setPackageFolder(const QString& path); | ||||
| 
 | ||||
|     QString nodejsVersion(const QString& nodejs_exe) const; | ||||
|     QString nodeJsVersion(const QString& nodejs_exe) const; | ||||
|     QString npmVersion(const QString& npm_exe) const; | ||||
| 
 | ||||
|     // Checks status of package.
 | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| #include "network-web/readability.h" | ||||
| 
 | ||||
| #include "3rd-party/boolinq/boolinq.h" | ||||
| #include "exceptions/applicationexception.h" | ||||
| #include "gui/messagebox.h" | ||||
| #include "miscellaneous/application.h" | ||||
| 
 | ||||
|  | @ -61,6 +62,7 @@ void Readability::onPackageError(const QList<NodeJs::PackageMetadata>& pkgs, con | |||
| 
 | ||||
| void Readability::makeHtmlReadable(const QString& html, const QString& base_url) { | ||||
|   if (!m_modulesInstalled) { | ||||
|     try { | ||||
|       NodeJs::PackageStatus st = qApp->nodejs()->packageStatus({ QSL(READABILITY_PACKAGE), QSL(READABILITY_VERSION) }); | ||||
| 
 | ||||
|       if (st != NodeJs::PackageStatus::UpToDate) { | ||||
|  | @ -72,7 +74,7 @@ void Readability::makeHtmlReadable(const QString& html, const QString& base_url) | |||
|                                { tr("Node.js libraries not installed"), | ||||
|                                  tr("%1 will now install some needed libraries, this will take only a few seconds. " | ||||
|                                     "You will be notified when installation is complete.").arg(QSL(APP_NAME)), | ||||
|                                QSystemTrayIcon::MessageIcon::Information }, | ||||
|                                  QSystemTrayIcon::MessageIcon::Warning }, | ||||
|                                { true, true, false }); | ||||
|           qApp->nodejs()->installPackages({ { QSL(READABILITY_PACKAGE), QSL(READABILITY_VERSION) } }); | ||||
|         } | ||||
|  | @ -83,6 +85,20 @@ void Readability::makeHtmlReadable(const QString& html, const QString& base_url) | |||
|         m_modulesInstalled = true; | ||||
|       } | ||||
|     } | ||||
|     catch (const ApplicationException& ex) { | ||||
|       qApp->showGuiMessage(Notification::Event::NodePackageUpdated, | ||||
|                            { tr("Node.js libraries not installed"), | ||||
|                              tr("Node.js is not configured properly. Go to \"Settings\" -> \"Node.js\" and check " | ||||
|                                 "if your Node.js is properly configured."), | ||||
|                              QSystemTrayIcon::MessageIcon::Critical }, | ||||
|                            { true, true, false }); | ||||
| 
 | ||||
|       qCriticalNN << LOGSEC_CORE << "Failed to check for Node.js package status:" << QUOTE_W_SPACE_DOT(ex.message()); | ||||
| 
 | ||||
|       // Emit this just to allow readability again for user.
 | ||||
|       emit htmlReadabled({}); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   QProcess* proc = new QProcess(this); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue