Refactoring, long way to go bro.
This commit is contained in:
		
							parent
							
								
									e0790bb6a2
								
							
						
					
					
						commit
						1395ba2478
					
				
					 2 changed files with 61 additions and 54 deletions
				
			
		|  | @ -71,6 +71,14 @@ QList<QAction*> StandardFeed::contextMenu() { | ||||||
|   return serviceRoot()->getContextMenuForFeed(this); |   return serviceRoot()->getContextMenuForFeed(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool StandardFeed::canBeEdited() const { | ||||||
|  |   return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool StandardFeed::canBeDeleted() const { | ||||||
|  |   return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| StandardServiceRoot* StandardFeed::serviceRoot() const { | StandardServiceRoot* StandardFeed::serviceRoot() const { | ||||||
|   return qobject_cast<StandardServiceRoot*>(getParentServiceRoot()); |   return qobject_cast<StandardServiceRoot*>(getParentServiceRoot()); | ||||||
| } | } | ||||||
|  | @ -108,7 +116,7 @@ QVariant StandardFeed::data(int column, int role) const { | ||||||
|                                                 NetworkFactory::networkErrorText(m_networkError)); |                                                 NetworkFactory::networkErrorText(m_networkError)); | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         return QVariant(); |         return Feed::data(column, role); | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|     default: |     default: | ||||||
|  | @ -379,6 +387,46 @@ bool StandardFeed::editItself(StandardFeed* new_feed_data) { | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | StandardFeed::Type StandardFeed::type() const { | ||||||
|  |   return m_type; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StandardFeed::setType(StandardFeed::Type type) { | ||||||
|  |   m_type = type; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool StandardFeed::passwordProtected() const { | ||||||
|  |   return m_passwordProtected; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StandardFeed::setPasswordProtected(bool passwordProtected) { | ||||||
|  |   m_passwordProtected = passwordProtected; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | QString StandardFeed::username() const { | ||||||
|  |   return m_username; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StandardFeed::setUsername(const QString& username) { | ||||||
|  |   m_username = username; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | QString StandardFeed::password() const { | ||||||
|  |   return m_password; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StandardFeed::setPassword(const QString& password) { | ||||||
|  |   m_password = password; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | QString StandardFeed::encoding() const { | ||||||
|  |   return m_encoding; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StandardFeed::setEncoding(const QString& encoding) { | ||||||
|  |   m_encoding = encoding; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) { | QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) { | ||||||
|   QByteArray feed_contents; |   QByteArray feed_contents; | ||||||
|   int download_timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); |   int download_timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); | ||||||
|  |  | ||||||
|  | @ -28,8 +28,6 @@ | ||||||
| #include <QPair> | #include <QPair> | ||||||
| #include <QSqlRecord> | #include <QSqlRecord> | ||||||
| 
 | 
 | ||||||
| class Message; |  | ||||||
| class FeedsModel; |  | ||||||
| class StandardServiceRoot; | class StandardServiceRoot; | ||||||
| 
 | 
 | ||||||
| // Represents BASE class for feeds contained in FeedsModel.
 | // Represents BASE class for feeds contained in FeedsModel.
 | ||||||
|  | @ -38,9 +36,6 @@ class StandardFeed : public Feed { | ||||||
|   Q_OBJECT |   Q_OBJECT | ||||||
| 
 | 
 | ||||||
|   public: |   public: | ||||||
| 
 |  | ||||||
|     // Describes possible types of feeds.
 |  | ||||||
|     // NOTE: This is equivalent to attribute Feeds(type).
 |  | ||||||
|     enum Type { |     enum Type { | ||||||
|       Rss0X = 0, |       Rss0X = 0, | ||||||
|       Rss2X = 1, |       Rss2X = 1, | ||||||
|  | @ -58,13 +53,8 @@ class StandardFeed : public Feed { | ||||||
| 
 | 
 | ||||||
|     QList<QAction*> contextMenu(); |     QList<QAction*> contextMenu(); | ||||||
| 
 | 
 | ||||||
|     bool canBeEdited() const { |     bool canBeEdited() const; | ||||||
|       return true; |     bool canBeDeleted() const; | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     bool canBeDeleted() const { |  | ||||||
|       return true; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     bool editViaGui(); |     bool editViaGui(); | ||||||
|     bool deleteViaGui(); |     bool deleteViaGui(); | ||||||
|  | @ -82,45 +72,16 @@ class StandardFeed : public Feed { | ||||||
|     bool editItself(StandardFeed* new_feed_data); |     bool editItself(StandardFeed* new_feed_data); | ||||||
| 
 | 
 | ||||||
|     // Other getters/setters.
 |     // Other getters/setters.
 | ||||||
|     inline Type type() const { |     inline Type type() const; | ||||||
|       return m_type; |     inline void setType(Type type); | ||||||
|     } |     inline bool passwordProtected() const; | ||||||
| 
 |     inline void setPasswordProtected(bool passwordProtected); | ||||||
|     inline void setType(Type type) { |     inline QString username() const; | ||||||
|       m_type = type; |     inline void setUsername(const QString& username); | ||||||
|     } |     inline QString password() const; | ||||||
| 
 |     inline void setPassword(const QString& password); | ||||||
|     inline bool passwordProtected() const { |     inline QString encoding() const; | ||||||
|       return m_passwordProtected; |     inline void setEncoding(const QString& encoding); | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline void setPasswordProtected(bool passwordProtected) { |  | ||||||
|       m_passwordProtected = passwordProtected; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline QString username() const { |  | ||||||
|       return m_username; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline void setUsername(const QString& username) { |  | ||||||
|       m_username = username; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline QString password() const { |  | ||||||
|       return m_password; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline void setPassword(const QString& password) { |  | ||||||
|       m_password = password; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline QString encoding() const { |  | ||||||
|       return m_encoding; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     inline void setEncoding(const QString& encoding) { |  | ||||||
|       m_encoding = encoding; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     QNetworkReply::NetworkError networkError() const; |     QNetworkReply::NetworkError networkError() const; | ||||||
| 
 | 
 | ||||||
|  | @ -137,8 +98,6 @@ class StandardFeed : public Feed { | ||||||
|     static QString typeToString(Type type); |     static QString typeToString(Type type); | ||||||
| 
 | 
 | ||||||
|   public slots: |   public slots: | ||||||
| 
 |  | ||||||
|     // Fetches metadata for the feed.
 |  | ||||||
|     void fetchMetadataForItself(); |     void fetchMetadataForItself(); | ||||||
| 
 | 
 | ||||||
|   private: |   private: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue