mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-30 21:03:41 +00:00 
			
		
		
		
	add string formatter
This commit is contained in:
		| @ -29,6 +29,7 @@ | ||||
| #include "awlistformatter.h" | ||||
| #include "awnoformatter.h" | ||||
| #include "awscriptformatter.h" | ||||
| #include "awstringformatter.h" | ||||
|  | ||||
|  | ||||
| AWFormatterHelper::AWFormatterHelper(QWidget *parent) | ||||
| @ -157,12 +158,14 @@ AWFormatterHelper::defineFormatterClass(const QString stringType) const | ||||
|         formatter = AWAbstractFormatter::FormatterClass::DateTime; | ||||
|     else if (stringType == QString("Float")) | ||||
|         formatter = AWAbstractFormatter::FormatterClass::Float; | ||||
|     else if (stringType == QString("List")) | ||||
|         formatter = AWAbstractFormatter::FormatterClass::List; | ||||
|     else if (stringType == QString("NoFormat")) | ||||
|         ; | ||||
|     else if (stringType == QString("Script")) | ||||
|         formatter = AWAbstractFormatter::FormatterClass::Script; | ||||
|     else if (stringType == QString("List")) | ||||
|         formatter = AWAbstractFormatter::FormatterClass::List; | ||||
|     else if (stringType == QString("String")) | ||||
|         formatter = AWAbstractFormatter::FormatterClass::String; | ||||
|     else | ||||
|         qCWarning(LOG_AW) << "Unknown formatter" << stringType; | ||||
|  | ||||
| @ -199,16 +202,20 @@ void AWFormatterHelper::initFormatters() | ||||
|                 m_formattersClasses[name] | ||||
|                     = new AWFloatFormatter(this, filePath); | ||||
|                 break; | ||||
|             case AWAbstractFormatter::FormatterClass::List: | ||||
|                 m_formattersClasses[name] = new AWListFormatter(this, filePath); | ||||
|                 break; | ||||
|             case AWAbstractFormatter::FormatterClass::Script: | ||||
|                 m_formattersClasses[name] | ||||
|                     = new AWScriptFormatter(this, filePath); | ||||
|                 break; | ||||
|             case AWAbstractFormatter::FormatterClass::String: | ||||
|                 m_formattersClasses[name] | ||||
|                     = new AWStringFormatter(this, filePath); | ||||
|                 break; | ||||
|             case AWAbstractFormatter::FormatterClass::NoFormat: | ||||
|                 m_formattersClasses[name] = new AWNoFormatter(this, filePath); | ||||
|                 break; | ||||
|             case AWAbstractFormatter::FormatterClass::List: | ||||
|                 m_formattersClasses[name] = new AWListFormatter(this, filePath); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @ -286,8 +293,8 @@ void AWFormatterHelper::doCreateItem() | ||||
| { | ||||
|     QStringList selection = QStringList() | ||||
|                             << QString("NoFormat") << QString("DateTime") | ||||
|                             << QString("Float") << QString("Script") | ||||
|                             << QString("List"); | ||||
|                             << QString("Float") << QString("List") | ||||
|                             << QString("Script") << QString("String"); | ||||
|     bool ok; | ||||
|     QString select = QInputDialog::getItem( | ||||
|         this, i18n("Select type"), i18n("Type:"), selection, 0, false, &ok); | ||||
| @ -304,12 +311,14 @@ void AWFormatterHelper::doCreateItem() | ||||
|         return createItem<AWDateTimeFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::Float: | ||||
|         return createItem<AWFloatFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::Script: | ||||
|         return createItem<AWScriptFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::NoFormat: | ||||
|         return createItem<AWNoFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::List: | ||||
|         return createItem<AWListFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::Script: | ||||
|         return createItem<AWScriptFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::String: | ||||
|         return createItem<AWStringFormatter>(); | ||||
|     case AWAbstractFormatter::FormatterClass::NoFormat: | ||||
|         return createItem<AWNoFormatter>(); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user