Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom formatters #91

Closed
arcan1s opened this issue Apr 26, 2016 · 3 comments
Closed

Allow custom formatters #91

arcan1s opened this issue Apr 26, 2016 · 3 comments
Assignees
Milestone

Comments

@arcan1s
Copy link
Owner

arcan1s commented Apr 26, 2016

No description provided.

@arcan1s arcan1s self-assigned this Apr 26, 2016
@arcan1s arcan1s added this to the Release 3.2.0 milestone Apr 26, 2016
@arcan1s
Copy link
Owner Author

arcan1s commented May 8, 2016

RFC:

  1. Tag configuration: file $AWHOME/formatters/formatters.ini, section Formatters. Key - related widget key, value is formatter name.
  2. Each formatter should be stored inside $AWHOME/formatters as .desktop file, section is Desktop Entry. Configuration incudes default fields:
    • Name - see above
    • Comment - comment, optional
    • Type - formatter type (see descriptions below)
  3. Formatters
    • NoFormat formatter - just put text as is. No special configuration required.
    • Float formatter - format any numeric value
      • FillChar - char, character which will be put to fill width, default is space
      • Format - char, qt specific number format, http://doc.qt.io/qt-5/qstring.html#argument-formats, default is f
      • Multiplier, Summand - doubles which will be used for calculation in the following formula: Multiplier * value + Summand
      • Precision - int, amount of numbers after comma, default is -1
      • Width - int, amount of number for value, default is 0
    • DateTime formatter - format qdatetime objects (like $ctime tag)
    • Script formatter - custom JS code. Value will be inserted as value variable
      • AppendCode - boolean. If true your code will be inserted between (function(value) { and })
      • HasReturn - boolean, if false your code will be appended ; return output;, e.g. it means that your code just calculates output variable. Works only if AppendCode=true.
      • Code - string, your JS code.

@arcan1s
Copy link
Owner Author

arcan1s commented May 8, 2016

at the moment these keys works normally with BUILD_FUTURE=ON, but requires configuration inside $AWHOME/general.ini, section Formatters for applied formatters list. And one section which named as Name value per formatter

arcan1s added a commit that referenced this issue May 9, 2016
@arcan1s
Copy link
Owner Author

arcan1s commented May 14, 2016

For consistent with other extensions (and actually according to freedesktop standard) X-AWprefixes have been added to keys.

Another change is the following: formatter.ini will be read from global configuration first and then will be overrided by local configuration (if there will be conflicting key names)

@arcan1s arcan1s closed this as completed May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant