repo_name
stringlengths
4
116
path
stringlengths
4
379
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
campbeb/ShareX
ShareX/StartupManagers/GenericStartupManager.cs
2553
#region License Information (GPL v3) /* ShareX - A program that allows you to take screenshots and share any file type Copyright (c) 2007-2019 ShareX Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Optionally you can also view the license at <http://www.gnu.org/licenses/>. */ #endregion License Information (GPL v3) #if !WindowsStore using Microsoft.Win32; using ShareX.HelpersLib; using System; namespace ShareX { public abstract class GenericStartupManager : IStartupManager { public abstract string StartupTargetPath { get; } public StartupState State { get { if (ShortcutHelpers.CheckShortcut(Environment.SpecialFolder.Startup, StartupTargetPath)) { byte[] status = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder", "ShareX.lnk", null) as byte[]; if (status != null && status.Length > 0 && status[0] == 3) { return StartupState.DisabledByUser; } else { return StartupState.Enabled; } } else { return StartupState.Disabled; } } set { if (value == StartupState.Enabled || value == StartupState.Disabled) { ShortcutHelpers.SetShortcut(value == StartupState.Enabled, Environment.SpecialFolder.Startup, StartupTargetPath, "-silent"); } else { throw new NotSupportedException(); } } } } } #endif
gpl-3.0
lssfau/walberla
src/gui/extern/Qt3D/arrays/qvector4darray.cpp
7322
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt3D module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qvector4darray.h" #include <QtGui/qmatrix4x4.h> QT_BEGIN_NAMESPACE /*! \class QVector4DArray \brief The QVector4DArray class is a convenience for wrapping a QArray of QVector4D values. \since 4.8 \ingroup qt3d \ingroup qt3d::arrays QVector4DArray is used to build an array of 4D vector values based on floating-point x, y, and z arguments: \code QVector4DArray array; array.append(1.0f, 2.0f, 3.0f, -4.0f); array.append(-1.0f, 2.0f, 3.0f, -4.0f); array.append(1.0f, -2.0f, 3.0f, -4.0f); \endcode This is more convenient and readable than the equivalent with QArray: \code QArray<QVector4D> array; array.append(QVector4D(1.0f, 2.0f, 3.0f, -4.0f)); array.append(QVector4D(-1.0f, 2.0f, 3.0f, -4.0f)); array.append(QVector4D(1.0f, -2.0f, 3.0f, -4.0f)); \endcode QVector4DArray also has convenience functions for transforming the contents of the array with translate(), translated(), transform(), and transformed(). \sa QArray, QVector2DArray, QVector3DArray */ /*! \fn QVector4DArray::QVector4DArray() Constructs an empty array of QVector4D values. */ /*! \fn QVector4DArray::QVector4DArray(int size, const QVector4D& value) Constructs an array of QVector4D values with an initial \a size. All elements in the array are initialized to \a value. */ /*! \fn QVector4DArray::QVector4DArray(const QArray<QVector4D>& other) Constructs a copy of \a other. */ /*! \fn void QVector4DArray::append(qreal x, qreal y, qreal z, qreal w) Appends (\a x, \a y, \a z, \a w) to this array of QVector4D values. */ /*! Multiplies the elements in this array of QVector4D values by the \a scale. \sa scaled() */ void QVector4DArray::scale(qreal scale) { if (isDetached()) { // Modify the array in-place. int size = count(); QVector4D *dst = data(); for (int index = 0; index < size; ++index) *dst++ *= scale; } else { // Create a new array, translate the values, and assign. QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = *src++ * scale; *this = result; } } /*! Returns a copy of this array of QVector4D values, multiplied by the \a scale. \sa scale() */ QVector4DArray QVector4DArray::scaled(qreal scale) const { QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = *src++ * scale; return result; } /*! Translates the elements in this array of QVector4D values by the components of \a value. \sa translated() */ void QVector4DArray::translate(const QVector4D& value) { if (isDetached()) { // Modify the array in-place. int size = count(); QVector4D *dst = data(); for (int index = 0; index < size; ++index) *dst++ += value; } else { // Create a new array, translate the values, and assign. QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = *src++ + value; *this = result; } } /*! \fn void QVector4DArray::translate(qreal x, qreal y, qreal z, qreal w); \overload Translates the elements in this array of QVector4D values by (\a x, \a y, \a z, \a w). \sa translated() */ /*! Returns a copy of this array of QVector4D values, translated by the components of \a value. \sa translate() */ QArray<QVector4D> QVector4DArray::translated(const QVector4D& value) const { QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = *src++ + value; return result; } /*! \fn QArray<QVector4D> QVector4DArray::translated(qreal x, qreal y, qreal z, qreal w) const \overload Returns a copy of this array of QVector4D values, translated by (\a x, \a y, \a z, \a w). \sa translate() */ /*! Transforms the elements in this array of QVector4D values by \a matrix. \sa transformed() */ void QVector4DArray::transform(const QMatrix4x4& matrix) { if (isDetached()) { // Modify the array in-place. int size = count(); QVector4D *dst = data(); for (int index = 0; index < size; ++index) { *dst = matrix * *dst; ++dst; } } else { // Create a new array, transform the values, and assign. QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = matrix * *src++; *this = result; } } /*! Returns a copy of this array of QVector3D values, transformed by \a matrix. \sa transform() */ QArray<QVector4D> QVector4DArray::transformed(const QMatrix4x4& matrix) const { QArray<QVector4D> result; int size = count(); const QVector4D *src = constData(); QVector4D *dst = result.extend(size); for (int index = 0; index < size; ++index) *dst++ = matrix * *src++; return result; } QT_END_NAMESPACE
gpl-3.0
patta42/pySICM
pySICM/helpers.py
3683
# Copyright (C) 2015 Patrick Happel <patrick.happel@rub.de> # # This file is part of pySICM. # # pySICM is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 2 of the License, or (at your option) any later # version. # # pySICM is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # pySICM. If not, see <http://www.gnu.org/licenses/>. '''pySICM.helpers is a module that contains several helper functions.''' from pySICM.error import PySICMError import imp, os, struct import numpy as np SCANMODESDIR = '/home/happel/coding/python/sicm/scanmodes/' TOOLSDIR = '/home/happel/coding/python/sicm/tools/' SETUPFILE = '/etc/pySICM/setup.ini' BOARDINFO = '/usr/local/bin/comedi_board_info' #class Helpers(object): #@staticmethod def makeDictKeysInt(d): '''Changes the keys of the dictionary to integers if they are convertable. Used for object representation by json.dumps. If dictionary has an integer-key and a corresponding string-key, the string-key will not be changed. Works recursively. Input argument: a dictionary Return value: The dictionary with new keys''' if not isinstance(d, dict): raise TypeError('makeDictKeysInt expects a dict as input argument') retd = {} try: for k,v in d.iteritems(): try: if str(int(k)) == k: if int(k) in d: key = k else: key = int(k) if isinstance(v, dict): retd[key] = Helpers.makeDictKeysInt(v) else: retd[key] = v else: retd[k] = v except: retd[k] = v except: pass return retd def mkByteFromInt(i): a = i / 256 b = i % 256 return struct.pack('B', b)+struct.pack('B', a) def mkIntFromByte(s): a = struct.unpack('B', s[1])[0] b = struct.unpack('B', s[0])[0] return a * 256 + b def mkFloatFromInt(i, rang): diff = (max(rang) - min(rang))/float(np.iinfo(np.uint16).max) return float(min(rang)) + float(i) * diff def mkIntFromFloat(f, rang): diff = (max(rang) - min(rang))/float(np.iinfo(np.uint16).max) return int(round((f-min(rang))/diff)) def mkFloatFromByte(b, rang): return mkFloatFromInt(mkIntFromByte(b),rang) def getScanmodeObject(mode, tool = False): if tool == False: print 'Trying to load from %s' % os.path.join(SCANMODESDIR, mode+'.py') pymod = imp.load_source(mode, os.path.join(SCANMODESDIR, mode+'.py')) else: mode = mode[4].lower()+mode[5:] print 'Trying to load from %s' % os.path.join(TOOLSDIR, mode+'.py') pymod = imp.load_source(mode, os.path.join(TOOLSDIR, mode+'.py')) inst = getattr(pymod, mode[0].capitalize()+mode[1:]) return inst def getObject(module, cls, path=None): tmp = module.split('.',1) sub = None if len(tmp) > 1: sub = tmp[1] mod = tmp[0] if path is None: res = imp.find_module(mod) else: res = imp.find_module(mod, [path]) if sub is not None: res = imp.find_module(sub, [res[1]]) mod = imp.load_source(sub, res[1]) inst = getattr(mod, cls) return inst
gpl-3.0
gtinchev/matlab_helper_functions
eval/evaluate_rpe.py
20003
#!/usr/bin/python # Software License Agreement (BSD License) # # Copyright (c) 2013, Juergen Sturm, TUM # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of TUM nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """ This script computes the relative pose error from the ground truth trajectory and the estimated trajectory. """ import argparse import random import numpy import sys _EPS = numpy.finfo(float).eps * 4.0 def transform44(l): """ Generate a 4x4 homogeneous transformation matrix from a 3D point and unit quaternion. Input: l -- tuple consisting of (stamp,tx,ty,tz,qx,qy,qz,qw) where (tx,ty,tz) is the 3D position and (qx,qy,qz,qw) is the unit quaternion. Output: matrix -- 4x4 homogeneous transformation matrix """ t = l[1:4] q = numpy.array(l[4:8], dtype=numpy.float64, copy=True) nq = numpy.dot(q, q) if nq < _EPS: return numpy.array(( ( 1.0, 0.0, 0.0, t[0]) ( 0.0, 1.0, 0.0, t[1]) ( 0.0, 0.0, 1.0, t[2]) ( 0.0, 0.0, 0.0, 1.0) ), dtype=numpy.float64) q *= numpy.sqrt(2.0 / nq) q = numpy.outer(q, q) return numpy.array(( (1.0-q[1, 1]-q[2, 2], q[0, 1]-q[2, 3], q[0, 2]+q[1, 3], t[0]), ( q[0, 1]+q[2, 3], 1.0-q[0, 0]-q[2, 2], q[1, 2]-q[0, 3], t[1]), ( q[0, 2]-q[1, 3], q[1, 2]+q[0, 3], 1.0-q[0, 0]-q[1, 1], t[2]), ( 0.0, 0.0, 0.0, 1.0) ), dtype=numpy.float64) def read_trajectory(filename, matrix=True): """ Read a trajectory from a text file. Input: filename -- file to be read matrix -- convert poses to 4x4 matrices Output: dictionary of stamped 3D poses """ file = open(filename) data = file.read() lines = data.replace(","," ").replace("\t"," ").split("\n") list = [[float(v.strip()) for v in line.split(" ") if v.strip()!=""] for line in lines if len(line)>0 and line[0]!="#"] list_ok = [] for i,l in enumerate(list): if l[4:8]==[0,0,0,0]: continue isnan = False for v in l: if numpy.isnan(v): isnan = True break if isnan: sys.stderr.write("Warning: line %d of file '%s' has NaNs, skipping line\n"%(i,filename)) continue list_ok.append(l) if matrix : traj = dict([(l[0],transform44(l[0:])) for l in list_ok]) else: traj = dict([(l[0],l[1:8]) for l in list_ok]) return traj def find_closest_index(L,t): """ Find the index of the closest value in a list. Input: L -- the list t -- value to be found Output: index of the closest element """ beginning = 0 difference = abs(L[0] - t) best = 0 end = len(L) while beginning < end: middle = int((end+beginning)/2) if abs(L[middle] - t) < difference: difference = abs(L[middle] - t) best = middle if t == L[middle]: return middle elif L[middle] > t: end = middle else: beginning = middle + 1 return best def ominus(a,b): """ Compute the relative 3D transformation between a and b. Input: a -- first pose (homogeneous 4x4 matrix) b -- second pose (homogeneous 4x4 matrix) Output: Relative 3D transformation from a to b. """ return numpy.dot(numpy.linalg.inv(a),b) def scale(a,scalar): """ Scale the translational components of a 4x4 homogeneous matrix by a scale factor. """ return numpy.array( [[a[0,0], a[0,1], a[0,2], a[0,3]*scalar], [a[1,0], a[1,1], a[1,2], a[1,3]*scalar], [a[2,0], a[2,1], a[2,2], a[2,3]*scalar], [a[3,0], a[3,1], a[3,2], a[3,3]]] ) def compute_distance(transform): """ Compute the distance of the translational component of a 4x4 homogeneous matrix. """ return [transform[0,3], transform[1,3], transform[2,3], numpy.linalg.norm(transform[0:3,3])] def compute_angle(transform): """ Compute the rotation angle from a 4x4 homogeneous matrix. """ # an invitation to 3-d vision, p 27 return numpy.arccos( min(1,max(-1, (numpy.trace(transform[0:3,0:3]) - 1)/2) )) def distances_along_trajectory(traj): """ Compute the translational distances along a trajectory. """ keys = traj.keys() keys.sort() motion = [ominus(traj[keys[i+1]],traj[keys[i]]) for i in range(len(keys)-1)] distances = [0] sum = 0 for t in motion: sum += compute_distance(t)[3] distances.append(sum) return distances def rotations_along_trajectory(traj,scale): """ Compute the angular rotations along a trajectory. """ keys = traj.keys() keys.sort() motion = [ominus(traj[keys[i+1]],traj[keys[i]]) for i in range(len(keys)-1)] distances = [0] sum = 0 for t in motion: sum += compute_angle(t)*scale distances.append(sum) return distances def evaluate_trajectory(traj_gt,traj_est,param_max_pairs=10000,param_fixed_delta=False,param_delta=1.00,param_delta_unit="s",param_offset=0.00,param_scale=1.00): """ Compute the relative pose error between two trajectories. Input: traj_gt -- the first trajectory (ground truth) traj_est -- the second trajectory (estimated trajectory) param_max_pairs -- number of relative poses to be evaluated param_fixed_delta -- false: evaluate over all possible pairs true: only evaluate over pairs with a given distance (delta) param_delta -- distance between the evaluated pairs param_delta_unit -- unit for comparison: "s": seconds "m": meters "rad": radians "deg": degrees "f": frames param_offset -- time offset between two trajectories (to model the delay) param_scale -- scale to be applied to the second trajectory Output: list of compared poses and the resulting translation and rotation error """ stamps_gt = list(traj_gt.keys()) stamps_est = list(traj_est.keys()) stamps_gt.sort() stamps_est.sort() stamps_est_return = [] for t_est in stamps_est: t_gt = stamps_gt[find_closest_index(stamps_gt,t_est + param_offset)] t_est_return = stamps_est[find_closest_index(stamps_est,t_gt - param_offset)] t_gt_return = stamps_gt[find_closest_index(stamps_gt,t_est_return + param_offset)] if not t_est_return in stamps_est_return: stamps_est_return.append(t_est_return) if(len(stamps_est_return)<2): raise Exception("Number of overlap in the timestamps is too small. Did you run the evaluation on the right files?") if param_delta_unit=="s": index_est = list(traj_est.keys()) index_est.sort() elif param_delta_unit=="m": index_est = distances_along_trajectory(traj_est) elif param_delta_unit=="rad": index_est = rotations_along_trajectory(traj_est,1) elif param_delta_unit=="deg": index_est = rotations_along_trajectory(traj_est,180/numpy.pi) elif param_delta_unit=="f": index_est = range(len(traj_est)) else: raise Exception("Unknown unit for delta: '%s'"%param_delta_unit) if not param_fixed_delta: if(param_max_pairs==0 or len(traj_est)<numpy.sqrt(param_max_pairs)): pairs = [(i,j) for i in range(len(traj_est)) for j in range(len(traj_est))] else: pairs = [(random.randint(0,len(traj_est)-1),random.randint(0,len(traj_est)-1)) for i in range(param_max_pairs)] else: pairs = [] for i in range(len(traj_est)): j = find_closest_index(index_est,index_est[i] + param_delta) if j!=len(traj_est)-1: pairs.append((i,j)) if(param_max_pairs!=0 and len(pairs)>param_max_pairs): pairs = random.sample(pairs,param_max_pairs) gt_interval = numpy.median([s-t for s,t in zip(stamps_gt[1:],stamps_gt[:-1])]) gt_max_time_difference = 2*gt_interval result = [] for i,j in pairs: stamp_est_0 = stamps_est[i] stamp_est_1 = stamps_est[j] stamp_gt_0 = stamps_gt[ find_closest_index(stamps_gt,stamp_est_0 + param_offset) ] stamp_gt_1 = stamps_gt[ find_closest_index(stamps_gt,stamp_est_1 + param_offset) ] if(abs(stamp_gt_0 - (stamp_est_0 + param_offset)) > gt_max_time_difference or abs(stamp_gt_1 - (stamp_est_1 + param_offset)) > gt_max_time_difference): continue error44 = ominus( scale( ominus( traj_est[stamp_est_1], traj_est[stamp_est_0] ),param_scale), ominus( traj_gt[stamp_gt_1], traj_gt[stamp_gt_0] ) ) trans = compute_distance(error44) rot = compute_angle(error44) result.append([stamp_est_0,stamp_est_1,stamp_gt_0,stamp_gt_1,trans[0], trans[1], trans[2], trans[3],rot]) if len(result)<2: raise Exception("Couldn't find matching timestamp pairs between groundtruth and estimated trajectory!") return result def percentile(seq,q): """ Return the q-percentile of a list """ seq_sorted = list(seq) seq_sorted.sort() return seq_sorted[int((len(seq_sorted)-1)*q)] if __name__ == '__main__': random.seed(0) parser = argparse.ArgumentParser(description=''' This script computes the relative pose error from the ground truth trajectory and the estimated trajectory. ''') parser.add_argument('groundtruth_file', help='ground-truth trajectory file (format: "timestamp tx ty tz qx qy qz qw")') parser.add_argument('estimated_file', help='estimated trajectory file (format: "timestamp tx ty tz qx qy qz qw")') parser.add_argument('--max_pairs', help='maximum number of pose comparisons (default: 10000, set to zero to disable downsampling)', default=10000) parser.add_argument('--fixed_delta', help='only consider pose pairs that have a distance of delta delta_unit (e.g., for evaluating the drift per second/meter/radian)', action='store_true') parser.add_argument('--delta', help='delta for evaluation (default: 1.0)',default=1.0) parser.add_argument('--delta_unit', help='unit of delta (options: \'s\' for seconds, \'m\' for meters, \'rad\' for radians, \'f\' for frames; default: \'s\')',default='s') parser.add_argument('--offset', help='time offset between ground-truth and estimated trajectory (default: 0.0)',default=0.0) parser.add_argument('--scale', help='scaling factor for the estimated trajectory (default: 1.0)',default=1.0) parser.add_argument('--save', help='text file to which the evaluation will be saved (format: stamp_est0 stamp_est1 stamp_gt0 stamp_gt1 trans_error rot_error)') parser.add_argument('--plot', help='plot the result to a file (requires --fixed_delta, output format: png)') parser.add_argument('--verbose', help='print all evaluation data (otherwise, only the mean translational error measured in meters will be printed)', action='store_true') args = parser.parse_args() if args.plot and not args.fixed_delta: sys.exit("The '--plot' option can only be used in combination with '--fixed_delta'") traj_gt = read_trajectory(args.groundtruth_file) traj_est = read_trajectory(args.estimated_file) result = evaluate_trajectory(traj_gt, traj_est, int(args.max_pairs), args.fixed_delta, float(args.delta), args.delta_unit, float(args.offset), float(args.scale)) stamps = numpy.array(result)[:,0] trans_error_x = trans_error = numpy.array(result)[:,4] # x, trans_error_y = trans_error = numpy.array(result)[:,5] # y, trans_error_z = trans_error = numpy.array(result)[:,6] # z, trans_error_n = trans_error = numpy.array(result)[:,7] # normal rot_error = numpy.array(result)[:,8] if args.save: f = open(args.save,"w") f.write("\n".join([" ".join(["%f"%v for v in line]) for line in result])) f.close() if args.verbose: print "X direction:" print "compared_pose_pairs %d pairs"%(len(trans_error_x)) print "translational_error.rmse %f +- %f m" % (numpy.sqrt(numpy.dot(trans_error_x,trans_error_x) / len(trans_error_x)), 1.96*(numpy.std(trans_error_x)/numpy.sqrt(len(trans_error_x)))) print "translational_error.mean %f m"%numpy.mean(trans_error_x) print "translational_error.median %f m"%numpy.median(trans_error_x) print "translational_error.std %f m"%numpy.std(trans_error_x) print "translational_error.min %f m"%numpy.min(trans_error_x) print "translational_error.max %f m"%numpy.max(trans_error_x) print "Y direction:" print "compared_pose_pairs %d pairs"%(len(trans_error_y)) print "translational_error.rmse %f +- %f m"%(numpy.sqrt(numpy.dot(trans_error_y,trans_error_y) / len(trans_error_y)), 1.96*(numpy.std(trans_error_y)/numpy.sqrt(len(trans_error_y)))) print "translational_error.mean %f m"%numpy.mean(trans_error_y) print "translational_error.median %f m"%numpy.median(trans_error_y) print "translational_error.std %f m"%numpy.std(trans_error_y) print "translational_error.min %f m"%numpy.min(trans_error_y) print "translational_error.max %f m"%numpy.max(trans_error_y) print "Z direction:" print "compared_pose_pairs %d pairs"%(len(trans_error_z)) print "translational_error.rmse %f +- %f m"%(numpy.sqrt(numpy.dot(trans_error_z,trans_error_z) / len(trans_error_z)), 1.96*(numpy.std(trans_error_z)/numpy.sqrt(len(trans_error_z)))) print "translational_error.mean %f m"%numpy.mean(trans_error_z) print "translational_error.median %f m"%numpy.median(trans_error_z) print "translational_error.std %f m"%numpy.std(trans_error_z) print "translational_error.min %f m"%numpy.min(trans_error_z) print "translational_error.max %f m"%numpy.max(trans_error_z) print "Normal direction:" print "compared_pose_pairs %d pairs"%(len(trans_error_n)) print "translational_error.rmse %f +- %f m"%(numpy.sqrt(numpy.dot(trans_error_n,trans_error_n) / len(trans_error_n)), 1.96*(numpy.std(trans_error_n)/numpy.sqrt(len(trans_error_n)))) print "translational_error.mean %f m"%numpy.mean(trans_error_n) print "translational_error.median %f m"%numpy.median(trans_error_n) print "translational_error.std %f m"%numpy.std(trans_error_n) print "translational_error.min %f m"%numpy.min(trans_error_n) print "translational_error.max %f m"%numpy.max(trans_error_n) print "rotational_error.rmse %f +- %f deg"%((numpy.sqrt(numpy.dot(rot_error,rot_error) / len(rot_error)) * 180.0 / numpy.pi), 1.96*(numpy.std(rot_error) * 180.0 / numpy.pi)/numpy.sqrt(len(rot_error)) ) print "rotational_error.mean %f deg"%(numpy.mean(rot_error) * 180.0 / numpy.pi) print "rotational_error.median %f deg"%numpy.median(rot_error) print "rotational_error.std %f deg"%(numpy.std(rot_error) * 180.0 / numpy.pi) print "rotational_error.min %f deg"%(numpy.min(rot_error) * 180.0 / numpy.pi) print "rotational_error.max %f deg"%(numpy.max(rot_error) * 180.0 / numpy.pi) else: print "x:" print numpy.mean(trans_error_x) print "y:" print numpy.mean(trans_error_y) print "z:" print numpy.mean(trans_error_z) print "n:" print numpy.mean(trans_error_n) if args.plot: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.pylab as pylab fig = plt.figure() ax = fig.add_subplot(111) plot_x = ax.plot(stamps - stamps[0],trans_error_x,'-',color="red", label = 'X') plot_y = ax.plot(stamps - stamps[0],trans_error_y,'-',color="green", label = 'Y') plot_z = ax.plot(stamps - stamps[0],trans_error_z,'-',color="blue", label = 'Z') plot_n = ax.plot(stamps - stamps[0],trans_error_n,'-',color="black", label = 'Normal') plt.legend() #ax.plot([t for t,e in err_rot],[e for t,e in err_rot],'-',color="red") ax.set_xlabel('time [s]') ax.set_ylabel('translational error [m]') plt.savefig(args.plot+"_all",dpi=300) # plot x fig = plt.figure() ax = fig.add_subplot(111) plot_x = ax.plot(stamps - stamps[0],trans_error_x,'-',color="red", label = 'X') plt.legend() #ax.plot([t for t,e in err_rot],[e for t,e in err_rot],'-',color="red") ax.set_xlabel('time [s]') ax.set_ylabel('translational error [m]') plt.savefig(args.plot+"_x",dpi=300) # plot y fig = plt.figure() ax = fig.add_subplot(111) plot_y = ax.plot(stamps - stamps[0],trans_error_y,'-',color="green", label = 'Y') plt.legend() #ax.plot([t for t,e in err_rot],[e for t,e in err_rot],'-',color="red") ax.set_xlabel('time [s]') ax.set_ylabel('translational error [m]') plt.savefig(args.plot+"_y",dpi=300) # plot z fig = plt.figure() ax = fig.add_subplot(111) plot_z = ax.plot(stamps - stamps[0],trans_error_z,'-',color="blue", label = 'Z') plt.legend() #ax.plot([t for t,e in err_rot],[e for t,e in err_rot],'-',color="red") ax.set_xlabel('time [s]') ax.set_ylabel('translational error [m]') plt.savefig(args.plot+"_z",dpi=300) # plot n fig = plt.figure() ax = fig.add_subplot(111) plot_n = ax.plot(stamps - stamps[0],trans_error_n,'-',color="pink", label = 'Normal') plt.legend() #ax.plot([t for t,e in err_rot],[e for t,e in err_rot],'-',color="red") ax.set_xlabel('time [s]') ax.set_ylabel('translational error [m]') plt.savefig(args.plot+"_normal",dpi=300)
gpl-3.0
phoebe-project/phoebe2-docs
2.0/tutorials/vgamma.py
10746
#!/usr/bin/env python # coding: utf-8 # Systemic Velocity # ============================ # # Setup # ----------------------------- # Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). # In[ ]: get_ipython().system('pip install -I "phoebe>=2.0,<2.1"') # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') # As always, let's do imports and initialize a logger and a new Bundle. See [Building a System](../tutorials/building_a_system.html) for more details. # In[2]: import phoebe from phoebe import u # units import numpy as np import matplotlib.pyplot as plt logger = phoebe.logger() b = phoebe.default_binary() # Now we'll create empty lc, rv, orb, and mesh datasets. We'll then look to see how the systemic velocity (vgamma) affects the observables in each of these datasets, and how those are also affected by light-time effects (ltte). # # To see the effects over long times, we'll compute one cycle starting at t=0, and another in the distant future. # In[3]: times1 = np.linspace(0,1,201) times2 = np.linspace(90,91,201) # In[4]: b.add_dataset('lc', times=times1, dataset='lc1') b.add_dataset('lc', times=times2, dataset='lc2') # In[5]: b.add_dataset('rv', times=times1, dataset='rv1') b.add_dataset('rv', times=times2, dataset='rv2') # In[6]: b.add_dataset('orb', times=times1, dataset='orb1') b.add_dataset('orb', times=times2, dataset='orb2') # In[7]: b.add_dataset('mesh', times=[0], dataset='mesh1') b.add_dataset('mesh', times=[900], dataset='mesh2') # Changing Systemic Velocity and LTTE # ------------------------------------------------ # **IMPORTANT NOTE:** the definition of vgamma in the 2.0.x releases is to be in the direction of *positive vz*, and therefore *negative RV*. This is inconsistent with the classical definition used in PHOEBE legacy. The 2.0.4 bugfix release addresses this by converting when importing or exporting legacy files. Note that starting in the 2.1 release, the definition within PHOEBE 2 will be changed such that vgamma will be in the direction of *positive RV* and *negative vz*. # By default, vgamma is initially set to 0.0 # In[8]: b['vgamma@system'] # We'll leave it set at 0.0 for now, and then change vgamma to see how that affects the observables. # # The other relevant parameter here is t0 - that is the time at which all quantities are provided, the time at which nbody integration would start (if applicable), and the time at which the center-of-mass of the system is defined to be at (0,0,0). Unless you have a reason to do otherwise, it makes sense to have this value near the start of your time data... so if we don't have any other changing quantities defined in our system and are using BJDs, we would want to set this to be non-zero. In this case, our times all start at 0, so we'll leave t0 at 0 as well. # In[9]: b['t0@system'] # The option to enable or disable LTTE are in the compute options, we can either set ltte or we can just temporarily pass a value when we call run_compute. # In[10]: b['ltte@compute'] # Let's first compute the model with 0 systemic velocity and ltte=False (not that it would matter in this case). Let's also name the model so we can keep track of what settings were used. # In[11]: b.run_compute(irrad_method='none', model='0_false') # For our second model, we'll set a somewhat ridiculous value for the systemic velocity (so that the affects are exagerated and clearly visible over one orbit), but leave ltte off. # In[12]: b['vgamma@system'] = 100 # In[13]: b.run_compute(irrad_method='none', model='100_false') # Lastly, let's leave this value of vgamma, but enable light-time effects. # In[14]: b.run_compute(irrad_method='none', ltte=True, model='100_true') # Influence on Light Curves (fluxes) # ------------------------------------------- # # Now let's compare the various models across all our different datasets. # # In each of the figures below, the left panel will be the first cycle (days 0-3) and the right panel will be 100 cycles later (days 900-903). # # No systemic velocity will be shown in blue, systemic velocity with ltte=False in red, and systemic velocity with ltte=True in green. # # Without light-time effects, the light curve remains unchanged by the introduction of a systemic velocity. # In[15]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['lc1@0_false'].plot(color='b', ax=ax1) axs, artists = b['lc1@100_false'].plot(color='r', ax=ax1) axs, artists = b['lc2@0_false'].plot(color='b', ax=ax2) axs, artists = b['lc2@100_false'].plot(color='r', ax=ax2) # However, once ltte is enabled, the time between two eclipses (ie the observed period of the system) changes. This occurs because the path between the system and observer has changed. This is an important effect to note - the period parameter sets the TRUE period of the system, not necessarily the observed period between two successive eclipses. # In[16]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['lc1@100_false'].plot(color='r', ax=ax1) axs, artists = b['lc1@100_true'].plot(color='g', ax=ax1) axs, artists = b['lc2@100_false'].plot(color='r', ax=ax2) axs, artists = b['lc2@100_true'].plot(color='g', ax=ax2) # Influence on Radial Velocities # ------------------------------------ # # Radial velocities are perhaps the most logical observable in the case of systemic velocities. Introducing a non-zero value for vgamma simply offsets the observed values. # In[17]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['rv1@0_false'].plot(color='b', ax=ax1) axs, artists = b['rv1@100_false'].plot(color='r', ax=ax1) axs, artists = b['rv2@0_false'].plot(color='b', ax=ax2) axs, artists = b['rv2@100_false'].plot(color='r', ax=ax2) # Light-time will have a similar affect on RVs as it does on LCs - it simply changes the observed period. # In[18]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['rv1@100_false'].plot(color='r', ax=ax1) axs, artists = b['rv1@100_true'].plot(color='g', ax=ax1) axs, artists = b['rv2@100_false'].plot(color='r', ax=ax2) axs, artists = b['rv2@100_true'].plot(color='g', ax=ax2) # Influence on Orbits (positions, velocities) # ---------------------- # In the orbit, the addition of a systemic velocity affects both the positions and velocities. So if we plot the orbits from above (x-z plane) we can see see orbit spiral in the z-direction. Note that this actually shows the barycenter of the orbit moving - and it was only at 0,0,0 at t0. This also stresses the importance of using a reasonable t0 - here 900 days later, the barycenter has moved significantly from the center of the coordinate system. # In[19]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['orb1@0_false'].plot(x='xs', y='zs', color='b', ax=ax1) axs, artists = b['orb1@100_false'].plot(x='xs', y='zs', color='r', ax=ax1) axs, artists = b['orb2@0_false'].plot(x='xs', y='zs', color='b', ax=ax2) axs, artists = b['orb2@100_false'].plot(x='xs', y='zs', color='r', ax=ax2) # Plotting the z-velocities with respect to time would show the same as the RVs, except without any Rossiter-McLaughlin like effects. Note however the flip in z-convention between vz and radial velocities (+z is defined as towards the observer to make a right-handed system, but by convention +rv is a red shift). # In[20]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['orb1@0_false'].plot(x='times', y='vzs', color='b', ax=ax1) axs, artists = b['orb1@100_false'].plot(x='times', y='vzs', color='r', ax=ax1) axs, artists = b['orb2@0_false'].plot(x='times', y='vzs', color='b', ax=ax2) axs, artists = b['orb2@100_false'].plot(x='times', y='vzs', color='r', ax=ax2) # Now let's look at the effect that enabling ltte has on these same plots. # In[21]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['orb1@100_false'].plot(x='xs', y='zs', color='r', ax=ax1) axs, artists = b['orb1@100_true'].plot(x='xs', y='zs', color='g', ax=ax1) axs, artists = b['orb2@100_false'].plot(x='xs', y='zs', color='r', ax=ax2) axs, artists = b['orb2@100_true'].plot(x='xs', y='zs', color='g', ax=ax2) # In[22]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['orb1@100_false'].plot(x='times', y='vzs', color='r', ax=ax1) axs, artists = b['orb1@100_true'].plot(x='times', y='vzs', color='g', ax=ax1) axs, artists = b['orb2@100_false'].plot(x='times', y='vzs', color='r', ax=ax2) axs, artists = b['orb2@100_true'].plot(x='times', y='vzs', color='g', ax=ax2) # Influence on Meshes # -------------------------- # In[23]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['mesh1@0_false'].plot(time=0.0, x='xs', y='zs', ax=ax1) axs, artists = b['mesh1@100_false'].plot(time=0.0, x='xs', y='zs', ax=ax1) ax1.set_xlim(-10,10) ax1.set_ylim(-10,10) axs, artists = b['mesh2@0_false'].plot(time=900.0, x='xs', y='zs', ax=ax2) axs, artists = b['mesh2@100_false'].plot(time=900.0, x='xs', y='zs', ax=ax2) ax2.set_xlim(-10,10) ax2.set_ylim(-10,10) # In[24]: fig = plt.figure(figsize=(10,6)) ax1, ax2 = fig.add_subplot(121), fig.add_subplot(122) axs, artists = b['mesh1@100_false'].plot(time=0.0, x='xs', y='zs', ax=ax1) axs, artists = b['mesh1@100_true'].plot(time=0.0, x='xs', y='zs', ax=ax1) ax1.set_xlim(-10,10) ax1.set_ylim(-10,10) axs, artists = b['mesh2@100_false'].plot(time=900.0, x='xs', y='zs', ax=ax2) axs, artists = b['mesh2@100_true'].plot(time=900.0, x='xs', y='zs', ax=ax2) ax2.set_xlim(-10,10) ax2.set_ylim(11170,11200) # As you can see, since the center of mass of the system was at 0,0,0 at t0 - including systemic velocity actually shows the system spiraling towards or away from the observer (who is in the positive z direction). In other words - the positions of the meshes are affected in the same way as the orbits (note the offset on the ylimit scales). # # In addition, the actual values of vz and rv in the meshes are adjusted to include the systemic velocity. # In[25]: b['primary@mesh1@0_false'].get_value('vzs', time=0.0)[:5] # In[26]: b['primary@mesh1@100_false'].get_value('vzs', time=0.0)[:5] # In[27]: b['primary@mesh1@100_true'].get_value('vzs', time=0.0)[:5]
gpl-3.0
renkezuo/util
src/main/java/com/renke/http/DownloadUtil.java
1023
package com.renke.http; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; public class DownloadUtil { public static void mergeBook(String filePath,List<Map<String,String>> dir) throws IOException{ File file = new File(filePath+".txt"); OutputStream os = new FileOutputStream(file); byte[] buf = new byte[8096]; while(dir.size()>0){ Map<String,String> map = dir.remove(0); String file_name = map.get(ParseBook.CHAPTER_HREF); InputStream is = new FileInputStream(new File(filePath+"/"+file_name)); int len = 0; while( (len = is.read(buf)) >=0){ os.write(buf, 0, len); } is.close(); } os.flush(); os.close(); } public static void writeToFile(byte[] bytes , String filePath) throws IOException{ File file = new File(filePath); OutputStream os = new FileOutputStream(file); os.write(bytes); os.close(); } }
gpl-3.0
ThiagoGarciaAlves/ForestryMC
src/main/java/forestry/core/gui/ledgers/ClimateLedger.java
2019
/******************************************************************************* * Copyright (c) 2011-2014 SirSengir. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package forestry.core.gui.ledgers; import forestry.api.core.EnumTemperature; import forestry.api.genetics.AlleleManager; import forestry.core.interfaces.IClimatised; import forestry.core.utils.StringUtil; /** * A ledger containing climate information. */ public class ClimateLedger extends Ledger { private final IClimatised tile; public ClimateLedger(LedgerManager manager, IClimatised tile) { super(manager, "climate"); this.tile = tile; maxHeight = 72; } @Override public void draw(int x, int y) { EnumTemperature temperature = tile.getTemperature(); // Draw background drawBackground(x, y); // Draw icon drawIcon(temperature.getIcon(), x + 3, y + 4); if (!isFullyOpened()) { return; } drawHeader(StringUtil.localize("gui.climate"), x + 22, y + 8); drawSubheader(StringUtil.localize("gui.temperature") + ':', x + 22, y + 20); drawText(AlleleManager.climateHelper.toDisplay(temperature) + ' ' + StringUtil.floatAsPercent(tile.getExactTemperature()), x + 22, y + 32); drawSubheader(StringUtil.localize("gui.humidity") + ':', x + 22, y + 44); drawText(AlleleManager.climateHelper.toDisplay(tile.getHumidity()) + ' ' + StringUtil.floatAsPercent(tile.getExactHumidity()), x + 22, y + 56); } @Override public String getTooltip() { return "T: " + AlleleManager.climateHelper.toDisplay(tile.getTemperature()) + " / H: " + AlleleManager.climateHelper.toDisplay(tile.getHumidity()); } }
gpl-3.0
Monofraps/rebindr-public
src/dns/DNSUtils.cpp
2323
/* * rebindr * Copyright (C) 2014 Nicolas Ristock (monofraps@gmail.com) * * * This file is part of rebindr. * * rebindr is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * rebindr is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with rebindr. If not, see <http://www.gnu.org/licenses/>. */ /* * DNSUtils.cpp * * Created on: Nov 16, 2013 * Author: monofraps */ // hto*/nto* functions #include <arpa/inet.h> #include <iostream> #include "DNSQuery.hpp" #include "DNSUtils.hpp" using std::ostream; namespace rebindr { namespace dns { void writeIntToStream(ostream& stream, int value) { int temp = htonl(value); stream.write((char*) &temp, sizeof(int)); } void writeShortToStream(ostream& stream, short value) { short temp = htons(value); stream.write((char*) &temp, sizeof(short)); } void writeByteToStream(ostream& stream, char value) { stream.write(&value, sizeof(char)); } void writeResponseHeader(ostream& stream, Query* response) { writeShortToStream(stream, response->transactionID); writeShortToStream(stream, response->flags); writeShortToStream(stream, response->numQuestionRecords); writeShortToStream(stream, response->numAnswerRecords); writeShortToStream(stream, response->numAuthRecords); writeShortToStream(stream, response->numAdditionalRecords); } void writeResponseEntryHeader(ostream& stream, short recordType, short dataLength) { // Resource Record Name writeByteToStream(stream, 19); stream << "lernleistung-rebind"; writeByteToStream(stream, 2); stream << "de"; writeByteToStream(stream, 0); // Resource Record Type writeShortToStream(stream, recordType); // Resource Record Class (INET) writeShortToStream(stream, 1); // TTL as 32bit int writeIntToStream(stream, 600); // Size of following answer payload writeShortToStream(stream, dataLength); } } /* namespace dns */ } /* namespace rebindr */
gpl-3.0
shaunt-nait/moodle_24_dev
wspp/tests/test_edit_sections.php
559
<?php require_once ('../classes/MoodleWS.php'); $client=new MoodleWS(); require_once ('../auth.php'); /**test code for MoodleWS: Edit section Information * @param int $client * @param string $sesskey * @param editSectionsInput $sections * @return editSectionsOutput */ $lr=$client->login(LOGIN,PASSWORD); $sections= new editSectionsInput(); $sections->setSections(array()); $res=$client->edit_sections($lr->getClient(),$lr->getSessionKey(),$sections); print_r($res); print($res->getSections()); $client->logout($lr->getClient(),$lr->getSessionKey()); ?>
gpl-3.0
sprax/java
aligns/FuzzyInsGapGSA.java
1789
package sprax.aligns; import java.util.ArrayList; import java.util.Comparator; /** * FIXME: Where's the multi-insert/multi-gap functionality? * TODO: The comparisons are not yet all that fuzzy! * @author sprax * * @param <T> * @param <U> */ public class FuzzyInsGapGSA<T, U extends Comparator<T>> extends InsGapSequenceAlignment<T> { U mDifferencer; FuzzyInsGapGSA(ArrayList<T> sA, ArrayList<T> sB, U differencer) { super(sA, sB); mDifferencer = differencer; } public static int test_FGSA(int verbose, CharacterDifference charDiff, String strA, String strB) { ArrayList<Character> seqA = createCharacterArrayList(strA); ArrayList<Character> seqB = createCharacterArrayList(strB); FuzzyGSA<Character, CharacterDifference> align = new FuzzyGSA<Character, CharacterDifference>(seqA, seqB, charDiff); align.test_alignment(verbose); return 0; } /************************************************************************ * unit_test */ public static int unit_test(int verbose) { CharacterDifference charDiff = new CharacterDifference(); FuzzyGSA.test_FGSA(verbose, charDiff, "Well... Do not get mad, get even!", "Don't get mud, get cleaner?"); FuzzyGSA.test_FGSA(verbose, charDiff, "ABCDABCJABCKABDM", "ABCL"); // Second string has no J, but its K matches J in first string. // First string has no L, but its second M matches L in second string. FuzzyGSA.test_FGSA(verbose, charDiff, "ABCIABCJMABCMPXYZ", "ABCKABCL"); FuzzyGSA.test_FGSA(verbose, charDiff, "abcDEFdefJKLqr", "abcJKLabcPQRdefMNOPq"); return 0; } public static void main(String[] args) { unit_test(2); } }
gpl-3.0
opendatabio/opendatabio
resources/views/media/create.blade.php
9683
@extends('layouts.app') @section('content') <div class="container"> <div class="col-sm-offset-2 col-sm-8"> <div class="panel panel-default"> <div class="panel-heading"> @if (isset($media)) @lang('messages.media_edit_for_model'): @else @lang('messages.media_new_for_model'): @endif &nbsp; <strong>{{ class_basename($object) }}</strong> {!! $object->rawLink() !!} &nbsp; <a data-toggle="collapse" href="#media_hint" class="btn btn-default">?</a> <div id="media_hint" class="panel-collapse collapse"> <br> @lang('messages.media_mimes_hint') <code> {{ $validMimeTypes }} </code> </div> </div> <div class="panel-body"> <!-- Display Validation Errors --> @include('common.errors') <div id="ajax-error" class="collapse alert alert-danger"> @lang('messages.whoops') </div> @if (isset($media)) <form action="{{ url('media/'.$media->id) }}" method="POST" class="form-horizontal" enctype="multipart/form-data"> {{ method_field('PUT') }} @else <form action="{{ url('media') }}" method="POST" class="form-horizontal" enctype="multipart/form-data"> @endif <!-- csrf protection --> {{ csrf_field() }} <input type="hidden" name="model_id" value="{{$object->id}}"> <input type="hidden" name="model_type" value="{{get_class($object)}}"> <hr> @if (isset($customProperties)) <input type="hidden" name="custom_properties" value="{{ $customProperties}}"> @endif @if (isset($media)) @php $fileUrl = $media->getUrl(); @endphp <div class="form-group"> <div class="col-sm-12"> <input type="hidden" name="media_id" value="{{$media->id}}"> @if ($media->media_type == 'image') <img src="{{ $fileUrl }}" alt="" class='vertical_center'> @endif @if ($media->media_type == 'video') <video controls class='vertical_center'> <source src="{{ $fileUrl }}" type="{{ $media->mime_type }}"/> Your browser does not support the video tag. </video> @endif @if ($media->media_type == 'audio') <center > <br><br> <i class="fas fa-file-audio fa-6x"></i> <br><br> <audio controls > <source src="{{ $fileUrl }}" type="{{ $media->mime_type }}"/> </audio> </center> @endif </div> </div> @else <div class="form-group"> <div class="col-sm-12"> <label for="uploaded_media" class="col-sm-3 control-label mandatory"> @lang('messages.media_file') </label> <div class="col-sm-6"> <input type="file" name="uploaded_media" id="uploaded_media" > </div> </div> </div> @endif <div class="form-group"> <label for="title" class="col-sm-3 control-label"> @lang('messages.title') </label> <a data-toggle="collapse" href="#title_hint" class="btn btn-default">?</a> <div class="col-sm-6"> <table class="table table-striped"> <thead> <th> @lang('messages.language') </th> <th> @lang('messages.value') </th> </thead> <tbody> @foreach ($languages as $language) <tr> <td>{{$language->name}}</td> <td> @php $mediaTitle = old('description.'. $language->id, isset($media) ? $media->translate(\App\Models\UserTranslation::DESCRIPTION, $language->id) : null); @endphp <textarea name="description[{{$language->id}}]" class='max_width'>{{$mediaTitle}}</textarea> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="form-group"> <label for="tags" class="col-sm-3 control-label"> @lang('messages.tags') </label> <a data-toggle="collapse" href="#tags_hint" class="btn btn-default">?</a> <div class="col-sm-6"> {!! Multiselect::select( 'tags', $tags->pluck('name', 'id'), isset($media) ? $media->tags->pluck('id') : [], ['class' => 'multiselect form-control'] ) !!} </div> <div id="tags_hint" class="col-sm-12 collapse"> @lang('messages.tags_hint') </div> </div> <hr> <div class="form-group"> <label for="collector" class="col-sm-3 control-label" id='authorslabel'> @lang('messages.credits') </label> <a data-toggle="collapse" href="#credits_hint" class="btn btn-default">?</a> <div class="col-sm-6"> {!! Multiselect::autocomplete('collector', $persons->pluck('abbreviation', 'id'), isset($media) ? $media->collectors->pluck('person_id') : '', ['class' => 'multiselect form-control']) !!} </div> <div id="credits_hint" class="col-sm-12 collapse"> @lang('messages.credits_hint') </div> </div> <!-- license object must be an array with CreativeCommons license codes applied to the model ---> <div class="form-group" id='creativecommons' > <label for="license" class="col-sm-3 control-label mandatory"> @lang('messages.public_license') </label> <a data-toggle="collapse" href="#creativecommons_media_hint" class="btn btn-default">?</a> <div class="col-sm-6"> @php $currentLicense = "CC0"; $currentVersion = config('app.creativecommons_version')[0]; if (isset($media)) { if (null != $media->license) { $license = explode(' ',$media->license); $currentLicense = $license[0]; $currentVersion = $license[1]; } } $oldLicense = old('license', $currentLicense); $oldVersion = old('version',$currentVersion); $readonly = null; if (count(config('app.creativecommons_version'))==1) { $readonly = 'readonly'; } @endphp <select name="license" id="license" class="form-control" > @foreach (config('app.creativecommons_licenses') as $level) <option value="{{ $level }}" {{ $level == $oldLicense ? 'selected' : '' }}> {{$level}} - @lang('levels.' . $level) </option> @endforeach </select> <strong>version:</strong> @if (null != $readonly) <input type="hidden" name="license_version" value=" {{ $oldVersion }}"> {{ $oldVersion }} @else <select name="license_version" class="form-control" {{ $readonly }}> @foreach (config('app.creativecommons_version') as $version) <option value="{{ $version }}" {{ $version == $oldVersion ? 'selected' : '' }}> {{ $version}} </option> @endforeach </select> @endif </div> <div class="col-sm-12"> <div id="creativecommons_media_hint" class="panel-collapse collapse"> <br> @lang('messages.creativecommons_media_hint') </div> </div> </div> <!-- dataset --> <div class="form-group"> <label for="dataset" class="col-sm-3 control-label "> @lang('messages.dataset') </label> <a data-toggle="collapse" href="#dataset_hint" class="btn btn-default">?</a> <div class="col-sm-6"> <input type="text" name="dataset_autocomplete" id="dataset_autocomplete" class="form-control autocomplete" value="{{ old('dataset_autocomplete', (isset($media) and $media->dataset_id) ? $media->dataset->name : null) }}"> <input type="hidden" name="dataset_id" id="dataset_id" value="{{ old('dataset_id', isset($media) ? $media->dataset_id : null) }}"> </div> <div class="col-sm-12"> <div id="dataset_hint" class="panel-collapse collapse"> @lang('messages.media_dataset_hint') </div> </div> </div> <div class="form-group" > <label for="date" class="col-sm-3 control-label">@lang('messages.date')</label> <a data-toggle="collapse" href="#date_hint" class="btn btn-default">?</a> <div class="col-sm-6"> <input type="date" name="date" value="{{ old('date',isset($media) ? $media->date : null) }}" min="1600-01-01" max={{today()}}> </div> <div id="date_hint" class="col-sm-12 collapse"> @lang('messages.media_date_hint') </div> </div> <div class="form-group"> <label for="notes" class="col-sm-3 control-label"> @lang('messages.notes') </label> <div class="col-sm-6"> <textarea name="notes" id="notes" class="form-control">{{ old('notes', isset($media) ? $media->notes : null) }}</textarea> </div> </div> <div class="form-group"> <div class="col-sm-offset-3 col-sm-6"> <button type="submit" class="btn btn-success" name="submit" value="submit"> <i class="fa fa-btn fa-plus"></i> @lang('messages.add') </button> <a href="{{url()->previous()}}" class="btn btn-warning"> <i class="fa fa-btn fa-plus"></i> @lang('messages.back') </a> </div> </div> </form> </div> </div> <style > .vertical_center { display: flex; justify-content: center; align-items: center; height: 99%; width: 99%; } .max_width { max-width: 100%; } </style> @endsection @push ('scripts') {!! Multiselect::scripts('collector', url('persons/autocomplete'), ['noSuggestionNotice' => Lang::get('messages.noresults')]) !!} <script> $(document).ready(function() { $("#dataset_autocomplete").odbAutocomplete("{{url('datasets/autocomplete')}}","#dataset_id", "@lang('messages.noresults')"); /* if license is different than public domain, title and authors must be informed */ /* and sui generis database policies may be included */ $('#license').on('change',function() { var license = $('#license option:selected').val(); if (license == "CC0") { $('#authorslabel').removeClass('mandatory'); } else { $('#authorslabel').addClass('mandatory'); } }); }); </script> @endpush
gpl-3.0
jeremyhahn/jbillingphpapi
test/CreateItemTest.php
1281
<?php /** * jbilling-php-api * Copyright (C) 2007-2009 Make A Byte, inc * http://www.makeabyte.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package com.makeabyte.contrib.jbilling.php.test */ require_once 'BaseTest.php'; class CreateItemTest extends BaseTest { public function test() { $item = new MockItemDTOEx(); print_r( $item->getObject() ); try { $actual = $this->api->createItem( $item->getObject() ); PHPUnit_Framework_Assert::assertGreaterThan( 0, $actual, 'Error creating new item' ); } catch( JbillingAPIException $e ) { PHPUnit_Framework_Assert::fail( $e->getMessage() ); } } } ?>
gpl-3.0
rndmem/sound-of-water
src/js/entity/floor.js
359
// @flow const Entity = require('./entity'), Palette = require('../palette') class Floor extends Entity { update(width: number, height: number): void { super.update(width, height) this.gfx().beginFill(Palette.GOLD) this.gfx().drawRect(Math.floor(-width / 2), height / 2 - 1, width, 1) this.gfx().endFill() } } module.exports = Floor
gpl-3.0
vizabi/vizabi-ddfcsv-reader
src/ddfcsv-reader.ts
4175
import * as isEmpty from 'lodash.isempty'; import { ddfCsvReader } from './ddf-csv'; import { IResourceRead } from './interfaces'; import { getRepositoryPath } from 'ddf-query-validator'; import { DdfCsvError } from './ddfcsv-error'; import { createDiagnosticManagerOn, EndpointDiagnosticManager, getLevelByLabel } from 'cross-project-diagnostics'; import { DiagnosticManager, Level } from 'cross-project-diagnostics/lib'; const myName = ''; const myVersion = ''; export function prepareDDFCsvReaderObject (defaultResourceReader?: IResourceRead) { return function(externalResourceReader?: IResourceRead, logger?: any) { return { init (readerInfo) { // TODO: check validity of base path this._basePath = readerInfo.path; this._lastModified = readerInfo._lastModified; this.fileReader = externalResourceReader || defaultResourceReader; this.logger = logger; this.resultTransformer = readerInfo.resultTransformer; this.readerOptions = { basePath: this._basePath, fileReader: this.fileReader, logger: this.logger, }; this.reader = ddfCsvReader(this.logger); }, async getFile (filePath: string, isJsonFile: boolean, options: object): Promise<any> { return new Promise((resolve, reject) => { this.fileReader.readText(filePath, (err, data) => { if (err) { return reject(err); } try { if (isJsonFile) { return resolve(JSON.parse(data)); } return resolve(data); } catch (jsonErr) { return reject(jsonErr); } }, options); }); }, async getAsset (filePath: string, repositoryPath: string = ''): Promise<any> { if (isEmpty(repositoryPath) && isEmpty(this._basePath)) { throw new DdfCsvError(`Neither initial 'path' nor 'repositoryPath' as a second param were found.`, `Happens in 'getAsset' function`, filePath); } const assetPath = `${repositoryPath || this._basePath}/${filePath}`; const isJsonAsset = (assetPath).slice(-'.json'.length) === '.json'; return await this.getFile(assetPath, isJsonAsset); }, async read (queryParam, parsers, parentDiagnostic?: DiagnosticManager) { const diagnostic = parentDiagnostic ? createDiagnosticManagerOn(myName, myVersion).basedOn(parentDiagnostic) : createDiagnosticManagerOn(myName, myVersion).forRequest('').withSeverityLevel(Level.OFF); const { debug, error, fatal } = diagnostic.prepareDiagnosticFor('read'); let result; debug('start reading', queryParam); try { if (isEmpty(queryParam.repositoryPath) && isEmpty(this._basePath)) { const message = `Neither initial 'path' nor 'repositoryPath' in query were found.`; const err = new DdfCsvError(message, JSON.stringify(queryParam)); error(message, err); throw err; } result = await this.reader.query(queryParam, { basePath: queryParam.repositoryPath || this._basePath, fileReader: this.fileReader, logger: this.logger, conceptsLookup: new Map<string, any>(), diagnostic }); result = parsers ? this._prettifyData(result, parsers) : result; if (this.resultTransformer) { result = this.resultTransformer(result); } if (this.logger && this.logger.log) { logger.log(JSON.stringify(queryParam), result.length); logger.log(result); } } catch (err) { fatal('global data reading error', err); throw err; } return result; }, _prettifyData (data, parsers) { return data.map(record => { const keys = Object.keys(record); keys.forEach(key => { if (parsers[ key ]) { record[ key ] = parsers[ key ](record[ key ]); } }); return record; }); } }; }; }
gpl-3.0
rbreitenmoser/snapcraft
snapcraft/tests/test_pluginhandler.py
12045
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import logging import os import tempfile from unittest.mock import ( Mock, patch, ) import fixtures from snapcraft import ( common, pluginhandler, tests, ) class PluginTestCase(tests.TestCase): def test_init_unknown_plugin_must_raise_exception(self): fake_logger = fixtures.FakeLogger(level=logging.ERROR) self.useFixture(fake_logger) with self.assertRaises(pluginhandler.PluginError) as raised: pluginhandler.load_plugin('fake-part', 'test_unexisting') self.assertEqual(raised.exception.__str__(), 'unknown plugin: test_unexisting') def test_fileset_include_excludes(self): stage_set = [ '-etc', 'opt/something', '-usr/lib/*.a', 'usr/bin', '\-everything', r'\\a', ] include, exclude = pluginhandler._get_file_list(stage_set) self.assertEqual(include, ['opt/something', 'usr/bin', '-everything', r'\a']) self.assertEqual(exclude, ['etc', 'usr/lib/*.a']) def test_fileset_only_includes(self): stage_set = [ 'opt/something', 'usr/bin', ] include, exclude = pluginhandler._get_file_list(stage_set) self.assertEqual(include, ['opt/something', 'usr/bin']) self.assertEqual(exclude, []) def test_fileset_only_excludes(self): stage_set = [ '-etc', '-usr/lib/*.a', ] include, exclude = pluginhandler._get_file_list(stage_set) self.assertEqual(include, ['*']) self.assertEqual(exclude, ['etc', 'usr/lib/*.a']) def test_migrate_snap_files(self): filesets = { 'nothing': { 'fileset': ['-*'], 'result': [] }, 'all': { 'fileset': ['*'], 'result': [ 'stage/1', 'stage/1/1a/1b', 'stage/1/1a', 'stage/1/a', 'stage/2', 'stage/2/2a', 'stage/3', 'stage/3/a', 'stage/a', 'stage/b', ], }, 'no1': { 'fileset': ['-1'], 'result': [ 'stage/2', 'stage/2/2a', 'stage/3', 'stage/3/a', 'stage/a', 'stage/b', ], }, 'onlya': { 'fileset': ['a'], 'result': [ 'stage/a', ], }, 'onlybase': { 'fileset': ['*', '-*/*'], 'result': [ 'stage/a', 'stage/b', 'stage/1', 'stage/2', 'stage/3', ], }, 'nostara': { 'fileset': ['-*/a'], 'result': [ 'stage/1', 'stage/1/1a/1b', 'stage/1/1a', 'stage/2', 'stage/2/2a', 'stage/3', 'stage/a', 'stage/b', ], }, } for key in filesets: with self.subTest(key=key): tmpdirObject = tempfile.TemporaryDirectory() self.addCleanup(tmpdirObject.cleanup) tmpdir = tmpdirObject.name srcdir = tmpdir + '/install' os.makedirs(tmpdir + '/install/1/1a/1b') os.makedirs(tmpdir + '/install/2/2a') os.makedirs(tmpdir + '/install/3') open(tmpdir + '/install/a', mode='w').close() open(tmpdir + '/install/b', mode='w').close() open(tmpdir + '/install/1/a', mode='w').close() open(tmpdir + '/install/3/a', mode='w').close() dstdir = tmpdir + '/stage' os.makedirs(dstdir) files, dirs = pluginhandler._migratable_filesets( filesets[key]['fileset'], srcdir) pluginhandler._migrate_files(files, dirs, srcdir, dstdir) expected = [] for item in filesets[key]['result']: expected.append(os.path.join(tmpdir, item)) expected.sort() result = [] for root, subdirs, files in os.walk(dstdir): for item in files: result.append(os.path.join(root, item)) for item in subdirs: result.append(os.path.join(root, item)) result.sort() self.assertEqual(expected, result) def test_migrate_snap_files_already_exists(self): os.makedirs('install') os.makedirs('stage') # Place the already-staged file with open('stage/foo', 'w') as f: f.write('staged') # Place the to-be-staged file with the same name with open('install/foo', 'w') as f: f.write('installed') files, dirs = pluginhandler._migratable_filesets('*', 'install') pluginhandler._migrate_files(files, dirs, 'install', 'stage') # Verify that the staged file is the one that was staged last with open('stage/foo', 'r') as f: self.assertEqual(f.read(), 'installed', 'Expected staging to allow overwriting of ' 'already-staged files') @patch('snapcraft.pluginhandler._load_local') @patch('snapcraft.pluginhandler._get_plugin') def test_schema_not_found(self, plugin_mock, local_load_mock): mock_plugin = Mock() mock_plugin.schema.return_value = {} plugin_mock.return_value = mock_plugin local_load_mock.return_value = "not None" common.set_schemadir(os.path.join('', 'foo')) with self.assertRaises(FileNotFoundError): pluginhandler.PluginHandler('mock', 'mock-part', {}) @patch('importlib.import_module') @patch('snapcraft.pluginhandler._load_local') @patch('snapcraft.pluginhandler._get_plugin') def test_non_local_plugins(self, plugin_mock, local_load_mock, import_mock): mock_plugin = Mock() mock_plugin.schema.return_value = {} plugin_mock.return_value = mock_plugin local_load_mock.side_effect = ImportError() pluginhandler.PluginHandler('mock', 'mock-part', {}) import_mock.assert_called_with('snapcraft.plugins.mock') local_load_mock.assert_called_with('x-mock') def test_filesets_includes_without_relative_paths(self): with self.assertRaises(pluginhandler.PluginError) as raised: pluginhandler._get_file_list(['rel', '/abs/include']) self.assertEqual( 'path "/abs/include" must be relative', str(raised.exception)) def test_filesets_exlcudes_without_relative_paths(self): with self.assertRaises(pluginhandler.PluginError) as raised: pluginhandler._get_file_list(['rel', '-/abs/exclude']) self.assertEqual( 'path "/abs/exclude" must be relative', str(raised.exception)) class PluginMakedirsTestCase(tests.TestCase): scenarios = [ ('existing_dirs', {'make_dirs': True}), ('unexisting_dirs', {'make_dirs': False}) ] def get_plugin_dirs(self, part_name): parts_dir = os.path.join(self.path, 'parts') return [ os.path.join(parts_dir, part_name, 'src'), os.path.join(parts_dir, part_name, 'build'), os.path.join(parts_dir, part_name, 'install'), os.path.join(self.path, 'stage'), os.path.join(self.path, 'snap') ] def test_makedirs_with_existing_dirs(self): part_name = 'test_part' dirs = self.get_plugin_dirs(part_name) if self.make_dirs: os.makedirs(os.path.join('parts', part_name)) for d in dirs: os.mkdir(d) p = pluginhandler.load_plugin(part_name, 'nil') p.makedirs() for d in dirs: self.assertTrue(os.path.exists(d), '{} does not exist'.format(d)) class CleanTestCase(tests.TestCase): @patch('shutil.rmtree') @patch('os.path.exists') def test_clean_part_that_exists(self, mock_exists, mock_rmtree): mock_exists.return_value = True part_name = 'test_part' p = pluginhandler.load_plugin(part_name, 'nil') p.clean() partdir = os.path.join( os.path.abspath(os.curdir), 'parts', part_name) mock_exists.assert_called_once_with(partdir) mock_rmtree.assert_called_once_with(partdir) @patch('shutil.rmtree') @patch('os.path.exists') def test_clean_part_already_clean(self, mock_exists, mock_rmtree): mock_exists.return_value = False part_name = 'test_part' p = pluginhandler.load_plugin(part_name, 'nil') p.clean() partdir = os.path.join( os.path.abspath(os.curdir), 'parts', part_name) mock_exists.assert_called_once_with(partdir) self.assertFalse(mock_rmtree.called) class CollisionTestCase(tests.TestCase): def setUp(self): super().setUp() tmpdirObject = tempfile.TemporaryDirectory() self.addCleanup(tmpdirObject.cleanup) tmpdir = tmpdirObject.name part1 = pluginhandler.load_plugin('part1', 'nil') part1.code.installdir = tmpdir + '/install1' os.makedirs(part1.installdir + '/a') open(part1.installdir + '/a/1', mode='w').close() part2 = pluginhandler.load_plugin('part2', 'nil') part2.code.installdir = tmpdir + '/install2' os.makedirs(part2.installdir + '/a') with open(part2.installdir + '/1', mode='w') as f: f.write('1') open(part2.installdir + '/2', mode='w').close() with open(part2.installdir + '/a/2', mode='w') as f: f.write('a/2') part3 = pluginhandler.load_plugin('part3', 'nil') part3.code.installdir = tmpdir + '/install3' os.makedirs(part3.installdir + '/a') os.makedirs(part3.installdir + '/b') with open(part3.installdir + '/1', mode='w') as f: f.write('2') with open(part2.installdir + '/2', mode='w') as f: f.write('1') open(part3.installdir + '/a/2', mode='w').close() self.part1 = part1 self.part2 = part2 self.part3 = part3 def test_no_collisions(self): """No exception is expected as there are no collisions.""" pluginhandler.check_for_collisions([self.part1, self.part2]) def test_collisions_between_two_parts(self): with self.assertRaises(EnvironmentError) as raised: pluginhandler.check_for_collisions( [self.part1, self.part2, self.part3]) self.assertEqual( raised.exception.__str__(), "Parts 'part2' and 'part3' have the following file paths in " "common which have different contents:\n1\na/2")
gpl-3.0
ArtCraftCode/knitcalc.co
app/scripts/controllers/increase.js
1725
'use strict'; // /** // * @ngdoc function // * @name knitcalcApp.controller:IncreasesCtrl // * @description // * # IncreasesCtrl // * Controller of the knitcalcApp // */ angular.module('knitcalcApp') .controller('IncreaseCtrl', function ($scope, calculator) { $scope.title = 'Increase evenly across a row'; $scope.formName = 'increaseForm'; $scope.action = 'increase'; var errors = {}; errors.tooSmall = 'The starting number is bigger than your ending number!'; errors.tooLarge = 'The difference is too large! Pick an ending number that is less than double the starting number.'; $scope.errors = errors; function calculate() { calculator.difference($scope); calculator.remainder($scope); calculator.fancyMath($scope, 'increase'); validate(); unbalancedView(); } $scope.calculate = calculate; function validate() { $scope.results.tooSmall = false; $scope.results.tooLarge = false; if ($scope.results.difference >= $scope.sts.starting) { $scope.results.tooLarge = true; } else if ($scope.sts.ending <= $scope.sts.starting) { $scope.results.tooSmall = true; } else { $scope.results.visible = true; } } function unbalancedView() { var base = '(k' + $scope.results.multiSts + ', m1) ' + $scope.results.multiTimes + ' times'; var ending = ' (' + $scope.sts.ending + ' sts total).'; if ($scope.results.remainderTimes === 0) { $scope.results.unbalanced = base + ending; } else { $scope.results.unbalanced = base + ', (k' + $scope.results.remainderSts + ', m1) ' + $scope.results.remainderTimes + ' times' + ending; } } });
gpl-3.0
MailCleaner/MailCleaner
www/framework/Zend/Form/Decorator/Captcha/Word.php
2450
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Form * @subpackage Decorator * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** @see Zend_Form_Decorator_Abstract */ require_once 'Zend/Form/Decorator/Abstract.php'; /** * Word-based captcha decorator * * Adds hidden field for ID and text input field for captcha text * * @category Zend * @package Zend_Form * @subpackage Element * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Word.php,v 1.1.2.4 2011-05-30 08:30:56 root Exp $ */ class Zend_Form_Decorator_Captcha_Word extends Zend_Form_Decorator_Abstract { /** * Render captcha * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $name = $element->getFullyQualifiedName(); $hiddenName = $name . '[id]'; $textName = $name . '[input]'; $label = $element->getDecorator("Label"); if($label) { $label->setOption("id", $element->getId()."-input"); } $placement = $this->getPlacement(); $separator = $this->getSeparator(); $hidden = $view->formHidden($hiddenName, $element->getValue(), $element->getAttribs()); $text = $view->formText($textName, '', $element->getAttribs()); switch ($placement) { case 'PREPEND': $content = $hidden . $separator . $text . $separator . $content; break; case 'APPEND': default: $content = $content . $separator . $hidden . $separator . $text; } return $content; } }
gpl-3.0
OsirisSPS/osiris-sps
client/src/core/textfile.cpp
6666
// <osiris_sps_source_header> // This file is part of Osiris Serverless Portal System. // Copyright (C)2005-2012 Osiris Team (info@osiris-sps.org) / http://www.osiris-sps.org ) // // Osiris Serverless Portal System is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Osiris Serverless Portal System is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Osiris Serverless Portal System. If not, see <http://www.gnu.org/licenses/>. // </osiris_sps_source_header> #include "stdafx.h" #include "textfile.h" #include "charset.h" #include "platformmanager.h" ////////////////////////////////////////////////////////////////////// OS_NAMESPACE_BEGIN() ////////////////////////////////////////////////////////////////////// TextFile::TextFile(Encoding encoding) { m_encoding = encoding; } TextFile::TextFile(const String &filename, uint32 flags, Encoding encoding) { m_encoding = encoding; // Richiama la open al posto di passare i parametri alla classe base (la chiamata // nel costruttore dalla base non chiamerebbe la virtuale) open(filename, flags); } TextFile::~TextFile() { } bool TextFile::readLine(String &line) { line.clear(); switch(m_encoding) { case feAscii: return _readLineAscii(line); case feUtf8: return _readLineUtf8(line); case feUnicode: return _readLineUnicode(line); } return false; } bool TextFile::writeLine(const String &line) { switch(m_encoding) { case feAscii: return _writeLineAscii(line.to_ascii()); case feUtf8: return _writeLineUtf8(line.to_utf8()); case feUnicode: return _writeLineUnicode(line); } return false; } bool TextFile::readChar(char &c) { return read(&c, sizeof(char)) == sizeof(char); } bool TextFile::writeChar(char c) { return write(&c, sizeof(char)) == sizeof(char); } bool TextFile::readChar(wchar &c) { return read(&c, sizeof(wchar)) == sizeof(wchar); } bool TextFile::writeChar(wchar c) { return write(&c, sizeof(wchar)) == sizeof(wchar); } String TextFile::readFile(const String &filename) { String out; if(readFile(filename, out)) return out; else return String::EMPTY; } bool TextFile::readFile(const String &filename, String &str) { str.clear(); shared_ptr<TextFile> file(OS_NEW TextFile()); if(file->open(filename, TextFile::ofRead) == false) return false; String line; while(file->readLine(line)) { str.append(line); str.append(_S("\r\n")); } return true; } bool TextFile::_readLineAscii(String &line) { bool done = false; std::string str; char c = 0; while(readChar(c)) { done = true; if(c == '\n') break; if(c != '\r') str += c; } line.from_ascii(str); return done; } bool TextFile::_writeLineAscii(const std::string &line) { uint32 size = static_cast<uint32>(line.size()); if(write(line.data(), size) != size) return false; if(writeChar('\r') == false) return false; if(writeChar('\n') == false) return false; return true; } bool TextFile::_readLineUtf8(String &line) { bool done = false; std::string str; char c = 0; while(readChar(c)) { done = true; if(c == '\n') break; if(c != '\r') str += c; } line.from_utf8(str); return done; } bool TextFile::_writeLineUtf8(const std::string &line) { uint32 size = static_cast<uint32>(line.size()); if(write(line.data(), size) != size) return false; if(writeChar('\r') == false) return false; if(writeChar('\n') == false) return false; return true; } bool TextFile::_readLineUnicode(String &line) { bool done = false; std::wstring str; wchar c = 0; while(readChar(c)) { done = true; if(c == chLF) break; if(c != chCR) str += c; } line.from_wide(str); return done; } bool TextFile::_writeLineUnicode(const String &line) { if(write(line.buffer(), static_cast<uint32>(line.buffer_size())) != static_cast<uint32>(line.buffer_size())) return false; static String endline = _S("\r\n"); return write(endline.buffer(), static_cast<uint32>(endline.buffer_size())) == static_cast<uint32>(endline.buffer_size()); } bool TextFile::open(const String &filename, uint32 flags) { if(FileBase::open(filename, flags) == false) return false; if(flags & ofWrite) { if(empty()) { if(writeBOM() == false) return false; } else if((flags & ofRead) != ofRead) { // Non può determinare l'encoding close(); return false; } } if(flags & ofRead) { if(readBOM() == false) return false; } return true; } bool TextFile::readBOM() { uint64 pos = position(); if(pos != 0) seekToBegin(); byte header[3]; bool done = false; uint32 length = read(header, 2); if(length == 2) { if(header[0] == 0xEF && header[1] == 0xBB) { if(read(&header[2], 1) == 1) { if(header[2] == 0xBF) { m_encoding = feUtf8; done = true; } } } else if(header[0] == 0xFF && header[1] == 0xFE) { m_encoding = feUnicode; done = true; } else if(header[0] == 0xFE && header[1] == 0xFF) { // Il big endian non è supportato OS_ASSERTFALSE(); return false; } } if(done == false) { // Nel caso non sia stato trovato alcun header assume che il file sia in ascii m_encoding = feAscii; seekToBegin(); } if(pos != 0) { // Ripristina la posizione solo se non era quella iniziale, altrimenti // mantiene quella corrente (successiva all'header se esiste) seek(pos, seekBegin); } return true; } bool TextFile::writeBOM() { if(m_encoding == feAscii) return true; uint64 pos = position(); seekToBegin(); switch(m_encoding) { case feUtf8: { static const byte tag_utf8[3] = { 0xEF, 0xBB, 0xBF }; write(tag_utf8, sizeof(tag_utf8)); } break; case feUnicode: { static const byte tag_unicode[2] = { 0xFF, 0xFE }; write(tag_unicode, sizeof(tag_unicode)); } break; default: OS_EXCEPTION("Invalid file encoding"); break; } if(pos != 0) { // Ripristina la posizione solo se non era quella iniziale, altrimenti // mantiene quella corrente (successiva all'header se esiste) seek(pos, seekBegin); } return true; } ////////////////////////////////////////////////////////////////////// OS_NAMESPACE_END() //////////////////////////////////////////////////////////////////////
gpl-3.0
srnsw/xena
plugins/project/src/au/gov/naa/digipres/xena/plugin/project/MsProjectToXenaProjectNormaliser.java
3164
/** * This file is part of Xena. * * Xena is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. * * Xena is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Xena; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * @author Andrew Keeling * @author Chris Bitmead * @author Justin Waddell * @author Matthew Oliver */ package au.gov.naa.digipres.xena.plugin.project; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import net.sf.mpxj.MPXJException; import net.sf.mpxj.ProjectFile; import net.sf.mpxj.mpp.MPPReader; import net.sf.mpxj.mspdi.MSPDIWriter; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; import au.gov.naa.digipres.xena.kernel.ByteArrayInputSource; import au.gov.naa.digipres.xena.kernel.XenaInputSource; import au.gov.naa.digipres.xena.kernel.normalise.AbstractNormaliser; import au.gov.naa.digipres.xena.kernel.normalise.NormaliserResults; /** * Normalise Ms Project files to Xena Project files. For pragmatic reasons, the * Xena project format is identical to the MS Project XML export format. This is * perhaps not ideal, but it would be difficult to design another format. * */ public class MsProjectToXenaProjectNormaliser extends AbstractNormaliser { @Override public String getName() { return "Microsoft Project"; } @Override public void parse(InputSource input, NormaliserResults results) throws IOException, SAXException { ProjectFile projFile = null; try { MPPReader mppReader = new MPPReader(); projFile = mppReader.read(input.getByteStream()); } catch (MPXJException x) { throw new SAXException(x); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); MSPDIWriter mspdiWriter = new MSPDIWriter(); mspdiWriter.write(projFile, baos); XenaInputSource is = new ByteArrayInputSource(baos.toByteArray(), null); XMLReader reader = null; try { reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); } catch (ParserConfigurationException x) { throw new SAXException(x); } XMLFilterImpl filter = new XMLFilterImpl(reader) { // Without this our doc gets meta-data wrapped twice. @Override public void endDocument() { // Do nothing } @Override public void startDocument() { // Do nothing } }; filter.setContentHandler(getContentHandler()); reader.setContentHandler(filter); reader.parse(is); } @Override public String getVersion() { return ReleaseInfo.getVersion() + "b" + ReleaseInfo.getBuildNumber(); } }
gpl-3.0
Granville-Digital/Pirate-baie
node/app.js
6096
var express = require('express'); var app = express(); var server = require('http').createServer(app); var io = require('socket.io').listen(server); var ent = require('ent'); var shell = require('shelljs'); var SerialPort = require('serialport'); var port = new SerialPort('/dev/ttyUSB1'); var players = []; var start = 0; var vent; var maree; var bateaux = [ { id: 1, type: "Terre-Neuvier", pv: 100, cale: 4, atk: 40, steps: 4 }, { id: 2, type: "Bisquine", pv: 100, cale: 3, atk: 40, steps: 5 }, { id: 3, type: "Barque", pv: 85, cale: 4, atk: 40, steps: 4 }, { id: 4, type: "Goélette", pv: 100, cale: 3, atk: 60, steps: 4 } ]; var ports = [ { id: 1, nom: "Granville", coord_x: 10, coord_y: 4, bateaux: [ { id: 1, type_id: 1, pv: bateaux[0].pv, coord_x: 10, coord_y: 4, respawn: 0 }, { id: 2, type_id: 1, pv: bateaux[0].pv, coord_x: 10, coord_y: 4, respawn: 1 }, { id: 3, type_id: 2, pv: bateaux[1].pv, coord_x: 10, coord_y: 4, respawn: 2 }, ] }, { id: 2, nom: "Avranches", coord_x: 16, coord_x: 13, bateaux: [ { id: 1, type_id: 3, pv: bateaux[2].pv, coord_x: 16, coord_y: 13, respawn: 0 }, { id: 2, type_id: 3, pv: bateaux[2].pv, coord_x: 16, coord_y: 13, respawn: 1 }, { id: 3, type_id: 3, pv: bateaux[2].pv, coord_x: 16, coord_y: 13, respawn: 2 }, { id: 4, type_id: 3, pv: bateaux[2].pv, coord_x: 16, coord_y: 13, respawn: 3 } ] }, { id: 3, nom: "Champeaux", coord_x: 12, coord_y: 9, bateaux: [ { id: 1, type_id: 2, pv: bateaux[1].pv, coord_x: 12, coord_y: 9, respawn: 0 }, { id: 2, type_id: 4, pv: bateaux[3].pv, coord_x: 12, coord_y: 9, respawn: 1 }, { id: 3, type_id: 4, pv: bateaux[3].pv, coord_x: 12, coord_y: 9, respawn: 2 } ] }, { id: 4, nom: "Cancale", coord_x: 0, coord_x: 12, bateaux: [ { id: 1, type_id: 2, pv: bateaux[1].pv, coord_x: 0, coord_x: 12, respawn: 0 }, { id: 2, type_id: 2, pv: bateaux[1].pv, coord_x: 0, coord_x: 12, respawn: 1 }, { id: 3, type_id: 3, pv: bateaux[2].pv, coord_x: 0, coord_x: 12, respawn: 2 } ] }, { id: 5, nom: "Mont Saint-Michel", coord_x: 10, coord_y: 14, bateaux: [ { id: 1, type_id: 2, pv: bateaux[1].pv, coord_x: 10, coord_y: 14, respawn: 0 }, { id: 2, type_id: 4, pv: bateaux[3].pv, coord_x: 10, coord_y: 14, respawn: 1 }, { id: 3, type_id: 3, pv: bateaux[2].pv, coord_x: 10, coord_y: 14, respawn: 2 } ] } ]; app.use(express.static(__dirname+'/public')); app.get('/', function(req, res){ res.render('home.ejs', {players: players}); }) .use(function(req, res, next){ res.redirect('/'); }); io.sockets.on('connection', function(socket){ console.log('Nouveau participant'); socket.on('nouveau_joueur', function(username){ if (players.length == 5 || start == 1) { socket.emit('tooMuchPlayers'); } else { socket.username = ent.encode(username); socket.id = players.length; var newPlayer = { id: socket.id, nom: socket.username }; players.push(newPlayer); socket.emit('updatePlayers', players); socket.emit('id', socket.id); socket.broadcast.emit('updatePlayers', players); } }); socket.on('player_ready', function(id){ for (var i = 0, r = 0; i < players.length; i++) { if (players[i].id == id) { players[i].ready = true; } if (players[i].ready){ r++; } if (r == players.length) { socket.emit('start_game'); socket.broadcast.emit('start_game'); socket.emit('assign_ports', ports); socket.broadcast.emit('assign_ports', ports); start_pirates(); socket.emit('send_wind', vent); socket.broadcast.emit('send_wind', vent); start = 1; } } socket.broadcast.emit('updatePlayers', players); }); socket.on('move_bateau', function(id, bateau_id, x, y){ ports[id].bateaux[bateau_id].coord_x = x; ports[id].bateaux[bateau_id].coord_y = y; }); socket.on('mareeHaute', function(){ port.write('2', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); port.write('1', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); }); socket.on('mareeDesc', function(){ port.write('3', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); port.write('4', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); }); socket.on('mareeBasse', function(){ port.write('3', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); }); socket.on('mareeMont', function(){ port.write('4', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); }); }); var tours = 0; function start_pirates(){ for (var i = 0; i < players.length; i++) { players[i].ready = false; } if (tours === 0) { vent = "se"; maree = 0; } else if (tours === 1) { vent = "s"; maree = 1; } else { var ventRand = Matho.random()*96; if (ventRand <= 16){ vent = "n"; } else if (ventRand > 16 && ventRand <= 32) { vent = "s"; } else if (ventRand > 32 && ventRand <= 48) { vent = "nw"; } else if (ventRand > 48 && ventRand <= 64) { vent = "sw"; } else if (ventRand > 64 && ventRand <= 80) { vent = "ne"; } else { vent = "se"; } if (maree == 3) { maree--; } else { } } port.write('1', function(err){ if (err) { return console.log('Error : '+ err.message); } console.log('transmis'); }); tours++; } server.listen(8080);
gpl-3.0
bfaludi/liquid4m
liquid4m/form.py
5416
# -*- coding: utf-8 -*- """ Liquid is a form management tool for web frameworks. Copyright (C) 2014, Bence Faludi (b.faludi@mito.hu) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, <see http://www.gnu.org/licenses/>. """ from . import widgets # dict def flattenAbsData( value_dict ): """ Flat a multi-dimensional dictionary into one-dimensional dictionary. The keys will be concenated automatically. @param value_dict: Multi-dimensional dictionary @type value_dict: dict @return: One-dimensional dictionary @type: dict """ r_dict = {} for key, value in ( value_dict or {} ).items(): if not isinstance( value, dict ): r_dict[ key ] = value continue for ikey, ivalue in flattenAbsData( value ).items(): r_dict[ u'{}_{}'.format( key, ikey ) ] = ivalue return r_dict class Form( object ): """ Form class to render HTML forms by Liquid. """ # void def __init__( self, element, value = None, submit = u'Submit', \ buttons = None, cls = None ): """ Form class to render HTML forms by Liquid. It requires an Element object and it will clone this element to create the form's basic element (we won't use the schema element). @param element: schema element object @type: elements.Element @param value: Initial value @type value: dict @param submit: Submit button's label @type submit: unicode @param buttons: list of Button widgets @type buttons: list<widgets.Button> @param cls: HTML class @type cls: unicode """ # Clone the schema element self._element = element.clone() # Calculate abstract name for every child self._element.setAbsName() # Set the initial values self._element.setValue( value ) # Add Submit button self._buttons = [ widgets.Button( submit, name = 'submit', is_primary = True ) ] + ( buttons or [] ) # Define other variables self._widget = widgets.Form() self._cls = cls self.valid = None # elements.Element def __getattr__( self, attr ): """ Form is working like a FieldSet, so you can use .attr to returns an Element. @param attr: Attribute name @type attr: unicode @return: Field object @type: elements.Element """ return getattr( self.getElement(), attr ) # void def setErrorWidgets( self, widget ): """ Set the element's widget's error widget. Its responsible for how show the given error messages in the form. @param widget: Error widget object @type widget: widgets.Widget """ self.getElement().setErrorWidget( widget ) # list<widgets.Button> def getButtons( self ): """ Returns all buttons for the Form. @return: List of all button @rtype: list<widgets.Button> """ return self._buttons # elements.Element def getElement( self ): """ Returns basic element's clone. @return: Basic element @rtype: elements.Element """ return self._element # unicode def getClass( self ): """ Returns HTML class @return: HTML class @rtype: unicode """ return self._cls # tuple<bool,list> def isValid( self, return_list = False ): """ Checks the validity of the form's basic element. @param return_list: Returns list of error @type return_list: bool @return: Validity of the form @rtype: bool (or tuple<bool,list<tuple<unicode,unicode>>>) """ if return_list: return self.getElement().isValid() valid, _ = self.getElement().isValid() self.valid = valid return valid # unicode def render( self ): """ Render the form @return: HTML @rtype: unicode """ return self._widget.render( self ) # dict def getValue( self ): """ Returns of the basic element's values @return: Element's values @rtype: dict """ return self.getElement().getValue() # void def setValue( self, value ): """ Set the values of the element. @param value: New values of the element @type value: dict """ self.getElement().setValue( value ) # void def delValue( self ): """ Empty the element. """ self.getElement().delValue() # Value property value = property( getValue, setValue, delValue )
gpl-3.0
andry-dev/TSGE
tsge/Controls/HairListBox.Designer.cs
1871
// ----------------------------------------------------------------------- // This file is part of TSGE. // // TSGE is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // TSGE is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with TSGE. If not, see <http://www.gnu.org/licenses/>. // ----------------------------------------------------------------------- namespace tsge.Controls { partial class HairListBox { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); } #endregion } }
gpl-3.0
chriskmanx/qmole
QMOLEDEV/llvm-2.8/tools/clang-2.8/lib/AST/ExprClassification.cpp
19362
//===--- ExprClassification.cpp - Expression AST Node Implementation ------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file implements Expr::classify. // //===----------------------------------------------------------------------===// #include "llvm/Support/ErrorHandling.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" using namespace clang; typedef Expr::Classification Cl; static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E); static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D); static Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T); static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E); static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E); static Cl::Kinds ClassifyConditional(ASTContext &Ctx, const ConditionalOperator *E); static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, Cl::Kinds Kind, SourceLocation &Loc); Cl Expr::ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const { assert(!TR->isReferenceType() && "Expressions can't have reference type."); Cl::Kinds kind = ClassifyInternal(Ctx, this); // C99 6.3.2.1: An lvalue is an expression with an object type or an // incomplete type other than void. if (!Ctx.getLangOptions().CPlusPlus) { // Thus, no functions. if (TR->isFunctionType() || TR == Ctx.OverloadTy) kind = Cl::CL_Function; // No void either, but qualified void is OK because it is "other than void". else if (TR->isVoidType() && !Ctx.getCanonicalType(TR).hasQualifiers()) kind = Cl::CL_Void; } Cl::ModifiableType modifiable = Cl::CM_Untested; if (Loc) modifiable = IsModifiable(Ctx, this, kind, *Loc); return Classification(kind, modifiable); } static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // This function takes the first stab at classifying expressions. const LangOptions &Lang = Ctx.getLangOptions(); switch (E->getStmtClass()) { // First come the expressions that are always lvalues, unconditionally. case Expr::ObjCIsaExprClass: // C++ [expr.prim.general]p1: A string literal is an lvalue. case Expr::StringLiteralClass: // @encode is equivalent to its string case Expr::ObjCEncodeExprClass: // __func__ and friends are too. case Expr::PredefinedExprClass: // Property references are lvalues case Expr::ObjCPropertyRefExprClass: case Expr::ObjCImplicitSetterGetterRefExprClass: // C++ [expr.typeid]p1: The result of a typeid expression is an lvalue of... case Expr::CXXTypeidExprClass: // Unresolved lookups get classified as lvalues. // FIXME: Is this wise? Should they get their own kind? case Expr::UnresolvedLookupExprClass: case Expr::UnresolvedMemberExprClass: // ObjC instance variables are lvalues // FIXME: ObjC++0x might have different rules case Expr::ObjCIvarRefExprClass: // C99 6.5.2.5p5 says that compound literals are lvalues. // FIXME: C++ might have a different opinion. case Expr::CompoundLiteralExprClass: return Cl::CL_LValue; // Next come the complicated cases. // C++ [expr.sub]p1: The result is an lvalue of type "T". // However, subscripting vector types is more like member access. case Expr::ArraySubscriptExprClass: if (cast<ArraySubscriptExpr>(E)->getBase()->getType()->isVectorType()) return ClassifyInternal(Ctx, cast<ArraySubscriptExpr>(E)->getBase()); return Cl::CL_LValue; // C++ [expr.prim.general]p3: The result is an lvalue if the entity is a // function or variable and a prvalue otherwise. case Expr::DeclRefExprClass: return ClassifyDecl(Ctx, cast<DeclRefExpr>(E)->getDecl()); // We deal with names referenced from blocks the same way. case Expr::BlockDeclRefExprClass: return ClassifyDecl(Ctx, cast<BlockDeclRefExpr>(E)->getDecl()); // Member access is complex. case Expr::MemberExprClass: return ClassifyMemberExpr(Ctx, cast<MemberExpr>(E)); case Expr::UnaryOperatorClass: switch (cast<UnaryOperator>(E)->getOpcode()) { // C++ [expr.unary.op]p1: The unary * operator performs indirection: // [...] the result is an lvalue referring to the object or function // to which the expression points. case UO_Deref: return Cl::CL_LValue; // GNU extensions, simply look through them. case UO_Real: case UO_Imag: case UO_Extension: return ClassifyInternal(Ctx, cast<UnaryOperator>(E)->getSubExpr()); // C++ [expr.pre.incr]p1: The result is the updated operand; it is an // lvalue, [...] // Not so in C. case UO_PreInc: case UO_PreDec: return Lang.CPlusPlus ? Cl::CL_LValue : Cl::CL_PRValue; default: return Cl::CL_PRValue; } // Implicit casts are lvalues if they're lvalue casts. Other than that, we // only specifically record class temporaries. case Expr::ImplicitCastExprClass: switch (cast<ImplicitCastExpr>(E)->getValueKind()) { case VK_RValue: return Lang.CPlusPlus && E->getType()->isRecordType() ? Cl::CL_ClassTemporary : Cl::CL_PRValue; case VK_LValue: return Cl::CL_LValue; case VK_XValue: return Cl::CL_XValue; } llvm_unreachable("Invalid value category of implicit cast."); // C++ [expr.prim.general]p4: The presence of parentheses does not affect // whether the expression is an lvalue. case Expr::ParenExprClass: return ClassifyInternal(Ctx, cast<ParenExpr>(E)->getSubExpr()); case Expr::BinaryOperatorClass: case Expr::CompoundAssignOperatorClass: // C doesn't have any binary expressions that are lvalues. if (Lang.CPlusPlus) return ClassifyBinaryOp(Ctx, cast<BinaryOperator>(E)); return Cl::CL_PRValue; case Expr::CallExprClass: case Expr::CXXOperatorCallExprClass: case Expr::CXXMemberCallExprClass: return ClassifyUnnamed(Ctx, cast<CallExpr>(E)->getCallReturnType()); // __builtin_choose_expr is equivalent to the chosen expression. case Expr::ChooseExprClass: return ClassifyInternal(Ctx, cast<ChooseExpr>(E)->getChosenSubExpr(Ctx)); // Extended vector element access is an lvalue unless there are duplicates // in the shuffle expression. case Expr::ExtVectorElementExprClass: return cast<ExtVectorElementExpr>(E)->containsDuplicateElements() ? Cl::CL_DuplicateVectorComponents : Cl::CL_LValue; // Simply look at the actual default argument. case Expr::CXXDefaultArgExprClass: return ClassifyInternal(Ctx, cast<CXXDefaultArgExpr>(E)->getExpr()); // Same idea for temporary binding. case Expr::CXXBindTemporaryExprClass: return ClassifyInternal(Ctx, cast<CXXBindTemporaryExpr>(E)->getSubExpr()); // And the temporary lifetime guard. case Expr::CXXExprWithTemporariesClass: return ClassifyInternal(Ctx, cast<CXXExprWithTemporaries>(E)->getSubExpr()); // Casts depend completely on the target type. All casts work the same. case Expr::CStyleCastExprClass: case Expr::CXXFunctionalCastExprClass: case Expr::CXXStaticCastExprClass: case Expr::CXXDynamicCastExprClass: case Expr::CXXReinterpretCastExprClass: case Expr::CXXConstCastExprClass: // Only in C++ can casts be interesting at all. if (!Lang.CPlusPlus) return Cl::CL_PRValue; return ClassifyUnnamed(Ctx, cast<ExplicitCastExpr>(E)->getTypeAsWritten()); case Expr::ConditionalOperatorClass: // Once again, only C++ is interesting. if (!Lang.CPlusPlus) return Cl::CL_PRValue; return ClassifyConditional(Ctx, cast<ConditionalOperator>(E)); // ObjC message sends are effectively function calls, if the target function // is known. case Expr::ObjCMessageExprClass: if (const ObjCMethodDecl *Method = cast<ObjCMessageExpr>(E)->getMethodDecl()) { return ClassifyUnnamed(Ctx, Method->getResultType()); } // Some C++ expressions are always class temporaries. case Expr::CXXConstructExprClass: case Expr::CXXTemporaryObjectExprClass: case Expr::CXXScalarValueInitExprClass: return Cl::CL_ClassTemporary; // Everything we haven't handled is a prvalue. default: return Cl::CL_PRValue; } } /// ClassifyDecl - Return the classification of an expression referencing the /// given declaration. static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) { // C++ [expr.prim.general]p6: The result is an lvalue if the entity is a // function, variable, or data member and a prvalue otherwise. // In C, functions are not lvalues. // In addition, NonTypeTemplateParmDecl derives from VarDecl but isn't an // lvalue unless it's a reference type (C++ [temp.param]p6), so we need to // special-case this. if (isa<CXXMethodDecl>(D) && cast<CXXMethodDecl>(D)->isInstance()) return Cl::CL_MemberFunction; bool islvalue; if (const NonTypeTemplateParmDecl *NTTParm = dyn_cast<NonTypeTemplateParmDecl>(D)) islvalue = NTTParm->getType()->isReferenceType(); else islvalue = isa<VarDecl>(D) || isa<FieldDecl>(D) || (Ctx.getLangOptions().CPlusPlus && (isa<FunctionDecl>(D) || isa<FunctionTemplateDecl>(D))); return islvalue ? Cl::CL_LValue : Cl::CL_PRValue; } /// ClassifyUnnamed - Return the classification of an expression yielding an /// unnamed value of the given type. This applies in particular to function /// calls and casts. static Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T) { // In C, function calls are always rvalues. if (!Ctx.getLangOptions().CPlusPlus) return Cl::CL_PRValue; // C++ [expr.call]p10: A function call is an lvalue if the result type is an // lvalue reference type or an rvalue reference to function type, an xvalue // if the result type is an rvalue refernence to object type, and a prvalue // otherwise. if (T->isLValueReferenceType()) return Cl::CL_LValue; const RValueReferenceType *RV = T->getAs<RValueReferenceType>(); if (!RV) // Could still be a class temporary, though. return T->isRecordType() ? Cl::CL_ClassTemporary : Cl::CL_PRValue; return RV->getPointeeType()->isFunctionType() ? Cl::CL_LValue : Cl::CL_XValue; } static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) { // Handle C first, it's easier. if (!Ctx.getLangOptions().CPlusPlus) { // C99 6.5.2.3p3 // For dot access, the expression is an lvalue if the first part is. For // arrow access, it always is an lvalue. if (E->isArrow()) return Cl::CL_LValue; // ObjC property accesses are not lvalues, but get special treatment. Expr *Base = E->getBase(); if (isa<ObjCPropertyRefExpr>(Base) || isa<ObjCImplicitSetterGetterRefExpr>(Base)) return Cl::CL_SubObjCPropertySetting; return ClassifyInternal(Ctx, Base); } NamedDecl *Member = E->getMemberDecl(); // C++ [expr.ref]p3: E1->E2 is converted to the equivalent form (*(E1)).E2. // C++ [expr.ref]p4: If E2 is declared to have type "reference to T", then // E1.E2 is an lvalue. if (ValueDecl *Value = dyn_cast<ValueDecl>(Member)) if (Value->getType()->isReferenceType()) return Cl::CL_LValue; // Otherwise, one of the following rules applies. // -- If E2 is a static member [...] then E1.E2 is an lvalue. if (isa<VarDecl>(Member) && Member->getDeclContext()->isRecord()) return Cl::CL_LValue; // -- If E2 is a non-static data member [...]. If E1 is an lvalue, then // E1.E2 is an lvalue; if E1 is an xvalue, then E1.E2 is an xvalue; // otherwise, it is a prvalue. if (isa<FieldDecl>(Member)) { // *E1 is an lvalue if (E->isArrow()) return Cl::CL_LValue; return ClassifyInternal(Ctx, E->getBase()); } // -- If E2 is a [...] member function, [...] // -- If it refers to a static member function [...], then E1.E2 is an // lvalue; [...] // -- Otherwise [...] E1.E2 is a prvalue. if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Member)) return Method->isStatic() ? Cl::CL_LValue : Cl::CL_MemberFunction; // -- If E2 is a member enumerator [...], the expression E1.E2 is a prvalue. // So is everything else we haven't handled yet. return Cl::CL_PRValue; } static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E) { assert(Ctx.getLangOptions().CPlusPlus && "This is only relevant for C++."); // C++ [expr.ass]p1: All [...] return an lvalue referring to the left operand. if (E->isAssignmentOp()) return Cl::CL_LValue; // C++ [expr.comma]p1: the result is of the same value category as its right // operand, [...]. if (E->getOpcode() == BO_Comma) return ClassifyInternal(Ctx, E->getRHS()); // C++ [expr.mptr.oper]p6: The result of a .* expression whose second operand // is a pointer to a data member is of the same value category as its first // operand. if (E->getOpcode() == BO_PtrMemD) return E->getType()->isFunctionType() ? Cl::CL_MemberFunction : ClassifyInternal(Ctx, E->getLHS()); // C++ [expr.mptr.oper]p6: The result of an ->* expression is an lvalue if its // second operand is a pointer to data member and a prvalue otherwise. if (E->getOpcode() == BO_PtrMemI) return E->getType()->isFunctionType() ? Cl::CL_MemberFunction : Cl::CL_LValue; // All other binary operations are prvalues. return Cl::CL_PRValue; } static Cl::Kinds ClassifyConditional(ASTContext &Ctx, const ConditionalOperator *E) { assert(Ctx.getLangOptions().CPlusPlus && "This is only relevant for C++."); Expr *True = E->getTrueExpr(); Expr *False = E->getFalseExpr(); // C++ [expr.cond]p2 // If either the second or the third operand has type (cv) void, [...] // the result [...] is a prvalue. if (True->getType()->isVoidType() || False->getType()->isVoidType()) return Cl::CL_PRValue; // Note that at this point, we have already performed all conversions // according to [expr.cond]p3. // C++ [expr.cond]p4: If the second and third operands are glvalues of the // same value category [...], the result is of that [...] value category. // C++ [expr.cond]p5: Otherwise, the result is a prvalue. Cl::Kinds LCl = ClassifyInternal(Ctx, True), RCl = ClassifyInternal(Ctx, False); return LCl == RCl ? LCl : Cl::CL_PRValue; } static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, Cl::Kinds Kind, SourceLocation &Loc) { // As a general rule, we only care about lvalues. But there are some rvalues // for which we want to generate special results. if (Kind == Cl::CL_PRValue) { // For the sake of better diagnostics, we want to specifically recognize // use of the GCC cast-as-lvalue extension. if (const CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(E->IgnoreParens())){ if (CE->getSubExpr()->Classify(Ctx).isLValue()) { Loc = CE->getLParenLoc(); return Cl::CM_LValueCast; } } } if (Kind != Cl::CL_LValue) return Cl::CM_RValue; // This is the lvalue case. // Functions are lvalues in C++, but not modifiable. (C++ [basic.lval]p6) if (Ctx.getLangOptions().CPlusPlus && E->getType()->isFunctionType()) return Cl::CM_Function; // You cannot assign to a variable outside a block from within the block if // it is not marked __block, e.g. // void takeclosure(void (^C)(void)); // void func() { int x = 1; takeclosure(^{ x = 7; }); } if (const BlockDeclRefExpr *BDR = dyn_cast<BlockDeclRefExpr>(E)) { if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl())) return Cl::CM_NotBlockQualified; } // Assignment to a property in ObjC is an implicit setter access. But a // setter might not exist. if (const ObjCImplicitSetterGetterRefExpr *Expr = dyn_cast<ObjCImplicitSetterGetterRefExpr>(E)) { if (Expr->getSetterMethod() == 0) return Cl::CM_NoSetterProperty; } CanQualType CT = Ctx.getCanonicalType(E->getType()); // Const stuff is obviously not modifiable. if (CT.isConstQualified()) return Cl::CM_ConstQualified; // Arrays are not modifiable, only their elements are. if (CT->isArrayType()) return Cl::CM_ArrayType; // Incomplete types are not modifiable. if (CT->isIncompleteType()) return Cl::CM_IncompleteType; // Records with any const fields (recursively) are not modifiable. if (const RecordType *R = CT->getAs<RecordType>()) { assert(!Ctx.getLangOptions().CPlusPlus && "C++ struct assignment should be resolved by the " "copy assignment operator."); if (R->hasConstFields()) return Cl::CM_ConstQualified; } return Cl::CM_Modifiable; } Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const { Classification VC = Classify(Ctx); switch (VC.getKind()) { case Cl::CL_LValue: return LV_Valid; case Cl::CL_XValue: return LV_InvalidExpression; case Cl::CL_Function: return LV_NotObjectType; case Cl::CL_Void: return LV_IncompleteVoidType; case Cl::CL_DuplicateVectorComponents: return LV_DuplicateVectorComponents; case Cl::CL_MemberFunction: return LV_MemberFunction; case Cl::CL_SubObjCPropertySetting: return LV_SubObjCPropertySetting; case Cl::CL_ClassTemporary: return LV_ClassTemporary; case Cl::CL_PRValue: return LV_InvalidExpression; } llvm_unreachable("Unhandled kind"); } Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const { SourceLocation dummy; Classification VC = ClassifyModifiable(Ctx, Loc ? *Loc : dummy); switch (VC.getKind()) { case Cl::CL_LValue: break; case Cl::CL_XValue: return MLV_InvalidExpression; case Cl::CL_Function: return MLV_NotObjectType; case Cl::CL_Void: return MLV_IncompleteVoidType; case Cl::CL_DuplicateVectorComponents: return MLV_DuplicateVectorComponents; case Cl::CL_MemberFunction: return MLV_MemberFunction; case Cl::CL_SubObjCPropertySetting: return MLV_SubObjCPropertySetting; case Cl::CL_ClassTemporary: return MLV_ClassTemporary; case Cl::CL_PRValue: return VC.getModifiable() == Cl::CM_LValueCast ? MLV_LValueCast : MLV_InvalidExpression; } assert(VC.getKind() == Cl::CL_LValue && "Unhandled kind"); switch (VC.getModifiable()) { case Cl::CM_Untested: llvm_unreachable("Did not test modifiability"); case Cl::CM_Modifiable: return MLV_Valid; case Cl::CM_RValue: llvm_unreachable("CM_RValue and CL_LValue don't match"); case Cl::CM_Function: return MLV_NotObjectType; case Cl::CM_LValueCast: llvm_unreachable("CM_LValueCast and CL_LValue don't match"); case Cl::CM_NotBlockQualified: return MLV_NotBlockQualified; case Cl::CM_NoSetterProperty: return MLV_NoSetterProperty; case Cl::CM_ConstQualified: return MLV_ConstQualified; case Cl::CM_ArrayType: return MLV_ArrayType; case Cl::CM_IncompleteType: return MLV_IncompleteType; } llvm_unreachable("Unhandled modifiable type"); }
gpl-3.0
jdstrand/snapd
boot/export_test.go
1588
// -*- Mode: Go; indent-tabs-mode: t -*- /* * Copyright (C) 2014-2019 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package boot import ( "github.com/snapcore/snapd/snap" ) func NewCoreBootParticipant(s snap.PlaceInfo, t snap.Type, dev Device) *coreBootParticipant { bs, err := bootStateFor(t, dev) if err != nil { panic(err) } return &coreBootParticipant{s: s, bs: bs} } func NewCoreKernel(s snap.PlaceInfo, d Device) *coreKernel { return &coreKernel{s, bootloaderOptionsForDeviceKernel(d)} } type Trivial = trivial func (m *Modeenv) WasRead() bool { return m.read } func (m *Modeenv) DeepEqual(m2 *Modeenv) bool { return m.deepEqual(m2) } var ( MarshalModeenvEntryTo = marshalModeenvEntryTo UnmarshalModeenvValueFromCfg = unmarshalModeenvValueFromCfg NewTrustedAssetsCache = newTrustedAssetsCache ) type BootAssetsMap = bootAssetsMap type TrackedAsset = trackedAsset func (o *TrustedAssetsInstallObserver) CurrentTrustedBootAssetsMap() BootAssetsMap { return o.currentTrustedBootAssetsMap() }
gpl-3.0
andytuba/Reddit-Enhancement-Suite
tests/presets.js
698
module.exports = { 'clean slate preset': browser => { browser .url('https://en.reddit.com/r/RESIntegrationTests/?limit=1#res:settings/presets') .waitForElementVisible('#RESConsoleContainer') .assert.elementPresent('.res-toggle-filterline-visibility', 'filterline appears by default') .click('#cleanSlate button') .setAlertText('yes') .acceptAlert() // "do you want to apply preset" .dismissAlert() // "do you want to reload" .url('https://en.reddit.com/r/RESIntegrationTests/?limit=1') .waitForElementVisible('#RESSettingsButton') .pause(1000) .assert.elementNotPresent('.res-toggle-filterline-visibility', 'cleanslate disables filterline') .end(); }, };
gpl-3.0
xin-lai/Magicodes.ECharts
Magicodes.ECharts.Demo/Scripts/plugins/echart/theme/vintage.js
1098
(function(root, factory) { if (typeof define === "function" && define.amd) { // AMD. Register as an anonymous module. define(["exports", "echarts"], factory); } else if (typeof exports === "object" && typeof exports.nodeName !== "string") { // CommonJS factory(exports, require("echarts")); } else { // Browser globals factory({}, root.echarts); } }(this, function(exports, echarts) { var log = function(msg) { if (typeof console !== "undefined") { console && console.error && console.error(msg); } }; if (!echarts) { log("ECharts is not Loaded"); return; } var colorPalette = [ "#d87c7c", "#919e8b", "#d7ab82", "#6e7074", "#61a0a8", "#efa18d", "#787464", "#cc7e63", "#724e58", "#4b565b" ]; echarts.registerTheme("vintage", { color: colorPalette, backgroundColor: "#fef8ef", graph: { color: colorPalette } }); }));
gpl-3.0
jhasse/jntetri
src/engine/procedure.cpp
408
#include "procedure.hpp" #include "options.hpp" #include "screen.hpp" #include "../constants.hpp" #include <jngl/all.hpp> #include <stdexcept> Procedure::Procedure() : oldTime_(jngl::getTime()), needDraw_(true), fps_(0), fpsTemp_(0), changeWork_(false), running_(true), showFps_(false) { } Procedure& GetProcedure() { return *Procedure::handle(); } const double Procedure::timePerStep_ = 1.0 / 100.0;
gpl-3.0
rslhdyt/larapos
app/Models/Adjustment.php
1142
<?php namespace App\Models; use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; class Adjustment extends Model { use Searchable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'user_id', 'comments', ]; /** * The model rules. * * @var array */ public static $rules = [ 'user_id' => 'required', 'items' => 'min:1' ]; /** * Get the indexable data array for the model. * * @return array */ public function toSearchableArray() { return [ 'id' => $this->id, 'code' => $this->code, ]; } public function getCodeAttribute() { return 'ADJ-' . $this->id; } public function getTotalItemsAttribute() { return $this->items->count(); } public function items() { return $this->hasMany(AdjustmentItem::class); } public function user() { return $this->belongsTo(User::class)->withDefault([ 'name' => '-', ]); } }
gpl-3.0
srnsw/xena
plugins/pdf/ext/src/jpedal_lgpl-3.83b38/src/org/jpedal/gui/ShowGUIMessage.java
9593
/** * =========================================== * Java Pdf Extraction Decoding Access Library * =========================================== * * Project Info: http://www.jpedal.org * (C) Copyright 1997-2008, IDRsolutions and Contributors. * * This file is part of JPedal * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * --------------- * ShowGUIMessage.java * --------------- */ package org.jpedal.gui; //import of JFC import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.image.BufferedImage; import java.io.FileInputStream; import java.util.StringTokenizer; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextPane; import org.jpedal.utils.LogWriter; /** * provides a popup message if the library is being run in GUI mode <br> * <p> * <b>Note </b> these methods are not part of the API and is not guaranteed to * be in future versions of JPedal. * </p> * */ public class ShowGUIMessage { /**screen component to display*/ private static Container contentPane = null; /**flag to show if GUI mode and display popup messages*/ private static boolean outputMessages = false; public ShowGUIMessage() { } /////////////////////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final static public void showGUIMessage( String user_message, JTextPane messages, String title ) { //make sure user can't edit message messages.setEditable( false ); /** * create a display, including scroll pane */ JPanel display = new JPanel(); JScrollPane display_scroll_pane = new JScrollPane(); display_scroll_pane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); display_scroll_pane.getViewport().add( messages ); display.setLayout( new BorderLayout() ); display.add( display_scroll_pane, BorderLayout.CENTER ); //add a user-defined message if( user_message != null ) display.add( new JLabel( "<HTML><BODY><I>" + user_message + "</I></BODY></HTML>", 0 ), BorderLayout.SOUTH ); //set text display to scroll messages.setEditable( false ); display.setPreferredSize( new Dimension( 300, 200 ) ); /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, JOptionPane.DEFAULT_OPTION, /* optionType*/ JOptionPane.PLAIN_MESSAGE ); // messageType } ////////////////////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final static public void showGUIMessage( String user_message, JLabel messages, String title ) { /** * create a display, including scroll pane */ JPanel display = new JPanel(); display.setLayout( new BorderLayout() ); display.add( messages, BorderLayout.CENTER ); //add a user-defined message if( user_message != null ) display.add( new JLabel( user_message, 0 ), BorderLayout.SOUTH ); /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, JOptionPane.DEFAULT_OPTION, /* optionType*/ JOptionPane.PLAIN_MESSAGE ); // messageType contentPane.setVisible(true); } ////////////////////////////////////////////////////////////////////////// /** * initialise so popup window will appear in front of correct frame. */ final public static void setParentFrame( JFrame main_frame ) { contentPane = main_frame; } ////////////////////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final public static void showstaticGUIMessage( StringBuffer message, String title ) { /** * create a display */ JTextArea text_pane = new JTextArea(); text_pane.setEditable( false ); text_pane.setWrapStyleWord( true ); text_pane.append( " " + message + " " ); JPanel display = new JPanel(); display.setLayout( new BorderLayout() ); display.add( text_pane, BorderLayout.CENTER ); //set sizes int width = (int)text_pane.getSize().getWidth(); int height = (int)text_pane.getSize().getHeight(); display.setSize( new Dimension( width + 10, height + 10 ) ); /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, JOptionPane.DEFAULT_OPTION, /* optionType*/ JOptionPane.PLAIN_MESSAGE ); // messageType } ////////////////////////////////////////////////////////////////////////// /** * set client flag to display */ final public static void setClientDisplay() { outputMessages = true; } ////////////////////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final static public void showGUIMessage( String user_message, ImageIcon image, String title ) { /** * create a display */ JPanel display = new JPanel(); display.setLayout( new BorderLayout() ); JLabel message_component = new JLabel( image ); display.add( message_component, BorderLayout.CENTER ); if( user_message != null ) display.add( new JLabel( user_message ), BorderLayout.SOUTH ); //set sizes int width = (int)message_component.getSize().getWidth(); int height = (int)message_component.getSize().getHeight(); display.setSize( new Dimension( width + 10, height + 10 ) ); /** * set optiontype - default is Ok */ int type = JOptionPane.DEFAULT_OPTION; int display_type = JOptionPane.PLAIN_MESSAGE; /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, type, /* optionType*/ display_type ); // messageType } //////////////////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final static public void showGUIMessage( String user_message, BufferedImage image, String title ) { if(image==null) return; /** * create a display */ ImagePanel display = new ImagePanel( image ); display.setLayout( new BorderLayout() ); //display.setBackground(Color.cyan); if( user_message != null ) display.add( new JLabel( user_message ), BorderLayout.SOUTH ); //set sizes int width = image.getWidth(); int height = image.getHeight(); display.setSize( new Dimension( width + 10, height + 10 ) ); /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, JOptionPane.DEFAULT_OPTION, /* optionType*/ JOptionPane.PLAIN_MESSAGE ); // messageType } ///////////////////////////////////////////////////////////////////////// /** * display bufferedImage */ final public static void showGUIMessage( String file_name, String title,String dummy ) { FileInputStream in; BufferedImage image = null; try { in = new FileInputStream( file_name ); image=ImageIO.read(in); } catch( Exception e ) { LogWriter.writeLog( "Exception " + e + " getting image" ); } /** * create the dialog */ if( image != null ) { /** * create a display, including scroll pane */ JPanel display = new JPanel(); JScrollPane display_scroll_pane = new JScrollPane(); display_scroll_pane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); display.setLayout( new BorderLayout() ); display.add( display_scroll_pane, BorderLayout.CENTER ); //set text display to scroll display.setPreferredSize( new Dimension( 300, 200 ) ); /** * create the dialog */ JOptionPane.showConfirmDialog( contentPane, /* parentComponent*/ display, /* message*/ title, JOptionPane.DEFAULT_OPTION, /* optionType*/ JOptionPane.PLAIN_MESSAGE ); // messageType } } /////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final public static void showGUIMessage( String message_string, String title ) { //check for user mode just in case if( outputMessages == true ) { String output_string = "<HTML><BODY><CENTER><FONT COLOR=black>"; StringTokenizer lines = new StringTokenizer( message_string, "\n" ); while( lines.hasMoreTokens() ) output_string = output_string + lines.nextToken() + "</FONT></CENTER><CENTER><FONT COLOR=black>"; output_string = output_string + "</FONT></CENTER></BODY></HTML>"; JLabel text_message = new JLabel( output_string ); text_message.setBackground( Color.white ); showGUIMessage( null, text_message, title ); } } /////////////////////////////////////////////////////////// /** * display message if in GUI mode */ final public static void showGUIMessage( StringBuffer message, String title ) { showGUIMessage( message.toString(), title ); } }
gpl-3.0
zpxocivuby/freetong_mobile_server
itaf-aggregator/itaf-web-side/src/main/java/itaf/framework/web/tree/ResourceTreeNode.java
1747
package itaf.framework.web.tree; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.swing.tree.TreeNode; import com.google.common.collect.Iterators; /** * 资源树节点对象 * * @authorXINXIN * * @Update 2014年5月26日 */ public class ResourceTreeNode extends NamedNode implements TreeNode { private String nameZh; private String nameEn; private String description; private Long orderNo; private List<TreeNode> treeNodes = new ArrayList<TreeNode>(); @Override public TreeNode getChildAt(int childIndex) { return treeNodes.get(childIndex); } @Override public int getChildCount() { return treeNodes.size(); } @Override public TreeNode getParent() { return null; } @Override public int getIndex(TreeNode node) { return treeNodes.indexOf(node); } @Override public boolean getAllowsChildren() { return true; } @Override public boolean isLeaf() { return treeNodes.isEmpty(); } @Override public Enumeration<TreeNode> children() { return Iterators.asEnumeration(treeNodes.iterator()); } public List<TreeNode> getTreeNodes() { return treeNodes; } public void setTreeNodes(List<TreeNode> treeNodes) { this.treeNodes = treeNodes; } public String getNameZh() { return nameZh; } public void setNameZh(String nameZh) { this.nameZh = nameZh; } public String getNameEn() { return nameEn; } public void setNameEn(String nameEn) { this.nameEn = nameEn; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Long getOrderNo() { return orderNo; } public void setOrderNo(Long orderNo) { this.orderNo = orderNo; } }
gpl-3.0
Niky4000/UsefulUtils
projects/tutorials-master/tutorials-master/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/ApplicationWebXml.java
849
package com.baeldung.jhipster.gateway; import com.baeldung.jhipster.gateway.config.DefaultProfileUtil; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; /** * This is a helper Java class that provides an alternative to creating a web.xml. * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. */ public class ApplicationWebXml extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { /** * set a default to use when no profile is configured. */ DefaultProfileUtil.addDefaultProfile(application.application()); return application.sources(GatewayApp.class); } }
gpl-3.0
MesserLab/SLiM
core/mutation_run.cpp
25543
// // mutation_run.cpp // SLiM // // Created by Ben Haller on 11/29/16. // Copyright (c) 2016-2021 Philipp Messer. All rights reserved. // A product of the Messer Lab, http://messerlab.org/slim/ // // This file is part of SLiM. // // SLiM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or (at your option) any later version. // // SLiM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along with SLiM. If not, see <http://www.gnu.org/licenses/>. #include "mutation_run.h" #include <vector> // For doing bulk operations across all MutationRun objects; see header int64_t gSLiM_MutationRun_OperationID = 0; std::vector<MutationRun *> MutationRun::s_freed_mutation_runs_; #if DEBUG_MUTATION_RUNS int64_t gSLiM_ActiveMutrunCount = 0; int64_t gSLiM_FreeMutrunCount = 0; int64_t gSLiM_AllocatedMutrunCount = 0; int64_t gSLiM_UnfreedMutrunCount = 0; int64_t gSLiM_ConstructedMutrunCount = 0; int64_t gSLiM_MutationsBufferCount = 0; int64_t gSLiM_MutationsBufferBytes = 0; int64_t gSLiM_MutationsBufferNewCount = 0; int64_t gSLiM_MutationsBufferReallocCount = 0; int64_t gSLiM_MutationsBufferFreedCount = 0; #endif MutationRun::~MutationRun(void) { // mutations_buffer_ is not malloced and cannot be freed; free only if we have an external buffer if (mutations_ != mutations_buffer_) { free(mutations_); #if DEBUG_MUTATION_RUNS gSLiM_MutationsBufferFreedCount++; gSLiM_MutationsBufferCount--; gSLiM_MutationsBufferBytes -= (mutation_capacity_ * sizeof(MutationIndex)); #endif } #if SLIM_USE_NONNEUTRAL_CACHES if (nonneutral_mutations_) free(nonneutral_mutations_); #endif } #ifdef SLIM_MUTRUN_CHECK_LOCKING void MutationRun::LockingViolation(void) const { EIDOS_TERMINATION << "ERROR (MutationRun::LockingViolation): (internal error) a locked MutationRun was modified." << EidosTerminate(); } #endif #if 0 // linear search bool MutationRun::contains_mutation(MutationIndex p_mutation_index) { const MutationIndex *position = begin_pointer_const(); const MutationIndex *end_position = end_pointer_const(); for (; position != end_position; ++position) if (*position == p_mutation_index) return true; return false; } #else // binary search bool MutationRun::contains_mutation(MutationIndex p_mutation_index) { Mutation *mut_block_ptr = gSLiM_Mutation_Block; Mutation *mutation = gSLiM_Mutation_Block + p_mutation_index; slim_position_t position = mutation->position_; int mut_count = size(); const MutationIndex *mut_ptr = begin_pointer_const(); int mut_index; { // Find the requested position by binary search slim_position_t mut_pos; { int L = 0, R = mut_count - 1; do { if (L > R) return false; mut_index = (L + R) >> 1; // overflow-safe because base positions have a max of 1000000000L mut_pos = (mut_block_ptr + mut_ptr[mut_index])->position_; if (mut_pos < position) { L = mut_index + 1; continue; } if (mut_pos > position) { R = mut_index - 1; continue; } // mut_pos == p_position break; } while (true); } // The mutation at mut_index is at p_position, but it may not be the only such // We check it first, then we check before it scanning backwards, and check after it scanning forwards if (mut_ptr[mut_index] == p_mutation_index) return true; } // backward & forward scan are shared by both code paths { slim_position_t back_scan = mut_index; while (back_scan > 0) { const MutationIndex scan_mut_index = mut_ptr[--back_scan]; if ((mut_block_ptr + scan_mut_index)->position_ != position) break; if (scan_mut_index == p_mutation_index) return true; } } { slim_position_t forward_scan = mut_index; while (forward_scan < mut_count - 1) { const MutationIndex scan_mut_index = mut_ptr[++forward_scan]; if ((mut_block_ptr + scan_mut_index)->position_ != position) break; if (scan_mut_index == p_mutation_index) return true; } } return false; } #endif Mutation *MutationRun::mutation_with_type_and_position(MutationType *p_mut_type, slim_position_t p_position, slim_position_t p_last_position) { Mutation *mut_block_ptr = gSLiM_Mutation_Block; int mut_count = size(); const MutationIndex *mut_ptr = begin_pointer_const(); int mut_index; if (p_position == 0) { // The marker is supposed to be at position 0. This is a very common case, so we special-case it // to avoid an inefficient binary search. Instead, we just look at the beginning. if (mut_count == 0) return nullptr; if ((mut_block_ptr + mut_ptr[0])->position_ > 0) return nullptr; if ((mut_block_ptr + mut_ptr[0])->mutation_type_ptr_ == p_mut_type) return (mut_block_ptr + mut_ptr[0]); mut_index = 0; // drop through to forward scan } else if (p_position == p_last_position) { // The marker is supposed to be at the very end of the chromosome. This is also a common case, // so we special-case it by starting at the last mutation in the genome. if (mut_count == 0) return nullptr; mut_index = mut_count - 1; if ((mut_block_ptr + mut_ptr[mut_index])->position_ < p_last_position) return nullptr; if ((mut_block_ptr + mut_ptr[mut_index])->mutation_type_ptr_ == p_mut_type) return (mut_block_ptr + mut_ptr[mut_index]); // drop through to backward scan } else { // Find the requested position by binary search slim_position_t mut_pos; { int L = 0, R = mut_count - 1; do { if (L > R) return nullptr; mut_index = (L + R) >> 1; // overflow-safe because base positions have a max of 1000000000L mut_pos = (mut_block_ptr + mut_ptr[mut_index])->position_; if (mut_pos < p_position) { L = mut_index + 1; continue; } if (mut_pos > p_position) { R = mut_index - 1; continue; } // mut_pos == p_position break; } while (true); } // The mutation at mut_index is at p_position, but it may not be the only such // We check it first, then we check before it scanning backwards, and check after it scanning forwards if ((mut_block_ptr + mut_ptr[mut_index])->mutation_type_ptr_ == p_mut_type) return (mut_block_ptr + mut_ptr[mut_index]); } // backward & forward scan are shared by both code paths { slim_position_t back_scan = mut_index; while (back_scan > 0) { const MutationIndex scan_mut_index = mut_ptr[--back_scan]; if ((mut_block_ptr + scan_mut_index)->position_ != p_position) break; if ((mut_block_ptr + scan_mut_index)->mutation_type_ptr_ == p_mut_type) return (mut_block_ptr + scan_mut_index); } } { slim_position_t forward_scan = mut_index; while (forward_scan < mut_count - 1) { const MutationIndex scan_mut_index = mut_ptr[++forward_scan]; if ((mut_block_ptr + scan_mut_index)->position_ != p_position) break; if ((mut_block_ptr + scan_mut_index)->mutation_type_ptr_ == p_mut_type) return (mut_block_ptr + scan_mut_index); } } return nullptr; } const std::vector<Mutation *> *MutationRun::derived_mutation_ids_at_position(slim_position_t p_position) const { static std::vector<Mutation *> return_vec; // First clear out whatever might be left over from last time return_vec.clear(); // Then fill in all the mutation IDs at the given position. We search backward from the end since usually we are called // when a new mutation has just been added to the end; this will be slow for addNew[Drawn]Mutation() and removeMutations(), // but fast for the other cases, such as new SLiM-generated mutations, which are much more common. const MutationIndex *begin_ptr = begin_pointer_const(); const MutationIndex *end_ptr = end_pointer_const(); Mutation *mut_block_ptr = gSLiM_Mutation_Block; for (const MutationIndex *mut_ptr = end_ptr - 1; mut_ptr >= begin_ptr; --mut_ptr) { Mutation *mut = mut_block_ptr + *mut_ptr; slim_position_t mut_position = mut->position_; if (mut_position == p_position) return_vec.emplace_back(mut); else if (mut_position < p_position) break; } return &return_vec; } void MutationRun::_RemoveFixedMutations(void) { // Mutations that have fixed, and are thus targeted for removal, have had their state_ set to kFixedAndSubstituted. // That is done only when convertToSubstitution == T, so we don't need to check that flag here. // We don't use begin_pointer() / end_pointer() here, because we actually want to modify the MutationRun even // though it is shared by multiple Genomes; this is an exceptional case, so we go around our safeguards. MutationIndex *genome_iter = mutations_; MutationIndex *genome_backfill_iter = nullptr; MutationIndex *genome_max = mutations_ + mutation_count_; Mutation *mutation_block_ptr = gSLiM_Mutation_Block; // genome_iter advances through the mutation list; for each entry it hits, the entry is either fixed (skip it) or not fixed // (copy it backward to the backfill pointer). We do this with two successive loops; the first knows that no mutation has // yet been skipped, whereas the second knows that at least one mutation has been. while (genome_iter != genome_max) { if ((mutation_block_ptr + (*genome_iter++))->state_ != MutationState::kFixedAndSubstituted) continue; // Fixed mutation; we want to omit it, so we skip it in genome_backfill_iter and transition to the second loop genome_backfill_iter = genome_iter - 1; break; } #ifdef __clang_analyzer__ // the static analyzer doesn't understand the way the loop above drops through to the loop below // this assert is not always true, but it is true whenever (genome_iter != genome_max) at this point assert(genome_backfill_iter); #endif while (genome_iter != genome_max) { MutationIndex mutation_index = *genome_iter; if ((mutation_block_ptr + mutation_index)->state_ != MutationState::kFixedAndSubstituted) { // Unfixed mutation; we want to keep it, so we copy it backward and advance our backfill pointer as well as genome_iter *genome_backfill_iter = mutation_index; ++genome_backfill_iter; ++genome_iter; } else { // Fixed mutation; we want to omit it, so we just advance our pointer ++genome_iter; } } // excess mutations at the end have been copied back already; we just adjust mutation_count_ and forget about them if (genome_backfill_iter != nullptr) { mutation_count_ -= (genome_iter - genome_backfill_iter); #if SLIM_USE_NONNEUTRAL_CACHES // invalidate the nonneutral mutation cache nonneutral_mutations_count_ = -1; #endif } } bool MutationRun::_EnforceStackPolicyForAddition(slim_position_t p_position, MutationStackPolicy p_policy, int64_t p_stack_group) { MutationIndex *begin_ptr = begin_pointer(); MutationIndex *end_ptr = end_pointer(); Mutation *mut_block_ptr = gSLiM_Mutation_Block; if (p_policy == MutationStackPolicy::kKeepFirst) { // If the first mutation occurring at a site is kept, then we need to check for an existing mutation of this stacking group // We scan in reverse order, because usually we're adding mutations on the end with emplace_back() for (MutationIndex *mut_ptr = end_ptr - 1; mut_ptr >= begin_ptr; --mut_ptr) { Mutation *mut = mut_block_ptr + *mut_ptr; slim_position_t mut_position = mut->position_; if ((mut_position == p_position) && (mut->mutation_type_ptr_->stack_group_ == p_stack_group)) return false; else if (mut_position < p_position) return true; } return true; } else if (p_policy == MutationStackPolicy::kKeepLast) { // If the last mutation occurring at a site is kept, then we need to check for existing mutations of this type // We scan in reverse order, because usually we're adding mutations on the end with emplace_back() MutationIndex *first_match_ptr = nullptr; for (MutationIndex *mut_ptr = end_ptr - 1; mut_ptr >= begin_ptr; --mut_ptr) { Mutation *mut = mut_block_ptr + *mut_ptr; slim_position_t mut_position = mut->position_; if ((mut_position == p_position) && (mut->mutation_type_ptr_->stack_group_ == p_stack_group)) first_match_ptr = mut_ptr; // set repeatedly as we scan backwards, until we exit else if (mut_position < p_position) break; } // If we found any, we now scan forward and remove them, in anticipation of the new mutation being added if (first_match_ptr) { MutationIndex *replace_ptr = first_match_ptr; // replace at the first match position MutationIndex *mut_ptr = first_match_ptr + 1; // we know the initial position needs removal, so start at the next for ( ; mut_ptr < end_ptr; ++mut_ptr) { MutationIndex mut_index = *mut_ptr; Mutation *mut = mut_block_ptr + mut_index; slim_position_t mut_position = mut->position_; if ((mut_position == p_position) && (mut->mutation_type_ptr_->stack_group_ == p_stack_group)) { // The current scan position is a mutation that needs to be removed, so scan forward to skip copying it backward continue; } else { // The current scan position is a valid mutation, so we copy it backwards *(replace_ptr++) = mut_index; } } // excess mutations at the end have been copied back already; we just adjust mutation_count_ and forget about them set_size(size() - (int)(mut_ptr - replace_ptr)); } return true; } else EIDOS_TERMINATION << "ERROR (MutationRun::_EnforceStackPolicyForAddition): (internal error) invalid policy." << EidosTerminate(); } void MutationRun::split_run(MutationRun **p_first_half, MutationRun **p_second_half, slim_position_t p_split_first_position) { MutationRun *first_half = NewMutationRun(); MutationRun *second_half = NewMutationRun(); int32_t second_half_start; for (second_half_start = 0; second_half_start < mutation_count_; ++second_half_start) if ((gSLiM_Mutation_Block + mutations_[second_half_start])->position_ >= p_split_first_position) break; if (second_half_start > 0) first_half->emplace_back_bulk(mutations_, second_half_start); if (second_half_start < mutation_count_) second_half->emplace_back_bulk(mutations_ + second_half_start, mutation_count_ - second_half_start); *p_first_half = first_half; *p_second_half = second_half; } #if SLIM_USE_NONNEUTRAL_CACHES void MutationRun::cache_nonneutral_mutations_REGIME_1() { // // Regime 1 means there are no fitness callbacks at all, so neutrality can be assessed simply // by looking at selection_coeff_ != 0.0. The mutation type is irrelevant. // zero_out_nonneutral_buffer(); Mutation *mut_block_ptr = gSLiM_Mutation_Block; // loop through mutations and copy the non-neutral ones into our buffer, resizing as needed for (int32_t bufindex = 0; bufindex < mutation_count_; ++bufindex) { MutationIndex mutindex = mutations_[bufindex]; if ((mut_block_ptr + mutindex)->selection_coeff_ != 0.0) add_to_nonneutral_buffer(mutindex); } } void MutationRun::cache_nonneutral_mutations_REGIME_2() { // // Regime 2 means the only fitness callbacks are (a) constant-effect, (b) neutral (i.e. make // their mutation type become neutral), and (c) global (i.e. apply to all subpopulations). // Here neutrality is assessed by first consulting the set_neutral_by_global_active_callback // flag of MutationType, which is set up by RecalculateFitness() for us. If that is true, // the mutation is neutral; if false, selection_coeff_ is reliable. Note the code below uses // the exact way that the C operator && works to implement this order of checks. // zero_out_nonneutral_buffer(); Mutation *mut_block_ptr = gSLiM_Mutation_Block; // loop through mutations and copy the non-neutral ones into our buffer, resizing as needed for (int32_t bufindex = 0; bufindex < mutation_count_; ++bufindex) { MutationIndex mutindex = mutations_[bufindex]; Mutation *mutptr = mut_block_ptr + mutindex; // The result of && is not order-dependent, but the first condition is checked first. // I expect many mutations would fail the first test (thus short-circuiting), whereas // few would fail the second test (i.e. actually be 0.0) in a QTL model. if ((!mutptr->mutation_type_ptr_->set_neutral_by_global_active_callback_) && (mutptr->selection_coeff_ != 0.0)) add_to_nonneutral_buffer(mutindex); } } void MutationRun::cache_nonneutral_mutations_REGIME_3() { // // Regime 3 means that there are fitness callbacks that go beyond the constant neutral global // callbacks of regime 2, so if a mutation's mutation type is subject to any fitness callbacks // at all, whether active or not, that mutation must be considered to be non-neutral (because // a rogue callback could enable/disable other callbacks). This is determined by consulting // the subject_to_fitness_callback flag of MutationType, set up by RecalculateFitness() for // us. If that flag is not set, then the selection_coeff_ is reliable as usual. // zero_out_nonneutral_buffer(); Mutation *mut_block_ptr = gSLiM_Mutation_Block; // loop through mutations and copy the non-neutral ones into our buffer, resizing as needed for (int32_t bufindex = 0; bufindex < mutation_count_; ++bufindex) { MutationIndex mutindex = mutations_[bufindex]; Mutation *mutptr = mut_block_ptr + mutindex; // The result of || is not order-dependent, but the first condition is checked first. // I have reordered this to put the fast test first; or I'm guessing it's the fast test. if ((mutptr->selection_coeff_ != 0.0) || (mutptr->mutation_type_ptr_->subject_to_fitness_callback_)) add_to_nonneutral_buffer(mutindex); } } void MutationRun::check_nonneutral_mutation_cache() { if (!nonneutral_mutations_) EIDOS_TERMINATION << "ERROR (MutationRun::check_nonneutral_mutation_cache): (internal error) cache not allocated." << EidosTerminate(); if (nonneutral_mutations_count_ == -1) EIDOS_TERMINATION << "ERROR (MutationRun::check_nonneutral_mutation_cache): (internal error) unvalidated cache." << EidosTerminate(); if (nonneutral_mutations_count_ > nonneutral_mutation_capacity_) EIDOS_TERMINATION << "ERROR (MutationRun::check_nonneutral_mutation_cache): (internal error) cache size exceeds cache capacity." << EidosTerminate(); // Check for correctness in regime 1. Now that we have three regimes, this isn't really worth maintaining; // it really just replicates the above logic exactly, so it is not a very effective cross-check. /* int32_t cache_index = 0; for (int32_t bufindex = 0; bufindex < mutation_count_; ++bufindex) { MutationIndex mutindex = mutations_[bufindex]; Mutation *mutptr = gSLiM_Mutation_Block + mutindex; if (mutptr->selection_coeff_ != 0.0) if (*(nonneutral_mutations_ + cache_index++) != mutindex) EIDOS_TERMINATION << "ERROR (MutationRun::check_nonneutral_mutation_cache_REGIME_1): (internal error) unsynchronized cache." << EidosTerminate(); } */ } #endif // Shorthand for clear(), then copy_from_run(p_mutations_to_set), then insert_sorted_mutation() on every // mutation in p_mutations_to_add, with checks with enforce_stack_policy_for_addition(). The point of // this is speed: like DoClonalMutation(), we can merge the new mutations in much faster if we do it in // bulk. Note that p_mutations_to_set and p_mutations_to_add must both be sorted by position. void MutationRun::clear_set_and_merge(MutationRun &p_mutations_to_set, MutationRun &p_mutations_to_add) { SLIM_MUTRUN_LOCK_CHECK(); // first, clear all mutations out of the receiver clear(); // handle the cases with no mutations in one or the other given run, so we can assume >= 1 mutations below int mut_to_set_count = p_mutations_to_set.size(); int mut_to_add_count = p_mutations_to_add.size(); if (mut_to_add_count == 0) { copy_from_run(p_mutations_to_set); return; } if (mut_to_set_count == 0) { copy_from_run(p_mutations_to_add); return; } // assume that all mutations will be added, and adjust capacity accordingly if (mut_to_set_count + mut_to_add_count > mutation_capacity_) { // See emplace_back for comments on our capacity policy if (mutations_ == mutations_buffer_) { // We're allocating a malloced buffer for the first time, so we outgrew our internal buffer. We might try jumping by // more than a factor of two, to avoid repeated reallocs; in practice, that is not a win. The large majority of SLiM's // memory usage in typical simulations comes from these arrays of pointers kept by Genome, so making them larger // than necessary can massively balloon SLiM's memory usage for very little gain. The realloc() calls are very fast; // avoiding it is not a major concern. In fact, using *8 here instead of *2 actually slows down a test simulation, // perhaps because it causes a true realloc rather than just a size increment of the existing malloc block. Who knows. mutation_capacity_ = SLIM_MUTRUN_BUFFER_SIZE * 2; while (mut_to_set_count + mut_to_add_count > mutation_capacity_) { if (mutation_capacity_ < 32) mutation_capacity_ <<= 1; // double the number of pointers we can hold else mutation_capacity_ += 16; } mutations_ = (MutationIndex *)malloc(mutation_capacity_ * sizeof(MutationIndex)); if (!mutations_) EIDOS_TERMINATION << "ERROR (MutationRun::clear_set_and_merge): allocation failed; you may need to raise the memory limit for SLiM." << EidosTerminate(nullptr); memcpy(mutations_, mutations_buffer_, mutation_count_ * sizeof(MutationIndex)); #if DEBUG_MUTATION_RUNS gSLiM_MutationsBufferCount++; gSLiM_MutationsBufferNewCount++; gSLiM_MutationsBufferBytes += (mutation_capacity_ * sizeof(MutationIndex)); #endif } else { #if DEBUG_MUTATION_RUNS gSLiM_MutationsBufferBytes -= (mutation_capacity_ * sizeof(MutationIndex)); #endif do { if (mutation_capacity_ < 32) mutation_capacity_ <<= 1; // double the number of pointers we can hold else mutation_capacity_ += 16; } while (mut_to_set_count + mut_to_add_count > mutation_capacity_); mutations_ = (MutationIndex *)realloc(mutations_, mutation_capacity_ * sizeof(MutationIndex)); if (!mutations_) EIDOS_TERMINATION << "ERROR (MutationRun::clear_set_and_merge): allocation failed; you may need to raise the memory limit for SLiM." << EidosTerminate(nullptr); #if DEBUG_MUTATION_RUNS gSLiM_MutationsBufferReallocCount++; gSLiM_MutationsBufferBytes += (mutation_capacity_ * sizeof(MutationIndex)); #endif } } // then interleave mutations together, effectively setting p_mutations_to_set and then adding in p_mutations_to_add Mutation *mut_block_ptr = gSLiM_Mutation_Block; const MutationIndex *mutation_iter = p_mutations_to_add.begin_pointer_const(); const MutationIndex *mutation_iter_max = p_mutations_to_add.end_pointer_const(); MutationIndex mutation_iter_mutation_index = *mutation_iter; slim_position_t mutation_iter_pos = (mut_block_ptr + mutation_iter_mutation_index)->position_; const MutationIndex *parent_iter = p_mutations_to_set.begin_pointer_const(); const MutationIndex *parent_iter_max = p_mutations_to_set.end_pointer_const(); MutationIndex parent_iter_mutation_index = *parent_iter; slim_position_t parent_iter_pos = (mut_block_ptr + parent_iter_mutation_index)->position_; // this loop runs while we are still interleaving mutations from both sources do { if (parent_iter_pos <= mutation_iter_pos) { // we have a parent mutation that comes first, so copy it emplace_back(*parent_iter); parent_iter++; if (parent_iter == parent_iter_max) break; parent_iter_mutation_index = *parent_iter; parent_iter_pos = (mut_block_ptr + parent_iter_mutation_index)->position_; } else { // we have a new mutation to add, which we know is not already present; check the stacking policy if (enforce_stack_policy_for_addition(mutation_iter_pos, (mut_block_ptr + mutation_iter_mutation_index)->mutation_type_ptr_)) emplace_back(mutation_iter_mutation_index); mutation_iter++; if (mutation_iter == mutation_iter_max) break; mutation_iter_mutation_index = *mutation_iter; mutation_iter_pos = (mut_block_ptr + mutation_iter_mutation_index)->position_; } } while (true); // one source is exhausted, but there are still mutations left in the other source while (parent_iter != parent_iter_max) { emplace_back(*parent_iter); parent_iter++; } while (mutation_iter != mutation_iter_max) { mutation_iter_mutation_index = *mutation_iter; mutation_iter_pos = (mut_block_ptr + mutation_iter_mutation_index)->position_; if (enforce_stack_policy_for_addition(mutation_iter_pos, (mut_block_ptr + mutation_iter_mutation_index)->mutation_type_ptr_)) emplace_back(mutation_iter_mutation_index); mutation_iter++; } } size_t MutationRun::MemoryUsageForMutationIndexBuffers(void) { if (mutations_ == mutations_buffer_) return 0; else return mutation_capacity_ * sizeof(MutationIndex); } size_t MutationRun::MemoryUsageForNonneutralCaches(void) { return nonneutral_mutation_capacity_ * sizeof(MutationIndex); }
gpl-3.0
Zazzmatazz/AirMapDotNet
src/AirMapDotNet/Entities/GeoJSON/GeoObjects/GeometryObjectType.cs
976
namespace AirMapDotNet.Entities.GeoJSON.GeoObjects { /// <summary> /// The type of feature. /// </summary> public enum GeometryObjectType { /// <summary> /// A <see cref="GeoObjects.Point"/>. /// </summary> Point, /// <summary> /// A <see cref="GeoObjects.MultiPoint"/>. /// </summary> MultiPoint, /// <summary> /// A <see cref="GeoObjects.LineString"/>. /// </summary> LineString, /// <summary> /// A <see cref="GeoObjects.MultiLineString"/>. /// </summary> MultiLineString, /// <summary> /// A <see cref="GeoObjects.Polygon"/>. /// </summary> Polygon, /// <summary> /// A <see cref="GeoObjects.MultiPolygon"/>. /// </summary> MultiPolygon, /// <summary> /// A <see cref="GeometryCollection"/>. /// </summary> Collection } }
gpl-3.0
basarat/socket.io.users
src/lib/Session.ts
698
/// <reference path="../typings/express/express.d.ts" /> /// <reference path="../typings/express-session/express-session.d.ts" /> import {Application} from "express"; import {SessionOptions} from "express-session"; var Session = (app: Application, options?:SessionOptions) => { let cookieParser = require('cookie-parser'); if (options === undefined) { options = { secret: "socket.io.users secret", resave: true, saveUninitialized: true }; } let session = require("express-session")(options, cookieParser); app.use(cookieParser()); app.use(session); // express-session middleware for express } export default Session;
gpl-3.0
adriann0/npm-aprs-parser
tests/TelemetryDescriptionParserTests.js
3343
'use strict'; const chai = require('chai'); const expect = chai.expect; const TelemetryDescriptionParser = require('../lib/Telemetry/TelemetryDescriptionParser'); const TelemetryNames = require('../lib/MessageModels/TelemetryNames.js'); const TelemetryLabels = require('../lib/MessageModels/TelemetryLabels.js'); const TelemetryEquations = require('../lib/MessageModels/TelemetryEquations.js'); const TelemetryBitSense = require('../lib/MessageModels/TelemetryBitSense.js'); describe('Telemetry description', () => { it('Names (not all fields described)', () => { const content = ':N0QBF-11 :PARM.Battery,Btemp,ATemp,Pres,Alt,Camra'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); const parsed = parser.tryParse(content); expect(parsed).to.be.an.instanceOf(TelemetryNames); expect(parsed.call).to.eql('N0QBF-11'); expect(parsed.desc).to.eql(['Battery', 'Btemp', 'ATemp', 'Pres', 'Alt', 'Camra']); }); it('Names (too many fields)', () => { const content = ':N0QBF-11 :PARM.Battery,Btemp,ATemp,Pres,Alt,Camra,Chut,Sun,10m,ATV,Test,Test,Test,Test'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); expect(() => { parser.tryParse(content); }).to.throw(Error); }); it('Unit/Labels', () => { const content = ':N0QBF-11 :UNIT.v/100,deg.F,deg.F,Mbar,Kft,Click,OPEN,on,on,hi'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); const parsed = parser.tryParse(content); expect(parsed).to.be.an.instanceOf(TelemetryLabels); expect(parsed.call).to.eql('N0QBF-11'); expect(parsed.labels).to.eql(['v/100', 'deg.F', 'deg.F', 'Mbar', 'Kft', 'Click', 'OPEN', 'on', 'on', 'hi']); }); it('Coeff', () => { const content = ':N0QBF-11 :EQNS.0,5.2,0,0,.53,-32,3,4.39,49,-32,3,18,1,2,3'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); const parsed = parser.tryParse(content); expect(parsed).to.be.an.instanceOf(TelemetryEquations); expect(parsed.call).to.eql('N0QBF-11'); expect(parsed.coeff).to.eql([[0, 5.2, 0], [0, 0.53, -32], [3, 4.39, 49], [-32, 3, 18], [1, 2, 3]]); }); it('Coeff (not valid number of coefficients)', () => { const content = ':N0QBF-11 :EQNS.0,5.2,0,0,.53,-32,3,4.39,49,-32,3,18,1,2,3,5'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); expect(() => { parser.tryParse(content); }).to.throw(Error); }); it('Bit sense', () => { const content = ':N0QBF-11 :BITS.10110000,N0QBF’s Big Balloon'; const parser = new TelemetryDescriptionParser(); expect(parser.isMatching(content)).to.equal(true); const parsed = parser.tryParse(content); expect(parsed).to.be.an.instanceOf(TelemetryBitSense); expect(parsed.call).to.eql('N0QBF-11'); expect(parsed.sense).to.eql([true, false, true, true, false, false, false, false]); expect(parsed.projectName).to.eql('N0QBF’s Big Balloon'); }); });
gpl-3.0
angek/ProjectSpoon
source/components/com_pktasks/admin/views/tasks/view.html.php
9500
<?php /** * @package pkg_projectspoon * * @author Kon Angelopoulos (angek) * @copyright Copyright (C) 2017 Kon Angelopoulos. All rights reserved. * @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt * attribution based on the original work of Projectknife (Tobias Kuhn) */ defined('_JEXEC') or die; class PKtasksViewTasks extends JViewLegacy { /** * List of currently active filters * * @var array */ public $activeFilters; /** * Items loaded by the model * * @var array */ protected $items; /** * Pagination instance * * @var jpagination */ protected $pagination; /** * Model state * * @var jregistry */ protected $state; /** * Author filter options * * @var array */ protected $author_options; /** * Project filter options * * @var array */ protected $project_options; /** * Milestone filter options * * @var array */ protected $milestone_options; /** * Access level filter options * * @var array */ protected $access_options; /** * Assignee filter options * * @var array */ protected $assignee_options; /** * Priority filter options * * @var array */ protected $priority_options; /** * Progress filter options * * @var array */ protected $progress_options; /** * Tag filter options * * @var array */ protected $tag_options; /** * List sorting options * * @var array */ protected $sort_options; /** * Sidebar HTML output * * @var string */ protected $sidebar = ''; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->activeFilters = $this->get('ActiveFilters'); $this->author_options = $this->get('AuthorOptions'); $this->project_options = $this->get('ProjectOptions'); $this->access_options = $this->get('AccessOptions'); $this->assignee_options = $this->get('AssigneeOptions'); $this->priority_options = $this->get('PriorityOptions'); $this->progress_options = $this->get('ProgressOptions'); $this->tag_options = $this->get('TagOptions'); $this->sort_options = $this->get('SortOptions'); // Check for errors $errors = $this->get('Errors'); if (count($errors)) { JError::raiseError(500, implode("\n", $errors)); return false; } $model = $this->getModel(); if (is_numeric($this->state->get('filter.project_id'))) { $filter = array('project_id' => $this->state->get('filter.project_id')); $this->milestone_options = $model->getMilestoneOptions($filter); } else { // If no project is selected, milestone options will be empty because there may be // too many options. $this->milestone_options = array(); } if ($this->getLayout() !== 'modal') { PKtasksHelper::addSubmenu('tasks'); $this->addToolbar(); $this->addSidebar(); $this->sidebar = JHtmlSidebar::render(); } parent::display($tpl); } /** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { $user = JFactory::getUser(); $project_id = (int) $this->state->get('filter.project_id'); JHtml::_('bootstrap.modal', 'collapseModal'); JToolbarHelper::title(JText::_('COM_PKTASKS_TASKS_TITLE')); if (PKUserHelper::authProject('task.create', $project_id)) { JToolbarHelper::addNew('task.add'); JToolbarHelper::custom('tasks.copy_dialog', 'copy', 'copy', JText::_('JLIB_HTML_BATCH_COPY')); } if (!$this->state->get('restrict.published')) { JToolbarHelper::publish('tasks.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('tasks.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::archiveList('tasks.archive'); if ($this->state->get('filter.published') == -2) { JToolbarHelper::deleteList('', 'tasks.delete', 'JTOOLBAR_EMPTY_TRASH'); } else { JToolbarHelper::trash('tasks.trash'); } } JToolbarHelper::checkin('tasks.checkin'); if ($user->authorise('core.admin', 'com_pktasks') || $user->authorise('core.options', 'com_pktasks')) { JToolbarHelper::preferences('com_pktasks'); } } /** * Adds sidebar filters. * * @return void */ protected function addSidebar() { // Load Projectspoon plugins $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('projectspoon'); JHtmlSidebar::setAction('index.php?option=com_pktasks&view=tasks'); // Trigger BeforeDisplayFilter event. Params: Context, location, model $dispatcher->trigger('onProjectspoonBeforeDisplayFilter', array('com_pktasks.tasks', 'admin', &$this)); // Project filter JHtmlSidebar::addFilter( JText::_('COM_PKPROJECTS_OPTION_SELECT_PROJECT'), 'filter_project_id', JHtml::_('select.options', $this->project_options, 'value', 'text', $this->state->get('filter.project_id')) ); // Milestone filter $no_ms = new stdClass(); $no_ms->value = '0'; $no_ms->text = '* ' . JText::_('COM_PKMILESTONES_OPTION_NO_MILESTONE') . ' *'; JHtmlSidebar::addFilter( '- ' . JText::_('COM_PKMILESTONES_OPTION_SELECT_MILESTONE') . ' -', 'filter_milestone_id', JHtml::_('select.options', array_merge(array($no_ms), $this->milestone_options), 'value', 'text', $this->state->get('filter.milestone_id')) ); JHtmlSidebar::addFilter( '- ' . JText::_('PKGLOBAL_SELECT_TAG') . ' -', 'filter_tag_id', JHtml::_('select.options', $this->tag_options, 'value', 'text', $this->state->get('filter.tag_id')) ); // Publishing state filter if (!$this->state->get('restrict.published')) { JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) ); } // Assignee filter $unassigned = new stdClass(); $unassigned->value = 'unassigned'; $unassigned->text = '* ' . JText::_('COM_PKTASKS_UNASSIGNED') . ' *'; $me = new stdClass(); $me->value = 'me'; $me->text = '* ' . JText::_('COM_PKTASKS_ASSIGNED_TO_ME') . ' *'; $notme = new stdClass(); $notme->value = 'notme'; $notme->text = '* ' . JText::_('COM_PKTASKS_NOT_ASSIGNED_TO_ME') . ' *'; JHtmlSidebar::addFilter( '- ' . JText::_('COM_PKTASKS_SELECT_ASSIGNEE') . ' -', 'filter_assignee_id', JHtml::_('select.options', array_merge(array($me, $notme, $unassigned), $this->assignee_options), 'value', 'text', $this->state->get('filter.assignee_id')) ); // Priority filter JHtmlSidebar::addFilter( '- ' . JText::_('COM_PKTASKS_SELECT_PRIORITY') . ' -', 'filter_priority', JHtml::_('select.options', $this->priority_options, 'value', 'text', $this->state->get('filter.priority')) ); // Progress filter JHtmlSidebar::addFilter( '- ' . JText::_('PKGLOBAL_SELECT_PROGRESS') . ' -', 'filter_progress', JHtml::_('select.options', $this->progress_options, 'value', 'text', $this->state->get('filter.progress')) ); // Author filter $me = new stdClass(); $me->value = 'me'; $me->text = '* ' . JText::_('PKGLOBAL_CREATED_BY_ME') . ' *'; $notme = new stdClass(); $notme->value = 'notme'; $notme->text = '* ' . JText::_('PKGLOBAL_NOT_CREATED_BY_ME') . ' *'; JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_AUTHOR'), 'filter_author_id', JHtml::_('select.options', array_merge(array($me, $notme), $this->author_options), 'value', 'text', $this->state->get('filter.author_id')) ); // Access level filter JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', $this->access_options, 'value', 'text', $this->state->get('filter.access')) ); // Trigger AfterDisplayFilter event. Params: Context, location, model $dispatcher->trigger('onProjectspoonAfterDisplayFilter', array('com_pktasks.tasks', 'admin', &$this)); } }
gpl-3.0
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/UseCounter.cpp
40587
/* * Copyright (C) 2012 Google, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "core/frame/UseCounter.h" #include "core/css/CSSStyleSheet.h" #include "core/css/StyleSheetContents.h" #include "core/dom/Document.h" #include "core/dom/ExecutionContext.h" #include "core/frame/Deprecation.h" #include "core/frame/FrameConsole.h" #include "core/frame/FrameHost.h" #include "core/frame/LocalFrame.h" #include "core/inspector/ConsoleMessage.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/Histogram.h" #include "platform/tracing/TraceEvent.h" namespace { int totalPagesMeasuredCSSSampleId() { return 1; } // Make sure update_use_counter_css.py was run which updates histograms.xml. constexpr int kMaximumCSSSampleId = 546; } // namespace namespace blink { int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram( CSSPropertyID cssPropertyID) { switch (cssPropertyID) { // Begin at 2, because 1 is reserved for totalPagesMeasuredCSSSampleId. case CSSPropertyColor: return 2; case CSSPropertyDirection: return 3; case CSSPropertyDisplay: return 4; case CSSPropertyFont: return 5; case CSSPropertyFontFamily: return 6; case CSSPropertyFontSize: return 7; case CSSPropertyFontStyle: return 8; case CSSPropertyFontVariant: return 9; case CSSPropertyFontWeight: return 10; case CSSPropertyTextRendering: return 11; case CSSPropertyAliasWebkitFontFeatureSettings: return 12; case CSSPropertyFontKerning: return 13; case CSSPropertyWebkitFontSmoothing: return 14; case CSSPropertyFontVariantLigatures: return 15; case CSSPropertyWebkitLocale: return 16; case CSSPropertyWebkitTextOrientation: return 17; case CSSPropertyWebkitWritingMode: return 18; case CSSPropertyZoom: return 19; case CSSPropertyLineHeight: return 20; case CSSPropertyBackground: return 21; case CSSPropertyBackgroundAttachment: return 22; case CSSPropertyBackgroundClip: return 23; case CSSPropertyBackgroundColor: return 24; case CSSPropertyBackgroundImage: return 25; case CSSPropertyBackgroundOrigin: return 26; case CSSPropertyBackgroundPosition: return 27; case CSSPropertyBackgroundPositionX: return 28; case CSSPropertyBackgroundPositionY: return 29; case CSSPropertyBackgroundRepeat: return 30; case CSSPropertyBackgroundRepeatX: return 31; case CSSPropertyBackgroundRepeatY: return 32; case CSSPropertyBackgroundSize: return 33; case CSSPropertyBorder: return 34; case CSSPropertyBorderBottom: return 35; case CSSPropertyBorderBottomColor: return 36; case CSSPropertyBorderBottomLeftRadius: return 37; case CSSPropertyBorderBottomRightRadius: return 38; case CSSPropertyBorderBottomStyle: return 39; case CSSPropertyBorderBottomWidth: return 40; case CSSPropertyBorderCollapse: return 41; case CSSPropertyBorderColor: return 42; case CSSPropertyBorderImage: return 43; case CSSPropertyBorderImageOutset: return 44; case CSSPropertyBorderImageRepeat: return 45; case CSSPropertyBorderImageSlice: return 46; case CSSPropertyBorderImageSource: return 47; case CSSPropertyBorderImageWidth: return 48; case CSSPropertyBorderLeft: return 49; case CSSPropertyBorderLeftColor: return 50; case CSSPropertyBorderLeftStyle: return 51; case CSSPropertyBorderLeftWidth: return 52; case CSSPropertyBorderRadius: return 53; case CSSPropertyBorderRight: return 54; case CSSPropertyBorderRightColor: return 55; case CSSPropertyBorderRightStyle: return 56; case CSSPropertyBorderRightWidth: return 57; case CSSPropertyBorderSpacing: return 58; case CSSPropertyBorderStyle: return 59; case CSSPropertyBorderTop: return 60; case CSSPropertyBorderTopColor: return 61; case CSSPropertyBorderTopLeftRadius: return 62; case CSSPropertyBorderTopRightRadius: return 63; case CSSPropertyBorderTopStyle: return 64; case CSSPropertyBorderTopWidth: return 65; case CSSPropertyBorderWidth: return 66; case CSSPropertyBottom: return 67; case CSSPropertyBoxShadow: return 68; case CSSPropertyBoxSizing: return 69; case CSSPropertyCaptionSide: return 70; case CSSPropertyClear: return 71; case CSSPropertyClip: return 72; case CSSPropertyAliasWebkitClipPath: return 73; case CSSPropertyContent: return 74; case CSSPropertyCounterIncrement: return 75; case CSSPropertyCounterReset: return 76; case CSSPropertyCursor: return 77; case CSSPropertyEmptyCells: return 78; case CSSPropertyFloat: return 79; case CSSPropertyFontStretch: return 80; case CSSPropertyHeight: return 81; case CSSPropertyImageRendering: return 82; case CSSPropertyLeft: return 83; case CSSPropertyLetterSpacing: return 84; case CSSPropertyListStyle: return 85; case CSSPropertyListStyleImage: return 86; case CSSPropertyListStylePosition: return 87; case CSSPropertyListStyleType: return 88; case CSSPropertyMargin: return 89; case CSSPropertyMarginBottom: return 90; case CSSPropertyMarginLeft: return 91; case CSSPropertyMarginRight: return 92; case CSSPropertyMarginTop: return 93; case CSSPropertyMaxHeight: return 94; case CSSPropertyMaxWidth: return 95; case CSSPropertyMinHeight: return 96; case CSSPropertyMinWidth: return 97; case CSSPropertyOpacity: return 98; case CSSPropertyOrphans: return 99; case CSSPropertyOutline: return 100; case CSSPropertyOutlineColor: return 101; case CSSPropertyOutlineOffset: return 102; case CSSPropertyOutlineStyle: return 103; case CSSPropertyOutlineWidth: return 104; case CSSPropertyOverflow: return 105; case CSSPropertyOverflowWrap: return 106; case CSSPropertyOverflowX: return 107; case CSSPropertyOverflowY: return 108; case CSSPropertyPadding: return 109; case CSSPropertyPaddingBottom: return 110; case CSSPropertyPaddingLeft: return 111; case CSSPropertyPaddingRight: return 112; case CSSPropertyPaddingTop: return 113; case CSSPropertyPage: return 114; case CSSPropertyPageBreakAfter: return 115; case CSSPropertyPageBreakBefore: return 116; case CSSPropertyPageBreakInside: return 117; case CSSPropertyPointerEvents: return 118; case CSSPropertyPosition: return 119; case CSSPropertyQuotes: return 120; case CSSPropertyResize: return 121; case CSSPropertyRight: return 122; case CSSPropertySize: return 123; case CSSPropertySrc: return 124; case CSSPropertySpeak: return 125; case CSSPropertyTableLayout: return 126; case CSSPropertyTabSize: return 127; case CSSPropertyTextAlign: return 128; case CSSPropertyTextDecoration: return 129; case CSSPropertyTextIndent: return 130; /* Removed CSSPropertyTextLineThrough* - 131-135 */ case CSSPropertyTextOverflow: return 136; /* Removed CSSPropertyTextOverline* - 137-141 */ case CSSPropertyTextShadow: return 142; case CSSPropertyTextTransform: return 143; /* Removed CSSPropertyTextUnderline* - 144-148 */ case CSSPropertyTop: return 149; case CSSPropertyTransition: return 150; case CSSPropertyTransitionDelay: return 151; case CSSPropertyTransitionDuration: return 152; case CSSPropertyTransitionProperty: return 153; case CSSPropertyTransitionTimingFunction: return 154; case CSSPropertyUnicodeBidi: return 155; case CSSPropertyUnicodeRange: return 156; case CSSPropertyVerticalAlign: return 157; case CSSPropertyVisibility: return 158; case CSSPropertyWhiteSpace: return 159; case CSSPropertyWidows: return 160; case CSSPropertyWidth: return 161; case CSSPropertyWordBreak: return 162; case CSSPropertyWordSpacing: return 163; case CSSPropertyWordWrap: return 164; case CSSPropertyZIndex: return 165; case CSSPropertyAliasWebkitAnimation: return 166; case CSSPropertyAliasWebkitAnimationDelay: return 167; case CSSPropertyAliasWebkitAnimationDirection: return 168; case CSSPropertyAliasWebkitAnimationDuration: return 169; case CSSPropertyAliasWebkitAnimationFillMode: return 170; case CSSPropertyAliasWebkitAnimationIterationCount: return 171; case CSSPropertyAliasWebkitAnimationName: return 172; case CSSPropertyAliasWebkitAnimationPlayState: return 173; case CSSPropertyAliasWebkitAnimationTimingFunction: return 174; case CSSPropertyWebkitAppearance: return 175; // CSSPropertyWebkitAspectRatio was 176 case CSSPropertyAliasWebkitBackfaceVisibility: return 177; case CSSPropertyWebkitBackgroundClip: return 178; // case CSSPropertyWebkitBackgroundComposite: return 179; case CSSPropertyWebkitBackgroundOrigin: return 180; case CSSPropertyAliasWebkitBackgroundSize: return 181; case CSSPropertyWebkitBorderAfter: return 182; case CSSPropertyWebkitBorderAfterColor: return 183; case CSSPropertyWebkitBorderAfterStyle: return 184; case CSSPropertyWebkitBorderAfterWidth: return 185; case CSSPropertyWebkitBorderBefore: return 186; case CSSPropertyWebkitBorderBeforeColor: return 187; case CSSPropertyWebkitBorderBeforeStyle: return 188; case CSSPropertyWebkitBorderBeforeWidth: return 189; case CSSPropertyWebkitBorderEnd: return 190; case CSSPropertyWebkitBorderEndColor: return 191; case CSSPropertyWebkitBorderEndStyle: return 192; case CSSPropertyWebkitBorderEndWidth: return 193; // CSSPropertyWebkitBorderFit was 194 case CSSPropertyWebkitBorderHorizontalSpacing: return 195; case CSSPropertyWebkitBorderImage: return 196; case CSSPropertyAliasWebkitBorderRadius: return 197; case CSSPropertyWebkitBorderStart: return 198; case CSSPropertyWebkitBorderStartColor: return 199; case CSSPropertyWebkitBorderStartStyle: return 200; case CSSPropertyWebkitBorderStartWidth: return 201; case CSSPropertyWebkitBorderVerticalSpacing: return 202; case CSSPropertyWebkitBoxAlign: return 203; case CSSPropertyWebkitBoxDirection: return 204; case CSSPropertyWebkitBoxFlex: return 205; case CSSPropertyWebkitBoxFlexGroup: return 206; case CSSPropertyWebkitBoxLines: return 207; case CSSPropertyWebkitBoxOrdinalGroup: return 208; case CSSPropertyWebkitBoxOrient: return 209; case CSSPropertyWebkitBoxPack: return 210; case CSSPropertyWebkitBoxReflect: return 211; case CSSPropertyAliasWebkitBoxShadow: return 212; // CSSPropertyWebkitColumnAxis was 214 case CSSPropertyWebkitColumnBreakAfter: return 215; case CSSPropertyWebkitColumnBreakBefore: return 216; case CSSPropertyWebkitColumnBreakInside: return 217; case CSSPropertyAliasWebkitColumnCount: return 218; case CSSPropertyAliasWebkitColumnGap: return 219; // CSSPropertyWebkitColumnProgression was 220 case CSSPropertyAliasWebkitColumnRule: return 221; case CSSPropertyAliasWebkitColumnRuleColor: return 222; case CSSPropertyAliasWebkitColumnRuleStyle: return 223; case CSSPropertyAliasWebkitColumnRuleWidth: return 224; case CSSPropertyAliasWebkitColumnSpan: return 225; case CSSPropertyAliasWebkitColumnWidth: return 226; case CSSPropertyAliasWebkitColumns: return 227; // 228 was CSSPropertyWebkitBoxDecorationBreak (duplicated due to #ifdef). // 229 was CSSPropertyWebkitFilter (duplicated due to #ifdef). case CSSPropertyAlignContent: return 230; case CSSPropertyAlignItems: return 231; case CSSPropertyAlignSelf: return 232; case CSSPropertyFlex: return 233; case CSSPropertyFlexBasis: return 234; case CSSPropertyFlexDirection: return 235; case CSSPropertyFlexFlow: return 236; case CSSPropertyFlexGrow: return 237; case CSSPropertyFlexShrink: return 238; case CSSPropertyFlexWrap: return 239; case CSSPropertyJustifyContent: return 240; case CSSPropertyWebkitFontSizeDelta: return 241; case CSSPropertyGridTemplateColumns: return 242; case CSSPropertyGridTemplateRows: return 243; case CSSPropertyGridColumnStart: return 244; case CSSPropertyGridColumnEnd: return 245; case CSSPropertyGridRowStart: return 246; case CSSPropertyGridRowEnd: return 247; case CSSPropertyGridColumn: return 248; case CSSPropertyGridRow: return 249; case CSSPropertyGridAutoFlow: return 250; case CSSPropertyWebkitHighlight: return 251; case CSSPropertyWebkitHyphenateCharacter: return 252; // case CSSPropertyWebkitLineBoxContain: return 257; // case CSSPropertyWebkitLineAlign: return 258; case CSSPropertyWebkitLineBreak: return 259; case CSSPropertyWebkitLineClamp: return 260; // case CSSPropertyWebkitLineGrid: return 261; // case CSSPropertyWebkitLineSnap: return 262; case CSSPropertyWebkitLogicalWidth: return 263; case CSSPropertyWebkitLogicalHeight: return 264; case CSSPropertyWebkitMarginAfterCollapse: return 265; case CSSPropertyWebkitMarginBeforeCollapse: return 266; case CSSPropertyWebkitMarginBottomCollapse: return 267; case CSSPropertyWebkitMarginTopCollapse: return 268; case CSSPropertyWebkitMarginCollapse: return 269; case CSSPropertyWebkitMarginAfter: return 270; case CSSPropertyWebkitMarginBefore: return 271; case CSSPropertyWebkitMarginEnd: return 272; case CSSPropertyWebkitMarginStart: return 273; // CSSPropertyWebkitMarquee was 274. // CSSPropertyInternalMarquee* were 275-279. case CSSPropertyWebkitMask: return 280; case CSSPropertyWebkitMaskBoxImage: return 281; case CSSPropertyWebkitMaskBoxImageOutset: return 282; case CSSPropertyWebkitMaskBoxImageRepeat: return 283; case CSSPropertyWebkitMaskBoxImageSlice: return 284; case CSSPropertyWebkitMaskBoxImageSource: return 285; case CSSPropertyWebkitMaskBoxImageWidth: return 286; case CSSPropertyWebkitMaskClip: return 287; case CSSPropertyWebkitMaskComposite: return 288; case CSSPropertyWebkitMaskImage: return 289; case CSSPropertyWebkitMaskOrigin: return 290; case CSSPropertyWebkitMaskPosition: return 291; case CSSPropertyWebkitMaskPositionX: return 292; case CSSPropertyWebkitMaskPositionY: return 293; case CSSPropertyWebkitMaskRepeat: return 294; case CSSPropertyWebkitMaskRepeatX: return 295; case CSSPropertyWebkitMaskRepeatY: return 296; case CSSPropertyWebkitMaskSize: return 297; case CSSPropertyWebkitMaxLogicalWidth: return 298; case CSSPropertyWebkitMaxLogicalHeight: return 299; case CSSPropertyWebkitMinLogicalWidth: return 300; case CSSPropertyWebkitMinLogicalHeight: return 301; // WebkitNbspMode has been deleted, was return 302; case CSSPropertyOrder: return 303; case CSSPropertyWebkitPaddingAfter: return 304; case CSSPropertyWebkitPaddingBefore: return 305; case CSSPropertyWebkitPaddingEnd: return 306; case CSSPropertyWebkitPaddingStart: return 307; case CSSPropertyAliasWebkitPerspective: return 308; case CSSPropertyAliasWebkitPerspectiveOrigin: return 309; case CSSPropertyWebkitPerspectiveOriginX: return 310; case CSSPropertyWebkitPerspectiveOriginY: return 311; case CSSPropertyWebkitPrintColorAdjust: return 312; case CSSPropertyWebkitRtlOrdering: return 313; case CSSPropertyWebkitRubyPosition: return 314; case CSSPropertyWebkitTextCombine: return 315; case CSSPropertyWebkitTextDecorationsInEffect: return 316; case CSSPropertyWebkitTextEmphasis: return 317; case CSSPropertyWebkitTextEmphasisColor: return 318; case CSSPropertyWebkitTextEmphasisPosition: return 319; case CSSPropertyWebkitTextEmphasisStyle: return 320; case CSSPropertyWebkitTextFillColor: return 321; case CSSPropertyWebkitTextSecurity: return 322; case CSSPropertyWebkitTextStroke: return 323; case CSSPropertyWebkitTextStrokeColor: return 324; case CSSPropertyWebkitTextStrokeWidth: return 325; case CSSPropertyAliasWebkitTransform: return 326; case CSSPropertyAliasWebkitTransformOrigin: return 327; case CSSPropertyWebkitTransformOriginX: return 328; case CSSPropertyWebkitTransformOriginY: return 329; case CSSPropertyWebkitTransformOriginZ: return 330; case CSSPropertyAliasWebkitTransformStyle: return 331; case CSSPropertyAliasWebkitTransition: return 332; case CSSPropertyAliasWebkitTransitionDelay: return 333; case CSSPropertyAliasWebkitTransitionDuration: return 334; case CSSPropertyAliasWebkitTransitionProperty: return 335; case CSSPropertyAliasWebkitTransitionTimingFunction: return 336; case CSSPropertyWebkitUserDrag: return 337; case CSSPropertyWebkitUserModify: return 338; case CSSPropertyAliasWebkitUserSelect: return 339; // case CSSPropertyWebkitFlowInto: return 340; // case CSSPropertyWebkitFlowFrom: return 341; // case CSSPropertyWebkitRegionFragment: return 342; // case CSSPropertyWebkitRegionBreakAfter: return 343; // case CSSPropertyWebkitRegionBreakBefore: return 344; // case CSSPropertyWebkitRegionBreakInside: return 345; // case CSSPropertyShapeInside: return 346; case CSSPropertyShapeOutside: return 347; case CSSPropertyShapeMargin: return 348; // case CSSPropertyShapePadding: return 349; // case CSSPropertyWebkitWrapFlow: return 350; // case CSSPropertyWebkitWrapThrough: return 351; // CSSPropertyWebkitWrap was 352. // 353 was CSSPropertyWebkitTapHighlightColor (duplicated due to #ifdef). // 354 was CSSPropertyWebkitAppRegion (duplicated due to #ifdef). case CSSPropertyClipPath: return 355; case CSSPropertyClipRule: return 356; case CSSPropertyMask: return 357; // CSSPropertyEnableBackground has been removed, was return 358; case CSSPropertyFilter: return 359; case CSSPropertyFloodColor: return 360; case CSSPropertyFloodOpacity: return 361; case CSSPropertyLightingColor: return 362; case CSSPropertyStopColor: return 363; case CSSPropertyStopOpacity: return 364; case CSSPropertyColorInterpolation: return 365; case CSSPropertyColorInterpolationFilters: return 366; // case CSSPropertyColorProfile: return 367; case CSSPropertyColorRendering: return 368; case CSSPropertyFill: return 369; case CSSPropertyFillOpacity: return 370; case CSSPropertyFillRule: return 371; case CSSPropertyMarker: return 372; case CSSPropertyMarkerEnd: return 373; case CSSPropertyMarkerMid: return 374; case CSSPropertyMarkerStart: return 375; case CSSPropertyMaskType: return 376; case CSSPropertyShapeRendering: return 377; case CSSPropertyStroke: return 378; case CSSPropertyStrokeDasharray: return 379; case CSSPropertyStrokeDashoffset: return 380; case CSSPropertyStrokeLinecap: return 381; case CSSPropertyStrokeLinejoin: return 382; case CSSPropertyStrokeMiterlimit: return 383; case CSSPropertyStrokeOpacity: return 384; case CSSPropertyStrokeWidth: return 385; case CSSPropertyAlignmentBaseline: return 386; case CSSPropertyBaselineShift: return 387; case CSSPropertyDominantBaseline: return 388; // CSSPropertyGlyphOrientationHorizontal has been removed, was return 389; // CSSPropertyGlyphOrientationVertical has been removed, was return 390; // CSSPropertyKerning has been removed, was return 391; case CSSPropertyTextAnchor: return 392; case CSSPropertyVectorEffect: return 393; case CSSPropertyWritingMode: return 394; // CSSPropertyWebkitSvgShadow has been removed, was return 395; // CSSPropertyWebkitCursorVisibility has been removed, was return 396; // CSSPropertyImageOrientation has been removed, was return 397; // CSSPropertyImageResolution has been removed, was return 398; #if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING case CSSPropertyWebkitBlendMode: return 399; case CSSPropertyWebkitBackgroundBlendMode: return 400; #endif case CSSPropertyTextDecorationLine: return 401; case CSSPropertyTextDecorationStyle: return 402; case CSSPropertyTextDecorationColor: return 403; case CSSPropertyTextAlignLast: return 404; case CSSPropertyTextUnderlinePosition: return 405; case CSSPropertyMaxZoom: return 406; case CSSPropertyMinZoom: return 407; case CSSPropertyOrientation: return 408; case CSSPropertyUserZoom: return 409; // CSSPropertyWebkitDashboardRegion was 410. // CSSPropertyWebkitOverflowScrolling was 411. case CSSPropertyWebkitAppRegion: return 412; case CSSPropertyAliasWebkitFilter: return 413; case CSSPropertyWebkitBoxDecorationBreak: return 414; case CSSPropertyWebkitTapHighlightColor: return 415; case CSSPropertyBufferedRendering: return 416; case CSSPropertyGridAutoRows: return 417; case CSSPropertyGridAutoColumns: return 418; case CSSPropertyBackgroundBlendMode: return 419; case CSSPropertyMixBlendMode: return 420; case CSSPropertyTouchAction: return 421; case CSSPropertyGridArea: return 422; case CSSPropertyGridTemplateAreas: return 423; case CSSPropertyAnimation: return 424; case CSSPropertyAnimationDelay: return 425; case CSSPropertyAnimationDirection: return 426; case CSSPropertyAnimationDuration: return 427; case CSSPropertyAnimationFillMode: return 428; case CSSPropertyAnimationIterationCount: return 429; case CSSPropertyAnimationName: return 430; case CSSPropertyAnimationPlayState: return 431; case CSSPropertyAnimationTimingFunction: return 432; case CSSPropertyObjectFit: return 433; case CSSPropertyPaintOrder: return 434; case CSSPropertyMaskSourceType: return 435; case CSSPropertyIsolation: return 436; case CSSPropertyObjectPosition: return 437; // case CSSPropertyInternalCallback: return 438; case CSSPropertyShapeImageThreshold: return 439; case CSSPropertyColumnFill: return 440; case CSSPropertyTextJustify: return 441; // CSSPropertyTouchActionDelay was 442 case CSSPropertyJustifySelf: return 443; case CSSPropertyScrollBehavior: return 444; case CSSPropertyWillChange: return 445; case CSSPropertyTransform: return 446; case CSSPropertyTransformOrigin: return 447; case CSSPropertyTransformStyle: return 448; case CSSPropertyPerspective: return 449; case CSSPropertyPerspectiveOrigin: return 450; case CSSPropertyBackfaceVisibility: return 451; case CSSPropertyGridTemplate: return 452; case CSSPropertyGrid: return 453; case CSSPropertyAll: return 454; case CSSPropertyJustifyItems: return 455; case CSSPropertyAliasMotionPath: return 457; case CSSPropertyAliasMotionOffset: return 458; case CSSPropertyAliasMotionRotation: return 459; case CSSPropertyMotion: return 460; case CSSPropertyX: return 461; case CSSPropertyY: return 462; case CSSPropertyRx: return 463; case CSSPropertyRy: return 464; case CSSPropertyFontSizeAdjust: return 465; case CSSPropertyCx: return 466; case CSSPropertyCy: return 467; case CSSPropertyR: return 468; case CSSPropertyAliasEpubCaptionSide: return 469; case CSSPropertyAliasEpubTextCombine: return 470; case CSSPropertyAliasEpubTextEmphasis: return 471; case CSSPropertyAliasEpubTextEmphasisColor: return 472; case CSSPropertyAliasEpubTextEmphasisStyle: return 473; case CSSPropertyAliasEpubTextOrientation: return 474; case CSSPropertyAliasEpubTextTransform: return 475; case CSSPropertyAliasEpubWordBreak: return 476; case CSSPropertyAliasEpubWritingMode: return 477; case CSSPropertyAliasWebkitAlignContent: return 478; case CSSPropertyAliasWebkitAlignItems: return 479; case CSSPropertyAliasWebkitAlignSelf: return 480; case CSSPropertyAliasWebkitBorderBottomLeftRadius: return 481; case CSSPropertyAliasWebkitBorderBottomRightRadius: return 482; case CSSPropertyAliasWebkitBorderTopLeftRadius: return 483; case CSSPropertyAliasWebkitBorderTopRightRadius: return 484; case CSSPropertyAliasWebkitBoxSizing: return 485; case CSSPropertyAliasWebkitFlex: return 486; case CSSPropertyAliasWebkitFlexBasis: return 487; case CSSPropertyAliasWebkitFlexDirection: return 488; case CSSPropertyAliasWebkitFlexFlow: return 489; case CSSPropertyAliasWebkitFlexGrow: return 490; case CSSPropertyAliasWebkitFlexShrink: return 491; case CSSPropertyAliasWebkitFlexWrap: return 492; case CSSPropertyAliasWebkitJustifyContent: return 493; case CSSPropertyAliasWebkitOpacity: return 494; case CSSPropertyAliasWebkitOrder: return 495; case CSSPropertyAliasWebkitShapeImageThreshold: return 496; case CSSPropertyAliasWebkitShapeMargin: return 497; case CSSPropertyAliasWebkitShapeOutside: return 498; case CSSPropertyScrollSnapType: return 499; case CSSPropertyScrollSnapPointsX: return 500; case CSSPropertyScrollSnapPointsY: return 501; case CSSPropertyScrollSnapCoordinate: return 502; case CSSPropertyScrollSnapDestination: return 503; case CSSPropertyTranslate: return 504; case CSSPropertyRotate: return 505; case CSSPropertyScale: return 506; case CSSPropertyImageOrientation: return 507; case CSSPropertyBackdropFilter: return 508; case CSSPropertyTextCombineUpright: return 509; case CSSPropertyTextOrientation: return 510; case CSSPropertyGridColumnGap: return 511; case CSSPropertyGridRowGap: return 512; case CSSPropertyGridGap: return 513; case CSSPropertyFontFeatureSettings: return 514; case CSSPropertyVariable: return 515; case CSSPropertyFontDisplay: return 516; case CSSPropertyContain: return 517; case CSSPropertyD: return 518; case CSSPropertySnapHeight: return 519; case CSSPropertyBreakAfter: return 520; case CSSPropertyBreakBefore: return 521; case CSSPropertyBreakInside: return 522; case CSSPropertyColumnCount: return 523; case CSSPropertyColumnGap: return 524; case CSSPropertyColumnRule: return 525; case CSSPropertyColumnRuleColor: return 526; case CSSPropertyColumnRuleStyle: return 527; case CSSPropertyColumnRuleWidth: return 528; case CSSPropertyColumnSpan: return 529; case CSSPropertyColumnWidth: return 530; case CSSPropertyColumns: return 531; case CSSPropertyApplyAtRule: return 532; case CSSPropertyFontVariantCaps: return 533; case CSSPropertyHyphens: return 534; case CSSPropertyFontVariantNumeric: return 535; case CSSPropertyTextSizeAdjust: return 536; case CSSPropertyAliasWebkitTextSizeAdjust: return 537; case CSSPropertyOverflowAnchor: return 538; case CSSPropertyUserSelect: return 539; case CSSPropertyOffsetDistance: return 540; case CSSPropertyOffsetPath: return 541; case CSSPropertyOffsetRotate: case CSSPropertyOffsetRotation: // TODO(ericwilligers): Distinct use counter for CSSPropertyOffsetRotate. return 542; case CSSPropertyOffset: return 543; case CSSPropertyOffsetAnchor: return 544; case CSSPropertyOffsetPosition: return 545; case CSSPropertyTextDecorationSkip: return 546; // 1. Add new features above this line (don't change the assigned numbers of // the existing items). // 2. Update kMaximumCSSSampleId with the new maximum value. // 3. Run the update_use_counter_css.py script in // chromium/src/tools/metrics/histograms to update the UMA histogram names. case CSSPropertyInvalid: ASSERT_NOT_REACHED(); return 0; } ASSERT_NOT_REACHED(); return 0; } UseCounter::UseCounter(Context context) : m_muteCount(0), m_context(context), m_featuresRecorded(NumberOfFeatures), m_CSSRecorded(lastUnresolvedCSSProperty + 1) {} void UseCounter::muteForInspector() { m_muteCount++; } void UseCounter::unmuteForInspector() { m_muteCount--; } void UseCounter::recordMeasurement(Feature feature) { if (m_muteCount) return; DCHECK(feature != OBSOLETE_PageDestruction && feature != PageVisits); // PageDestruction is reserved as a scaling factor. DCHECK(feature < NumberOfFeatures); if (!m_featuresRecorded.quickGet(feature)) { // Note that HTTPArchive tooling looks specifically for this event - see // https://github.com/HTTPArchive/httparchive/issues/59 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage"), "FeatureFirstUsed", "feature", feature); featuresHistogram().count(feature); m_featuresRecorded.quickSet(feature); } m_legacyCounter.countFeature(feature); } bool UseCounter::hasRecordedMeasurement(Feature feature) const { if (m_muteCount) return false; DCHECK(feature != OBSOLETE_PageDestruction && feature != PageVisits); // PageDestruction is reserved as a scaling factor. DCHECK(feature < NumberOfFeatures); return m_featuresRecorded.quickGet(feature); } void UseCounter::didCommitLoad() { m_legacyCounter.updateMeasurements(); // TODO: Is didCommitLoad really the right time to do this? crbug.com/608040 m_featuresRecorded.clearAll(); featuresHistogram().count(PageVisits); m_CSSRecorded.clearAll(); cssHistogram().count(totalPagesMeasuredCSSSampleId()); } void UseCounter::count(const Frame* frame, Feature feature) { if (!frame) return; FrameHost* host = frame->host(); if (!host) return; host->useCounter().count(feature); } void UseCounter::count(const Document& document, Feature feature) { count(document.frame(), feature); } bool UseCounter::isCounted(Document& document, Feature feature) { Frame* frame = document.frame(); if (!frame) return false; FrameHost* host = frame->host(); if (!host) return false; return host->useCounter().hasRecordedMeasurement(feature); } bool UseCounter::isCounted(CSSPropertyID unresolvedProperty) { return m_CSSRecorded.quickGet(unresolvedProperty); } bool UseCounter::isCounted(Document& document, const String& string) { Frame* frame = document.frame(); if (!frame) return false; FrameHost* host = frame->host(); if (!host) return false; CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(string); if (unresolvedProperty == CSSPropertyInvalid) return false; return host->useCounter().isCounted(unresolvedProperty); } void UseCounter::count(const ExecutionContext* context, Feature feature) { if (!context) return; if (context->isDocument()) { count(*toDocument(context), feature); return; } if (context->isWorkerGlobalScope()) toWorkerGlobalScope(context)->countFeature(feature); } void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const Frame* frame, Feature feature) { if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) return; UseCounter::count(frame, feature); } void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const Document& document, Feature feature) { if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) return; UseCounter::count(document, feature); } void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionContext* context, Feature feature) { if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) return; UseCounter::count(context, feature); } void UseCounter::countCrossOriginIframe(const Document& document, Feature feature) { LocalFrame* frame = document.frame(); if (frame && frame->isCrossOriginSubframe()) count(frame, feature); } void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID property) { DCHECK(isCSSPropertyIDWithName(property)); if (!isUseCounterEnabledForMode(cssParserMode) || m_muteCount) return; if (!m_CSSRecorded.quickGet(property)) { // Note that HTTPArchive tooling looks specifically for this event - see // https://github.com/HTTPArchive/httparchive/issues/59 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage"), "CSSFeatureFirstUsed", "feature", property); cssHistogram().count(mapCSSPropertyIdToCSSSampleIdForHistogram(property)); m_CSSRecorded.quickSet(property); } m_legacyCounter.countCSS(property); } void UseCounter::count(Feature feature) { DCHECK(Deprecation::deprecationMessage(feature).isEmpty()); recordMeasurement(feature); } UseCounter* UseCounter::getFrom(const Document* document) { if (document && document->frameHost()) return &document->frameHost()->useCounter(); return 0; } UseCounter* UseCounter::getFrom(const CSSStyleSheet* sheet) { if (sheet) return getFrom(sheet->contents()); return 0; } UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) { // FIXME: We may want to handle stylesheets that have multiple owners // https://crbug.com/242125 if (sheetContents && sheetContents->hasSingleOwnerNode()) return getFrom(sheetContents->singleOwnerDocument()); return 0; } EnumerationHistogram& UseCounter::featuresHistogram() const { // TODO(rbyers): Fix the SVG case. crbug.com/236262 // Eg. every SVGImage has it's own Page instance, they should probably all be // delegating their UseCounter to the containing Page. For now just use a // separate histogram. DEFINE_STATIC_LOCAL(blink::EnumerationHistogram, histogram, ("WebCore.UseCounter_TEST.Features", blink::UseCounter::NumberOfFeatures)); DEFINE_STATIC_LOCAL(blink::EnumerationHistogram, svgHistogram, ("WebCore.UseCounter_TEST.SVGImage.Features", blink::UseCounter::NumberOfFeatures)); return m_context == SVGImageContext ? svgHistogram : histogram; } EnumerationHistogram& UseCounter::cssHistogram() const { DEFINE_STATIC_LOCAL( blink::EnumerationHistogram, histogram, ("WebCore.UseCounter_TEST.CSSProperties", kMaximumCSSSampleId)); DEFINE_STATIC_LOCAL( blink::EnumerationHistogram, svgHistogram, ("WebCore.UseCounter_TEST.SVGImage.CSSProperties", kMaximumCSSSampleId)); return m_context == SVGImageContext ? svgHistogram : histogram; } /* * * LEGACY metrics support - WebCore.FeatureObserver is to be superceded by * WebCore.UseCounter * */ static EnumerationHistogram& featureObserverHistogram() { DEFINE_STATIC_LOCAL( EnumerationHistogram, histogram, ("WebCore.FeatureObserver", UseCounter::NumberOfFeatures)); return histogram; } UseCounter::LegacyCounter::LegacyCounter() : m_featureBits(NumberOfFeatures), m_CSSBits(lastUnresolvedCSSProperty + 1) {} UseCounter::LegacyCounter::~LegacyCounter() { // PageDestruction was intended to be used as a scale, but it's broken (due to // fast shutdown). See https://crbug.com/597963. featureObserverHistogram().count(OBSOLETE_PageDestruction); updateMeasurements(); } void UseCounter::LegacyCounter::countFeature(Feature feature) { m_featureBits.quickSet(feature); } void UseCounter::LegacyCounter::countCSS(CSSPropertyID property) { m_CSSBits.quickSet(property); } void UseCounter::LegacyCounter::updateMeasurements() { EnumerationHistogram& featureHistogram = featureObserverHistogram(); featureHistogram.count(PageVisits); for (size_t i = 0; i < NumberOfFeatures; ++i) { if (m_featureBits.quickGet(i)) featureHistogram.count(i); } // Clearing count bits is timing sensitive. m_featureBits.clearAll(); // FIXME: Sometimes this function is called more than once per page. The // following bool guards against incrementing the page count when there are no // CSS bits set. https://crbug.com/236262. DEFINE_STATIC_LOCAL( EnumerationHistogram, cssPropertiesHistogram, ("WebCore.FeatureObserver.CSSProperties", kMaximumCSSSampleId)); bool needsPagesMeasuredUpdate = false; for (size_t i = firstCSSProperty; i <= lastUnresolvedCSSProperty; ++i) { if (m_CSSBits.quickGet(i)) { int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram( static_cast<CSSPropertyID>(i)); cssPropertiesHistogram.count(cssSampleId); needsPagesMeasuredUpdate = true; } } if (needsPagesMeasuredUpdate) cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId()); m_CSSBits.clearAll(); } } // namespace blink
gpl-3.0
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp
12627
// Copyright 2016 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "fpdfsdk/cpdfsdk_baannot.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "fpdfsdk/cpdfsdk_datetime.h" #include "fpdfsdk/cpdfsdk_pageview.h" CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { return m_pAnnot; } CPDF_Annot* CPDFSDK_BAAnnot::GetPDFPopupAnnot() const { return m_pAnnot->GetPopupAnnot(); } CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { return m_pAnnot->GetAnnotDict(); } void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { ASSERT(rect.right - rect.left >= GetMinWidth()); ASSERT(rect.top - rect.bottom >= GetMinHeight()); m_pAnnot->GetAnnotDict()->SetRectFor("Rect", rect); } CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const { return m_pAnnot->GetRect(); } CPDF_Annot::Subtype CPDFSDK_BAAnnot::GetAnnotSubtype() const { return m_pAnnot->GetSubtype(); } void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, mode, pOptions); } bool CPDFSDK_BAAnnot::IsAppearanceValid() { return !!m_pAnnot->GetAnnotDict()->GetDictFor("AP"); } bool CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAP) return false; // Choose the right sub-ap const FX_CHAR* ap_entry = "N"; if (mode == CPDF_Annot::Down) ap_entry = "D"; else if (mode == CPDF_Annot::Rollover) ap_entry = "R"; if (!pAP->KeyExist(ap_entry)) ap_entry = "N"; // Get the AP stream or subdirectory CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); return !!psub; } void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, const CPDF_RenderOptions* pOptions) { m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); } void CPDFSDK_BAAnnot::ClearCachedAP() { m_pAnnot->ClearCachedAP(); } void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { if (sContents.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("Contents"); else m_pAnnot->GetAnnotDict()->SetStringFor("Contents", PDF_EncodeText(sContents)); } CFX_WideString CPDFSDK_BAAnnot::GetContents() const { return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents"); } void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { if (sName.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("NM"); else m_pAnnot->GetAnnotDict()->SetStringFor("NM", PDF_EncodeText(sName)); } CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM"); } void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { CPDFSDK_DateTime dt(st); CFX_ByteString str = dt.ToPDFDateTimeString(); if (str.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("M"); else m_pAnnot->GetAnnotDict()->SetStringFor("M", str); } FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { FX_SYSTEMTIME systime; CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M"); CPDFSDK_DateTime dt(str); dt.ToSystemTime(systime); return systime; } void CPDFSDK_BAAnnot::SetFlags(uint32_t nFlags) { m_pAnnot->GetAnnotDict()->SetIntegerFor("F", nFlags); } uint32_t CPDFSDK_BAAnnot::GetFlags() const { return m_pAnnot->GetAnnotDict()->GetIntegerFor("F"); } void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { if (str.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("AS"); else m_pAnnot->GetAnnotDict()->SetStringFor("AS", str); } CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { return m_pAnnot->GetAnnotDict()->GetStringFor("AS"); } void CPDFSDK_BAAnnot::SetStructParent(int key) { m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key); } int CPDFSDK_BAAnnot::GetStructParent() const { return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent"); } // border void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); if (pBorder) { pBorder->SetNewAt<CPDF_Number>(2, nWidth); } else { CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (!pBSDict) { pBSDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); } pBSDict->SetIntegerFor("W", nWidth); } } int CPDFSDK_BAAnnot::GetBorderWidth() const { if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border")) return pBorder->GetIntegerAt(2); if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS")) return pBSDict->GetIntegerFor("W", 1); return 1; } void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (!pBSDict) { pBSDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); } switch (nStyle) { case BorderStyle::SOLID: pBSDict->SetNameFor("S", "S"); break; case BorderStyle::DASH: pBSDict->SetNameFor("S", "D"); break; case BorderStyle::BEVELED: pBSDict->SetNameFor("S", "B"); break; case BorderStyle::INSET: pBSDict->SetNameFor("S", "I"); break; case BorderStyle::UNDERLINE: pBSDict->SetNameFor("S", "U"); break; default: break; } } BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (pBSDict) { CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S"); if (sBorderStyle == "S") return BorderStyle::SOLID; if (sBorderStyle == "D") return BorderStyle::DASH; if (sBorderStyle == "B") return BorderStyle::BEVELED; if (sBorderStyle == "I") return BorderStyle::INSET; if (sBorderStyle == "U") return BorderStyle::UNDERLINE; } CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); if (pBorder) { if (pBorder->GetCount() >= 4) { CPDF_Array* pDP = pBorder->GetArrayAt(3); if (pDP && pDP->GetCount() > 0) return BorderStyle::DASH; } } return BorderStyle::SOLID; } void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { CPDF_Array* pArray = new CPDF_Array; pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetRValue(color)) / 255.0f); pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetGValue(color)) / 255.0f); pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetBValue(color)) / 255.0f); m_pAnnot->GetAnnotDict()->SetFor("C", pArray); } void CPDFSDK_BAAnnot::RemoveColor() { m_pAnnot->GetAnnotDict()->RemoveFor("C"); } bool CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) { size_t nCount = pEntry->GetCount(); if (nCount == 1) { FX_FLOAT g = pEntry->GetNumberAt(0) * 255; color = FXSYS_RGB((int)g, (int)g, (int)g); return true; } else if (nCount == 3) { FX_FLOAT r = pEntry->GetNumberAt(0) * 255; FX_FLOAT g = pEntry->GetNumberAt(1) * 255; FX_FLOAT b = pEntry->GetNumberAt(2) * 255; color = FXSYS_RGB((int)r, (int)g, (int)b); return true; } else if (nCount == 4) { FX_FLOAT c = pEntry->GetNumberAt(0); FX_FLOAT m = pEntry->GetNumberAt(1); FX_FLOAT y = pEntry->GetNumberAt(2); FX_FLOAT k = pEntry->GetNumberAt(3); FX_FLOAT r = 1.0f - std::min(1.0f, c + k); FX_FLOAT g = 1.0f - std::min(1.0f, m + k); FX_FLOAT b = 1.0f - std::min(1.0f, y + k); color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); return true; } } return false; } void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, const CFX_FloatRect& rcBBox, const CFX_Matrix& matrix, const CFX_ByteString& sContents, const CFX_ByteString& sAPState) { CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAPDict) { pAPDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); m_pAnnot->GetAnnotDict()->SetFor("AP", pAPDict); } CPDF_Stream* pStream = nullptr; CPDF_Dictionary* pParentDict = nullptr; if (sAPState.IsEmpty()) { pParentDict = pAPDict; pStream = pAPDict->GetStreamFor(sAPType); } else { CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictFor(sAPType); if (!pAPTypeDict) { pAPTypeDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); pAPDict->SetFor(sAPType, pAPTypeDict); } pParentDict = pAPTypeDict; pStream = pAPTypeDict->GetStreamFor(sAPState); } if (!pStream) { CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); pStream = pDoc->NewIndirect<CPDF_Stream>(); pParentDict->SetReferenceFor(sAPType, pDoc, pStream); } CPDF_Dictionary* pStreamDict = pStream->GetDict(); if (!pStreamDict) { pStreamDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); pStreamDict->SetNameFor("Type", "XObject"); pStreamDict->SetNameFor("Subtype", "Form"); pStreamDict->SetIntegerFor("FormType", 1); pStream->InitStream(nullptr, 0, pStreamDict); } if (pStreamDict) { pStreamDict->SetMatrixFor("Matrix", matrix); pStreamDict->SetRectFor("BBox", rcBBox); } pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength()); } bool CPDFSDK_BAAnnot::IsVisible() const { uint32_t nFlags = GetFlags(); return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (nFlags & ANNOTFLAG_NOVIEW)); } CPDF_Action CPDFSDK_BAAnnot::GetAction() const { return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictFor("A")); } void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { CPDF_Dictionary* pDict = action.GetDict(); if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) { CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); if (pDict->IsInline()) pDict = pDoc->AddIndirectObject(pDict->Clone())->AsDictionary(); m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc, pDict); } } void CPDFSDK_BAAnnot::RemoveAction() { m_pAnnot->GetAnnotDict()->RemoveFor("A"); } CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictFor("AA")); } void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("AA")) m_pAnnot->GetAnnotDict()->SetFor("AA", aa.GetDict()); } void CPDFSDK_BAAnnot::RemoveAAction() { m_pAnnot->GetAnnotDict()->RemoveFor("AA"); } CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { CPDF_AAction AAction = GetAAction(); if (AAction.ActionExist(eAAT)) return AAction.GetAction(eAAT); if (eAAT == CPDF_AAction::ButtonUp) return GetAction(); return CPDF_Action(); } void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CPDF_RenderOptions* pOptions) { m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); } void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) { if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot()) pAnnot->SetOpenState(bOpenState); }
gpl-3.0
hxvu/xstatic
showgraph/showgraph.cpp
2251
/* * CodeQuery * Copyright (C) 2013 ruben2020 https://github.com/ruben2020/ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "core_iface.h" #include "showgraph.h" /** Magnifying factor for getting more detailed images */ const int IMAGE_EXPORT_SCALE_FACTOR = 2; /** Adjust value for image's bounding rectangle on scene rendering */ const qreal IMAGE_RECT_ADJUST = 10; showgraph::showgraph() { } showgraph::~showgraph() { } QImage showgraph::convertToImage(QString grpxml) { /** Create graph instance */ GraphView* graph_view = new GraphView(); graph_view->setGraph( new GGraph( graph_view, true)); /** Read graph from XML */ graph_view->graph()->readFromXML( grpxml); /** * Perform layout in single thread. * Multi thread wouldn't work since we do not run QApplication::exec() and there is not event loop */ graph_view->graph()->doLayoutSingle(); /** Get scene rectangle */ QRectF scene_rect( graph_view->scene()->itemsBoundingRect() .adjusted( -IMAGE_RECT_ADJUST, -IMAGE_RECT_ADJUST, IMAGE_RECT_ADJUST, IMAGE_RECT_ADJUST)); /** Render to image */ QImage image( scene_rect.width() * IMAGE_EXPORT_SCALE_FACTOR, scene_rect.height() * IMAGE_EXPORT_SCALE_FACTOR, QImage::Format_RGB32); image.fill( graph_view->palette().base().color().rgb()); QPainter pp( &image); pp.setRenderHints( graph_view->renderHints()); graph_view->scene()->render( &pp, image.rect(), scene_rect); delete graph_view; return image; }
gpl-3.0
onixion/MAD
src/MAD/MacFinders/ARPReader.cs
12379
using System; using System.Net; using System.Net.NetworkInformation; using System.Threading; using SharpPcap; using PacketDotNet; using MAD; using MAD.Logging; using MAD.Helper; using MAD.JobSystemCore; using MAD.GUI; namespace MAD.MacFinders { static class ARPReader { private static CaptureDeviceList _list; private static ICaptureDevice _dev; private static ICaptureDevice _listenDev; private static Object lockObj = new Object(); private static Thread _steady; private static bool _running; public static ArpScanWindow _window; public static uint networkInterface = MadConf.conf.arpInterface - 1; public static uint subnetMask; public static IPAddress netAddress; public static IPAddress srcAddress; public static bool IsRunning() { return _running; } public static void SetWindow(ArpScanWindow scanWindow) { _window = scanWindow; } public static void ResetWindow() { _window = null; } public static void CheckStart() { _running = true; Logger.Log("Start Checking Devices", Logger.MessageType.INFORM); InitInterfaces(); Thread _listen = new Thread(ListenCheckResponses); _listen.Start(); EthernetPacket _ethpac = NetworkHelper.CreateArpBasePacket(_dev.MacAddress); foreach (ModelHost _dummy in ModelHost.hostList) { _dummy.status = false; ExecuteRequests(_dummy.hostIP); } if (Environment.OSVersion.Platform == PlatformID.Unix) Thread.Sleep(5000); else Thread.Sleep(100); DeInitInterfaces(); _running = false; } public static void FloodStart() { _running = true; Logger.Log("Start ArpReader", Logger.MessageType.INFORM); if (!InitInterfaces()) return; if (_window != null) _window.progressBarArpScan.Value = 5; Thread _listen = new Thread(ListenFloodResponses); _listen.Start(); if (_window != null) _window.progressBarArpScan.Value = 10; EthernetPacket _ethpac = NetworkHelper.CreateArpBasePacket(_dev.MacAddress); SendRequests(); if (Environment.OSVersion.Platform == PlatformID.Unix) Thread.Sleep(5000); else Thread.Sleep(20000); DeInitInterfaces(); _listen.Join(); if (_window != null) _window.progressBarArpScan.Value = 100; _running = false; } private static bool InitInterfaces() { try { _list = CaptureDeviceList.Instance; } catch (Exception) { if (!Mad.GUI_USED) Console.WriteLine("Error: Please check if you have installed WinPcap"); else System.Windows.Forms.MessageBox.Show("Error: Please check if you have installed WinPcap", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return false; } _dev = _list[(int)networkInterface]; _dev.Open(); _listenDev = _list[(int)networkInterface]; return true; } private static void ListenCheckResponses() { _listenDev.OnPacketArrival += new PacketArrivalEventHandler(ProcessCheck); _listenDev.Open(); _listenDev.StartCapture(); } private static void ListenFloodResponses() { _listenDev.OnPacketArrival += new PacketArrivalEventHandler(ProcessFlood); _listenDev.Open(); _listenDev.StartCapture(); } private static void DeInitInterfaces() { try { _listenDev.StopCapture(); } catch (Exception ex) { Logger.Log("Bug that the shitty developer wasn't able to fix. Error Message: " + ex.Message, Logger.MessageType.ERROR); } try { _dev.Close(); } catch (Exception ex) { Logger.Log("Bug that the shitty developer wasn't able to fix. Error Message: " + ex.Message, Logger.MessageType.ERROR); } try { _listenDev.Close(); } catch (Exception ex) { Logger.Log("Bug that the shitty developer wasn't able to fix. Error Message: " + ex.Message, Logger.MessageType.ERROR); } try { _dev = null; } catch (Exception ex) { Logger.Log("Bug that the shitty developer wasn't able to fix. Error Message: " + ex.Message, Logger.MessageType.ERROR); } try { _listenDev = null; } catch (Exception ex) { Logger.Log("Bug that the shitty developer wasn't able to fix. Error Message: " + ex.Message, Logger.MessageType.ERROR); } } public static string ListInterfaces() { Logger.Log("Listed Interfaces for ArpReader", Logger.MessageType.INFORM); _list = CaptureDeviceList.Instance; uint _count = 1; string _buffer = ""; if (_list.Count < 1) { _buffer += "No Devices"; return _buffer; } _buffer += "The following devices are available on this machine:"; _buffer += "\n"; _buffer += "-----------------------------------------------------"; _buffer += "\n"; foreach (ICaptureDevice dev in _list) { _buffer += "Nr " + _count.ToString() + "\n"; _buffer += dev.ToString() + "\n"; _count++; } return _buffer; } public static void SteadyStart(object jsArg) { _running = true; _steady = new Thread(SteadyStartsFunktion); _steady.Start(jsArg); } public static void SteadyStop() { _steady.Abort(); _running = false; } private static void SteadyStartsFunktion(object jsArg) { while (true) { JobSystem _js = (JobSystem)jsArg; FloodStart(); _js.SyncNodes(ModelHost.hostList); Thread.Sleep(3000); } } private static void SendRequests() { Logger.Log("Sending ArpRequest flood..", Logger.MessageType.INFORM); uint _hosts = NetworkHelper.GetHosts(subnetMask); byte[] _netPartBytes = netAddress.GetAddressBytes(); if (BitConverter.IsLittleEndian) Array.Reverse(_netPartBytes); uint _netPartInt = BitConverter.ToUInt32(_netPartBytes, 0); EthernetPacket _ethpac = NetworkHelper.CreateArpBasePacket(_dev.MacAddress); byte[] _targetBytes = new byte[4]; for (int i = 1; i < _hosts - 1; i++) { _targetBytes = BitConverter.GetBytes(_netPartInt + i); Array.Resize(ref _targetBytes, 4); Array.Reverse(_targetBytes); IPAddress _target = new IPAddress(_targetBytes); ExecuteRequests(_ethpac, _target); if (_window != null) _window.progressBarArpScan.Value = Convert.ToInt16(10 + (((i * 100) / _hosts) * 0.8)); } } public static void ExecuteRequests(IPAddress destIP) { EthernetPacket _ethpac = NetworkHelper.CreateArpBasePacket(_dev.MacAddress); ARPPacket _arppac = new ARPPacket(ARPOperation.Request, System.Net.NetworkInformation.PhysicalAddress.Parse("00-00-00-00-00-00"), destIP, _ethpac.SourceHwAddress, srcAddress); _ethpac.PayloadPacket = _arppac; try { _dev.SendPacket(_ethpac); } catch (Exception ex) { Logger.Log("Problems with sending ArpRequest flood: " + ex.ToString(), Logger.MessageType.ERROR); } } private static void ExecuteRequests(EthernetPacket pacBase, IPAddress destIP) { ARPPacket _arppac = new ARPPacket(ARPOperation.Request, System.Net.NetworkInformation.PhysicalAddress.Parse("00-00-00-00-00-00"), destIP, pacBase.SourceHwAddress, srcAddress); pacBase.PayloadPacket = _arppac; try { _dev.SendPacket(pacBase); } catch (Exception ex) { Logger.Log("Problems with sending ArpRequest flood: " + ex.ToString(), Logger.MessageType.ERROR); } } private static void ProcessFlood(object sender, CaptureEventArgs packet) { if (packet.Packet.Data.Length >= 42) { byte[] data = packet.Packet.Data; byte[] arpheader = new byte[4]; arpheader[0] = data[12]; arpheader[1] = data[13]; arpheader[2] = data[20]; arpheader[3] = data[21]; if (arpheader[0] == 8 && arpheader[1] == 6 && arpheader[2] == 0 && arpheader[3] == 2) SyncModelHosts(ReadAddresses(data)); } } private static void ProcessCheck(object sender, CaptureEventArgs packet) { if (packet.Packet.Data.Length >= 42) { byte[] data = packet.Packet.Data; byte[] arpheader = new byte[4]; ModelHost _dummy = new ModelHost(); arpheader[0] = data[12]; arpheader[1] = data[13]; arpheader[2] = data[20]; arpheader[3] = data[21]; if (arpheader[0] == 8 && arpheader[1] == 6 && arpheader[2] == 0 && arpheader[3] == 2) _dummy = ReadAddresses(data); if (ModelHost.Exists(_dummy)) { _dummy.status = true; ModelHost.UpdateHost(_dummy, _dummy); } } } private static ModelHost ReadAddresses(byte[] data) { byte[] hwAddress = new byte[6]; byte[] ipAddress = new byte[4]; uint hwOffset = 22; uint ipOffset = 28; for (int i = 0; i < 6; i++) { hwAddress[i] = data[hwOffset + i]; } for (int i = 0; i < 4; i++) { ipAddress[i] = data[ipOffset + i]; } string hwAddr = NetworkHelper.getPhysicalAddressStringFromArp(hwAddress); IPAddress ipAddr = new IPAddress(ipAddress); string _name = TryGetName(ipAddr); ModelHost _tmp; if (String.IsNullOrEmpty(_name)) _tmp = new ModelHost(hwAddr, ipAddr); else _tmp = new ModelHost(hwAddr, ipAddr, _name); return _tmp; } private static void SyncModelHosts(ModelHost _dummy) { if (ModelHost.Exists(_dummy)) ModelHost.UpdateHost(_dummy, _dummy); else ModelHost.AddToList(_dummy); } private static string TryGetName(IPAddress ipAddr) { string hostName = ""; IPHostEntry ipEntry; try { ipEntry = Dns.GetHostEntry(ipAddr); hostName = ipEntry.HostName; } catch (Exception) { hostName = "N.A."; } return hostName; } } }
gpl-3.0
RebootRevival/FFXI_Test
scripts/globals/items/adder_jambiya_+1.lua
790
----------------------------------------- -- ID: 18033 -- Item: Adder Jambiya +1 -- Additional Effect: Impairs evasion ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); require("scripts/globals/msg"); ----------------------------------- -- onAdditionalEffect Action ----------------------------------- function onAdditionalEffect(player,target,damage) local chance = 15; if (math.random(0,99) >= chance or applyResistanceAddEffect(player,target,ELE_ICE,0) <= 0.5) then return 0,0,0; else target:delStatusEffect(EFFECT_EVASION_BOOST); target:addStatusEffect(EFFECT_EVASION_DOWN, 12, 0, 60); return SUBEFFECT_EVASION_DOWN, msgBasic.ADD_EFFECT_STATUS, EFFECT_EVASION_DOWN; end end;
gpl-3.0
NickGerleman/Nimbus_Webapp
app/controllers/password_resets_controller.rb
995
class PasswordResetsController < ApplicationController # Show form for reseting the password def new render partial: 'new', layout: false end # Process the email address, create a reset token and send it to the user def create user = User.find_by(email: params[:email].downcase) if user user.generate_password_reset_token user.send_password_reset else @errors = true end end # Display page for changing password def edit @token = params[:token] user = User.find_by(password_reset_token: @token) @errors = true unless user end # Change the password def update @user = User.find_by(password_reset_token: params[:token]) if @user @user.update_attributes(password: params[:password], password_confirmation: params[:password_confirmation], password_reset_token: nil) else render status: :not_found, text: 'Invalid Token' end end end
gpl-3.0
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/contentpacks/model/entities/QueryEntity.java
6828
/* * Copyright (C) 2020 Graylog, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Server Side Public License for more details. * * You should have received a copy of the Server Side Public License * along with this program. If not, see * <http://www.mongodb.com/licensing/server-side-public-license>. */ package org.graylog2.contentpacks.model.entities; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableSet; import com.google.common.graph.Traverser; import org.graylog.plugins.views.search.Filter; import org.graylog.plugins.views.search.GlobalOverride; import org.graylog.plugins.views.search.Query; import org.graylog.plugins.views.search.engine.BackendQuery; import org.graylog.plugins.views.search.filter.StreamFilter; import org.graylog2.contentpacks.NativeEntityConverter; import org.graylog2.contentpacks.exceptions.ContentPackException; import org.graylog2.contentpacks.model.ModelTypes; import org.graylog2.contentpacks.model.entities.references.ValueReference; import org.graylog2.plugin.indexer.searches.timeranges.TimeRange; import org.graylog2.plugin.streams.Stream; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Collections; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.collect.ImmutableSortedSet.of; import static java.util.stream.Collectors.toSet; @AutoValue @JsonAutoDetect @JsonInclude(JsonInclude.Include.NON_NULL) @JsonDeserialize(builder = QueryEntity.Builder.class) public abstract class QueryEntity implements NativeEntityConverter<Query> { @JsonProperty public abstract String id(); @JsonProperty public abstract TimeRange timerange(); @Nullable @JsonProperty public abstract Filter filter(); @Nonnull @JsonProperty public abstract BackendQuery query(); @JsonIgnore public abstract Optional<GlobalOverride> globalOverride(); @Nonnull @JsonProperty("search_types") public abstract ImmutableSet<SearchTypeEntity> searchTypes(); public Set<String> usedStreamIds() { return Optional.ofNullable(filter()) .map(optFilter -> { @SuppressWarnings("UnstableApiUsage") final Traverser<Filter> filterTraverser = Traverser.forTree(filter -> firstNonNull(filter.filters(), Collections.emptySet())); return StreamSupport.stream(filterTraverser.breadthFirst(optFilter).spliterator(), false) .filter(filter -> filter instanceof StreamFilter) .map(streamFilter -> ((StreamFilter) streamFilter).streamId()) .filter(Objects::nonNull) .collect(toSet()); }) .orElse(Collections.emptySet()); } public abstract Builder toBuilder(); public static Builder builder() { return Builder.createWithDefaults(); } @AutoValue.Builder @JsonPOJOBuilder(withPrefix = "") public abstract static class Builder { @JsonProperty public abstract Builder id(String id); @JsonProperty public abstract Builder timerange(TimeRange timerange); @JsonProperty public abstract Builder filter(Filter filter); @JsonProperty public abstract Builder query(BackendQuery query); public abstract Builder globalOverride(@Nullable GlobalOverride globalOverride); @JsonProperty("search_types") public abstract Builder searchTypes(@Nullable Set<SearchTypeEntity> searchTypes); abstract QueryEntity autoBuild(); @JsonCreator static Builder createWithDefaults() { return new AutoValue_QueryEntity.Builder().searchTypes(of()); } public QueryEntity build() { return autoBuild(); } } // TODO: This code assumes that we only use shallow filters for streams. // If this ever changes, we need to implement a mapper that can handle filter trees. private Filter shallowMappedFilter(Map<EntityDescriptor, Object> nativeEntities) { return Optional.ofNullable(filter()) .map(optFilter -> { Set<Filter> newFilters = optFilter.filters().stream() .map(filter -> { if (filter.type().matches(StreamFilter.NAME)) { final StreamFilter streamFilter = (StreamFilter) filter; final Stream stream = (Stream) nativeEntities.get( EntityDescriptor.create(streamFilter.streamId(), ModelTypes.STREAM_V1)); if (Objects.isNull(stream)) { throw new ContentPackException("Could not find matching stream id: " + streamFilter.streamId()); } return streamFilter.toBuilder().streamId(stream.getId()).build(); } return filter; }).collect(Collectors.toSet()); return optFilter.toGenericBuilder().filters(newFilters).build(); }) .orElse(null); } @Override public Query toNativeEntity(Map<String, ValueReference> parameters, Map<EntityDescriptor, Object> nativeEntities) { return Query.builder() .id(id()) .searchTypes(searchTypes().stream().map(s -> s.toNativeEntity(parameters, nativeEntities)) .collect(Collectors.toSet())) .query(query()) .filter(shallowMappedFilter(nativeEntities)) .timerange(timerange()) .globalOverride(globalOverride().orElse(null)) .build(); } }
gpl-3.0
uw-it-cte/fogproject
FOG Service/src/FOG_SnapinClient/MOD_SnapinClient.cs
28591
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Net; using System.Collections; using System.Runtime.InteropServices; using Microsoft.Win32; using FOG; using IniReaderObj; using System.IO; using System.Diagnostics; namespace FOG { public class SnapinClient : AbstractFOGService { [DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] private static extern bool IsIconic(IntPtr hWnd); private const int SW_HIDE = 0; private const int SW_SHOWNORMAL = 1; private const int SW_SHOWMINIMIZED = 2; private const int SW_SHOWMAXIMIZED = 3; private const int SW_SHOWNOACTIVATE = 4; private const int SW_RESTORE = 9; private const int SW_SHOWDEFAULT = 10; private int intStatus, intPause; private String strURLPathCheckin, strURLPathDownload; private String strURLModuleStatus; private Boolean blGo; private const String MOD_NAME = "FOG::SnapinClient"; public SnapinClient() { intStatus = STATUS_STOPPED; intPause = 400; blGo = false; } private Boolean readSettings() { if (ini != null) { if (ini.isFileOk()) { String preCheckIn = ini.readSetting("snapinclient", "checkinurlprefix"); String postCheckIn = ini.readSetting("snapinclient", "checkinurlpostfix"); String preDL = ini.readSetting("snapinclient", "downloadurlprefix"); String postDL = ini.readSetting("snapinclient", "downloadurlpostfix"); String ip = ini.readSetting("fog_service", "ipaddress"); if (ip == null || ip.Trim().Length == 0) ip = "fogserver"; // get the module status URL String strPreMS = ini.readSetting("fog_service", "urlprefix"); String strPostMS = ini.readSetting("fog_service", "urlpostfix"); if (ip != null && strPreMS != null && strPostMS != null) strURLModuleStatus = strPreMS + ip + strPostMS; else { return false; } try { intPause = Int32.Parse( ini.readSetting("snapinclient", "checkintime").Trim() ); } catch { } if (ip != null && ip.Length > 0 && preCheckIn != null && preCheckIn.Length > 0 && postCheckIn != null && postCheckIn.Length > 0 && preDL != null && preDL.Length > 0 && postDL != null && postDL.Length > 0) { strURLPathCheckin = preCheckIn + ip + postCheckIn; strURLPathDownload = preDL + ip + postDL; return true; } } } return false; } public override void mStart() { try { intStatus = STATUS_RUNNING; if (readSettings()) { blGo = true; startWatching(); } else { log(MOD_NAME, "Failed to read ini settings."); } } catch { } } public override string mGetDescription() { return "Snapin Client - Installs snapins on client computers."; } private void startWatching() { try { log(MOD_NAME, "Starting snapin client process..."); String strCurrentHostName = getHostName(); ArrayList alMACs = getMacAddress(); try { Random r = new Random(); //int intSleep = r.Next(350, 500); // 0.32 int intSleep = r.Next(30, 60); // 0.33 log(MOD_NAME, "Sleeping for " + intSleep + " seconds."); System.Threading.Thread.Sleep(intSleep * 1000); } catch{} while (blGo) { // process every mac address on the machine // to make sure we get all intended snapins Boolean blInstalled = false; String macList = null; if (alMACs != null && alMACs.Count > 0) { String[] strMacs = (String[])alMACs.ToArray(typeof(String)); macList = String.Join("|", strMacs); } if (macList != null && macList.Length > 0) { try { Boolean blConnectOK = false; String strDta = ""; while (!blConnectOK) { try { log(MOD_NAME, "Attempting to connect to fog server..."); WebClient wc = new WebClient(); String strPath = strURLModuleStatus + "?mac=" + macList + "&moduleid=snapin"; strDta = wc.DownloadString(strPath); blConnectOK = true; } catch (Exception exp) { log(MOD_NAME, "Failed to connect to fog server!"); log(MOD_NAME, exp.Message); log(MOD_NAME, exp.StackTrace); log(MOD_NAME, "Sleeping for 1 minute."); try { System.Threading.Thread.Sleep(60000); } catch { } } } strDta = strDta.Trim(); Boolean blLoop = false; if (strDta.StartsWith("#!ok", true, null)) { log(MOD_NAME, "Module is active..."); blLoop = true; } else if (strDta.StartsWith("#!db", true, null)) { log(MOD_NAME, "Database error."); } else if (strDta.StartsWith("#!im", true, null)) { log(MOD_NAME, "Invalid MAC address format."); } else if (strDta.StartsWith("#!ng", true, null)) { log(MOD_NAME, "Module is disabled globally on the FOG Server, exiting."); return; } else if (strDta.StartsWith("#!nh", true, null)) { log(MOD_NAME, "Module is disabled on this host."); } else if (strDta.StartsWith("#!um", true, null)) { log(MOD_NAME, "Unknown Module ID passed to server."); } else if (strDta.StartsWith("#!er", true, null)) { log(MOD_NAME, "General Error Returned: "); log(MOD_NAME, strDta); } else { log(MOD_NAME, "Unknown error, module will exit."); } if (blLoop) { WebClient web = new WebClient(); String strPathCheckin = strURLPathCheckin + "?mac=" + macList; String strData = web.DownloadString(strPathCheckin); if (strData != null) { String[] arData = strData.Split('\n'); String strAction = arData[0]; strAction = strAction.Trim(); if (strAction.StartsWith("#!db")) { log(MOD_NAME, "Unable to determine snapin status due to a database error."); } else if (strAction.StartsWith("#!im")) { log(MOD_NAME, "Unable to determine snapin status because the MAC address was not correctly formated."); } else if (strAction.StartsWith("#!er")) { log(MOD_NAME, "Unable to determine snapin status due to an unknown error."); log(MOD_NAME, "Maybe MAC isn't registered: " + macList); } else if (strAction.StartsWith("#!it")) { log(MOD_NAME, "Will NOT perform any snapin tasks because an image task exists for this host."); } else if (strAction.StartsWith("#!ns")) { // ok, no tasks found log(MOD_NAME, "No Tasks found for: " + macList); } else if (strAction.StartsWith("#!ok")) { // task exists load meta data, then download file. if (arData.Length == 9) { String strTaskID = arData[1]; String strCreated = arData[2]; String strSnapinName = arData[3]; String strArgs = arData[4]; String strRestart = arData[5]; String strFileName = arData[6]; String strRunWith = arData[7]; String strRunWithArgs = arData[8]; if (strRunWith != null) { strRunWith = strRunWith.Trim(); if (strRunWith.StartsWith("SNAPINRUNWITH=")) strRunWith = strRunWith.Replace("SNAPINRUNWITH=", ""); } if (strRunWithArgs != null) { strRunWithArgs = strRunWithArgs.Trim(); if (strRunWithArgs.StartsWith("SNAPINRUNWITHARGS=")) strRunWithArgs = strRunWithArgs.Replace("SNAPINRUNWITHARGS=", ""); } if (strTaskID != null) { strTaskID = strTaskID.Trim(); if (strTaskID.StartsWith("JOBTASKID=")) strTaskID = strTaskID.Replace("JOBTASKID=", ""); } if (strCreated != null) { strCreated = strCreated.Trim(); if (strCreated.StartsWith("JOBCREATION=")) strCreated = strCreated.Replace("JOBCREATION=", ""); } if (strSnapinName != null) { strSnapinName = strSnapinName.Trim(); if (strSnapinName.StartsWith("SNAPINNAME=")) strSnapinName = strSnapinName.Replace("SNAPINNAME=", ""); } if (strArgs != null) { strArgs = strArgs.Trim(); if (strArgs.StartsWith("SNAPINARGS=")) strArgs = strArgs.Replace("SNAPINARGS=", ""); } if (strRestart != null) { strRestart = strRestart.Trim(); if (strRestart.StartsWith("SNAPINBOUNCE=")) strRestart = strRestart.Replace("SNAPINBOUNCE=", ""); } if (strFileName != null) { strFileName = strFileName.Trim(); if (strFileName.StartsWith("SNAPINFILENAME=")) strFileName = strFileName.Replace("SNAPINFILENAME=", ""); } // check all the values we got back and make sure the make sense. int intTaskID = -1; Boolean blReboot = (strRestart == "1"); try { intTaskID = int.Parse(strTaskID); } catch (Exception exNum) { log(MOD_NAME, "Failed to obtain a valid Task ID Number."); log(MOD_NAME, exNum.Message); log(MOD_NAME, exNum.StackTrace); continue; } if (strFileName == null) continue; log(MOD_NAME, "Snapin Found: "); log(MOD_NAME, " ID: " + intTaskID); log(MOD_NAME, " RunWith: " + strRunWith); log(MOD_NAME, " RunWithArgs: " + strRunWithArgs); log(MOD_NAME, " Name: " + strSnapinName); log(MOD_NAME, " Created: " + strCreated); log(MOD_NAME, " Args: " + strArgs); if (blReboot) log(MOD_NAME, " Reboot: Yes"); else log(MOD_NAME, " Reboot: No"); log(MOD_NAME, "Starting FOG Snapin Download"); String strLocalPath; try { WebClient download = new WebClient(); String strLocalDir = AppDomain.CurrentDomain.BaseDirectory + @"tmp"; if (!Directory.Exists(strLocalDir)) { Directory.CreateDirectory(strLocalDir); } strLocalPath = strLocalDir + @"\" + strFileName; download.DownloadFile(strURLPathDownload + "?mac=" + macList + "&taskid=" + intTaskID, strLocalPath); } catch (Exception exDl) { log(MOD_NAME, "Failed to download file."); log(MOD_NAME, exDl.Message); log(MOD_NAME, exDl.StackTrace); continue; } // check that we have a file. if (File.Exists(strLocalPath)) { try { FileInfo fi = new FileInfo(strLocalPath); if (fi.Length > 0) { log(MOD_NAME, "Download complete."); // Great! run the snapin log(MOD_NAME, "Starting FOG Snapin Installation."); Process p = new Process(); p.StartInfo.CreateNoWindow = true; p.StartInfo.UseShellExecute = false; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; if (strRunWith != null && strRunWith.Length > 0) { String args = ""; if (strRunWithArgs != null && strRunWithArgs.Length > 0) { args = " " + strRunWithArgs + " "; } p.StartInfo.FileName = strRunWith; p.StartInfo.Arguments = args + " \"" + strLocalPath + "\" " + strArgs; } else { p.StartInfo.FileName = strLocalPath; p.StartInfo.Arguments = strArgs; } try { p.Start(); p.WaitForExit(); log(MOD_NAME, "FOG Snapin Installtion complete."); String strReturnCode = p.ExitCode.ToString(); log(MOD_NAME, "Installation returned with code: " + strReturnCode); String strURLReturn = strPathCheckin + "&taskid=" + strTaskID + "&exitcode=" + strReturnCode; WebClient w = new WebClient(); w.DownloadString(strURLReturn); } catch (Exception exp) { log(MOD_NAME, exp.Message); log(MOD_NAME, exp.StackTrace); String strURLReturn = strPathCheckin + "&taskid=" + strTaskID + "&exitcode=-1&exitdesc=" + encodeTo64(exp.Message); try { WebClient w = new WebClient(); web.DownloadString(strURLReturn); } catch { } } String strRebootMsg = ""; if (blReboot) strRebootMsg = " This computer will restart very soon, please save all data!"; pushMessage("FOG Snapin, " + strSnapinName + " has been installed. " + strRebootMsg); File.Delete(strLocalPath); if (blReboot) { try { log(MOD_NAME, "Snapin requires system restart, restarting computer."); System.Threading.Thread.Sleep(25000); restartComputer(); } catch { } } blInstalled = true; } else { log(MOD_NAME, "Download Failed; Zero size file."); } } catch (Exception exFle) { log(MOD_NAME, exFle.Message); log(MOD_NAME, exFle.StackTrace); } } else { log(MOD_NAME, "Download Failed; File not found."); } } else { log(MOD_NAME, "A snapin task was found but, not all the meta data was sent. Meta data length: " + arData.Length + " Required: 7."); } } } } } catch (Exception e) { log(MOD_NAME, e.Message); log(MOD_NAME, e.StackTrace); } } if (!blInstalled) { // If a snapin was installed, then don't wait because there may be another waiting. try { System.Threading.Thread.Sleep(intPause * 1000); } catch { } } } } catch (Exception e) { pushMessage("FOG Snapin error:\n" + e.Message); log(MOD_NAME, e.Message); log(MOD_NAME, e.StackTrace); } finally { } intStatus = STATUS_TASKCOMPLETE; } private string encodeTo64(string strEncode) { try { byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncode); return System.Convert.ToBase64String(b); } catch { return ""; } } public override Boolean mStop() { log(MOD_NAME, "Shutdown complete"); return true; } public override int mGetStatus() { return intStatus; } } }
gpl-3.0
jonorthwash/ud-annotatrix
notatrix/src/formats/sd/get-loss.js
864
"use strict"; const _ = require("underscore"); const utils = require("../../utils"); const fields = require("./fields"); module.exports = sent => { const serial = sent.serialize(); let losses = new Set(); serial.tokens.forEach(token => { if (token.heads && token.heads.length > 1) losses.add("enhanced dependencies"); Object.keys(_.omit(token, fields)).forEach(field => { switch (field) { case ("uuid"): case ("index"): case ("deps"): break; case ("heads"): if (token.heads.length > 1) losses.add(field); break; case ("feats"): case ("misc"): if (token[field] && token[field].length) losses.add(field); break; default: if (token[field]) losses.add(field); } }) }); return Array.from(losses); };
gpl-3.0
erichilarysmithsr/pH7-Social-Dating-CMS
static/js/jquery/box/i18n/jquery.colorbox-zh-CN.js
458
/* jQuery Colorbox language configuration language: Chinese Simplified (zh-CN) translated by: zhao weiming */ jQuery.extend(jQuery.colorbox.settings, { current: "当前图像 {current} 总共 {total}", previous: "前一页", next: "后一页", close: "关闭", xhrError: "此内容无法加载", imgError: "此图片无法加载", slideshowStart: "开始播放幻灯片", slideshowStop: "停止播放幻灯片" });
gpl-3.0
kc8hfi/mygolfcart
current/java/GPSRead/ConsoleReadingThread.java
1282
import java.io.BufferedReader; import java.io.BufferedWriter; public class ConsoleReadingThread extends Thread { private BufferedReader reader = null; private String readerId = ""; // private BufferedWriter mywriter; public ConsoleReadingThread(/*BufferedWriter sw,*/BufferedReader br,String readerId) { this.reader = br/* new BufferedReader(new InputStreamReader(System.in))*/; this.readerId = readerId; //this.mywriter = sw; } public void run() { System.out.println(readerId + " .Starting Console Reader ....."); GetHoldOfTheConsole(); super.run(); } public void GetHoldOfTheConsole() { while(true) { try { String getData = reader.readLine(); // System.out.println(readerId + " reads : " + getData); // mywriter.write(getData); // mywriter.newLine(); // mywriter.flush(); // System.out.println("we done flushed the stuff"); } catch(Exception ex) { System.out.println("2Bugger off !!! "); } } } }
gpl-3.0
npotts/homehub
homehub_test.go
5983
/* Copyright (c) 2016 Nick Potts Licensed to You under the GNU GPLv3 See the LICENSE file at github.com/npotts/homehub/LICENSE This file is part of the HomeHub project */ package homehub import ( "encoding/json" "github.com/davecgh/go-spew/spew" "testing" ) func TestAlphabetic_Valid(t *testing.T) { tests := map[string]bool{ "ok": true, "no spaces": false, "1@##$": false, "": false, "aASFDASdasdasdASDASDASdafasd": true, } for str, valid := range tests { if v := Alphabetic(str).Valid(); v != valid { t.Errorf("With %q, expected %v, got %v", str, valid, v) } } } func TestFieldMode_SqlType(t *testing.T) { ok := map[string][]fieldmode{ "sqlite3": []fieldmode{fmBool, fmInt, fmFloat, fmString, fmPrimaryKey, fmDateTime}, "postgres": []fieldmode{fmBool, fmInt, fmFloat, fmString, fmPrimaryKey, fmDateTime}, } errord := map[string][]fieldmode{ "sqlite3": []fieldmode{fmInvalid}, "postgres": []fieldmode{fmInvalid}, "unknown": []fieldmode{fmInvalid}, } run := func(tests map[string][]fieldmode, err error) { for dialect, defined := range tests { for _, fm := range defined { if _, e := fm.sqltype(dialect); e != err { t.Errorf("Faied testing for %q:%v: Wanted %v, got %v", dialect, fm, err, e) } } } } run(ok, nil) run(errord, errSQLType) } func TestField_UnmarshalJSON(t *testing.T) { type x struct { j string d *Datam e error v bool } tests := map[string]x{ "fmNull": x{v: true, e: nil, j: `{"table": "ntable", "data": {"null": null}}`, d: &Datam{Table: "ntable", Data: map[Alphabetic]Field{Alphabetic("null"): Field{Value: nil, mode: fmNull}}}}, "fmBool": x{v: true, e: nil, j: `{"table": "btable", "data": {"bool": false}}`, d: &Datam{Table: "btable", Data: map[Alphabetic]Field{Alphabetic("bool"): Field{Value: false, mode: fmBool}}}}, "fmInt": x{v: true, e: nil, j: `{"table": "itable", "data": {"int": 1}}`, d: &Datam{Table: "itable", Data: map[Alphabetic]Field{Alphabetic("int"): Field{Value: int64(1), mode: fmInt}}}}, "fmFloat": x{v: true, e: nil, j: `{"table": "ftable", "data": {"float": 1.0}}`, d: &Datam{Table: "ftable", Data: map[Alphabetic]Field{Alphabetic("float"): Field{Value: 1.0, mode: fmFloat}}}}, "fmString": x{v: true, e: nil, j: `{"table": "stable", "data": {"string": "str"}}`, d: &Datam{Table: "stable", Data: map[Alphabetic]Field{Alphabetic("string"): Field{Value: "str", mode: fmString}}}}, "shortString": x{v: true, e: nil, j: `{"table": "stable", "data": {"string": ""}}`, d: &Datam{Table: "stable", Data: map[Alphabetic]Field{Alphabetic("string"): Field{Value: "", mode: fmString}}}}, //some error varieties "array": x{v: false, e: errFormat, j: `{"table": "bad", "data": {"array": [1,2,3]}}`}, "obj": x{v: false, e: errFormat, j: `{"table": "bad", "data": {"obj": {}}}`}, "all vars": x{ v: true, j: `{"table": "table", "data": {"float": 1.0, "string": "str", "int": 1, "bool": false, "null":null}}`, d: &Datam{ Table: "table", Data: map[Alphabetic]Field{ Alphabetic("float"): Field{Value: 1.0, mode: fmFloat}, Alphabetic("string"): Field{Value: "str", mode: fmString}, Alphabetic("int"): Field{Value: 1, mode: fmInt}, Alphabetic("bool"): Field{Value: false, mode: fmBool}, Alphabetic("null"): Field{Value: nil, mode: fmNull}, }, }, }, } for name, x := range tests { t.Logf("Running checks on %q", name) datam := &Datam{} if e := json.Unmarshal([]byte(x.j), datam); e != x.e { t.Errorf("Returned error does not match expected. Got %v want %v", e, x.e) } if x.e != nil { //invalid JSON should return an error - no need to check the values continue } if datam.Valid() != x.v { t.Errorf("Validity does not match") } //make sure returned object matches hardcoded variable if !datam.Equal(x.d) { spew.Dump(x.d) spew.Dump(datam) t.Errorf("Reflect do not equal") } } } func TestDatam_SqlCreate(t *testing.T) { type x struct { d Datam dialect string expect string inerror bool } tests := []x{ x{dialect: "no idea", inerror: true}, x{d: Datam{ Table: "test", Data: map[Alphabetic]Field{ Alphabetic("float"): Field{Value: 1.0, mode: fmFloat}, Alphabetic("string"): Field{Value: "str", mode: fmString}, Alphabetic("int"): Field{Value: 1, mode: fmInt}, Alphabetic("bool"): Field{Value: false, mode: fmBool}, }, }, dialect: "sqlite3", inerror: false, expect: `CREATE TABLE IF NOT EXISTS "test" (rowid INTEGER PRIMARY KEY ASC ON CONFLICT REPLACE AUTOINCREMENT, created DATETIME DEFAULT CURRENT_TIMESTAMP, bool BOOL, float FLOAT, int INT, string TEXT);`, }, } for i, x := range tests { r, e := x.d.SqlCreate(x.dialect) t.Logf("Running test #%d: %v", i, x.d.Valid()) if (x.inerror && e == nil) || (!x.inerror && e != nil) { t.Logf("Want an error: %v Got Error: %v", x.inerror, e) t.Fatal("Should either error and didnt, or not and did") } if r != x.expect { t.Logf("Got: %v", r) t.Logf("Wnt: %v", x.expect) t.Errorf("Did not get the string I expected") } } } func TestDatam_NamedExec(t *testing.T) { type x struct { d Datam dialect string expect string inerror bool } tests := []x{ x{dialect: "no idea", inerror: true}, x{d: Datam{ Table: "test", Data: map[Alphabetic]Field{ Alphabetic("float"): Field{Value: 1.0, mode: fmFloat}, }, }, dialect: "sqlite3", inerror: false, expect: `INSERT INTO "test" (float) VALUES (:float);`, }, } for i, x := range tests { r, vals, e := x.d.NamedExec() t.Logf("Running test #%d: %v", i, vals) if (x.inerror && e == nil) || (!x.inerror && e != nil) { t.Logf("Want an error: %v Got Error: %v", x.inerror, e) t.Fatal("Should either error and didnt, or not and did") } if r != x.expect { t.Logf("Got: %v", r) t.Logf("Wnt: %v", x.expect) t.Errorf("Did not get the string I expected") } } } /* */
gpl-3.0
sethten/MoDesserts
mcp50/temp/src/minecraft_server/net/minecraft/src/BlockDirectional.java
711
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode fieldsfirst package net.minecraft.src; // Referenced classes of package net.minecraft.src: // Block, Material public abstract class BlockDirectional extends Block { protected BlockDirectional(int p_i1006_1_, int p_i1006_2_, Material p_i1006_3_) { super(p_i1006_1_, p_i1006_2_, p_i1006_3_); } protected BlockDirectional(int p_i1007_1_, Material p_i1007_2_) { super(p_i1007_1_, p_i1007_2_); } public static int func_48132_b(int p_48132_0_) { return p_48132_0_ & 3; } }
gpl-3.0
PapenfussLab/PathOS
Tools/Hl7Tools/src/main/java/org/petermac/hl7/model/v251/group/EAN_U09_NOTIFICATION.java
3515
/* * This class is an auto-generated source file for a HAPI * HL7 v2.x standard structure class. * * For more information, visit: http://hl7api.sourceforge.net/ * * The contents of this file are subject to the Mozilla Public License Version 1.1 * (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.mozilla.org/MPL/ * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the * specific language governing rights and limitations under the License. * * The Original Code is "[file_name]". Description: * "[one_line_description]" * * The Initial Developer of the Original Code is University Health Network. Copyright (C) * 2012. All Rights Reserved. * * Contributor(s): ______________________________________. * * Alternatively, the contents of this file may be used under the terms of the * GNU General Public License (the "GPL"), in which case the provisions of the GPL are * applicable instead of those above. If you wish to allow use of your version of this * file only under the terms of the GPL and not to allow others to use your version * of this file under the MPL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by the GPL License. * If you do not delete the provisions above, a recipient may use your version of * this file under either the MPL or the GPL. * */ package org.petermac.hl7.model.v251.group; import org.petermac.hl7.model.v251.segment.*; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; import ca.uhn.hl7v2.model.*; /** * <p>Represents a EAN_U09_NOTIFICATION group structure (a Group object). * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together. * This Group contains the following elements: * </p> * <ul> * <li>1: NDS (Notification Detail) <b> </b></li> * <li>2: NTE (Notes and Comments) <b>optional </b></li> * </ul> */ //@SuppressWarnings("unused") public class EAN_U09_NOTIFICATION extends AbstractGroup { /** * Creates a new EAN_U09_NOTIFICATION group */ public EAN_U09_NOTIFICATION(Group parent, ModelClassFactory factory) { super(parent, factory); init(factory); } private void init(ModelClassFactory factory) { try { this.add(NDS.class, true, false, false); this.add(NTE.class, false, false, false); } catch(HL7Exception e) { log.error("Unexpected error creating EAN_U09_NOTIFICATION - this is probably a bug in the source code generator.", e); } } /** * Returns "2.5.1" */ public String getVersion() { return "2.5.1"; } /** * Returns * NDS (Notification Detail) - creates it if necessary */ public NDS getNDS() { NDS retVal = getTyped("NDS", NDS.class); return retVal; } /** * Returns * NTE (Notes and Comments) - creates it if necessary */ public NTE getNTE() { NTE retVal = getTyped("NTE", NTE.class); return retVal; } }
gpl-3.0
lcpt/xc
src/utility/database/DBDatastore.cc
1409
//---------------------------------------------------------------------------- // XC program; finite element analysis code // for structural analysis and design. // // Copyright (C) Luis Claudio Pérez Tato // // This program derives from OpenSees <http://opensees.berkeley.edu> // developed by the «Pacific earthquake engineering research center». // // Except for the restrictions that may arise from the copyright // of the original program (see copyright_opensees.txt) // XC is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // // You should have received a copy of the GNU General Public License // along with this program. // If not, see <http://www.gnu.org/licenses/>. //---------------------------------------------------------------------------- //DBDatastore.cc #include "DBDatastore.h" XC::DBDatastore::DBDatastore(Preprocessor &preprocessor, FEM_ObjectBroker &theObjBroker) :FE_Datastore(preprocessor, theObjBroker), dbTAG(0) {}
gpl-3.0
eryngion/otter-browser
resources/translations/otter-browser_sv.ts
253811
<?xml version="1.0" ?><!DOCTYPE TS><TS language="sv" version="2.1"> <context> <name>Otter::AcceptCookieDialog</name> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="14"/> <source>Accept Cookie</source> <translation>Acceptera Kaka</translation> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="35"/> <source>Domain:</source> <translation>Domän:</translation> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="42"/> <source>Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="49"/> <source>Value:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="56"/> <source>Expiration date:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="63"/> <source>Is secure:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.ui" line="70"/> <source>Is HTTP only:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="47"/> <source>Website %1 requested to add new cookie.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="51"/> <source>Website %1 requested to update existing cookie.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="55"/> <source>Website %1 requested to remove existing cookie.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="61"/> <source>This Session Only</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="62"/> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="63"/> <source>Yes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="62"/> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="63"/> <source>No</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="64"/> <source>Accept</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="68"/> <source>Accept For This Session Only</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AcceptCookieDialog.cpp" line="71"/> <source>Discard</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::AcceptLanguageDialog</name> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="14"/> <source>Preferred Webpage Language</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="20"/> <source>To add language, please choose one from list or type its code.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="39"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="85"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="110"/> <source>Move Up</source> <translation>Flytta Upp</translation> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.ui" line="136"/> <source>Move Down</source> <translation>Flytta Ned</translation> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="39"/> <source>Name</source> <translation>Namn</translation> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="39"/> <source>Code</source> <translation>Kod</translation> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="69"/> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="134"/> <source>Any other</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="70"/> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="138"/> <source>System language (%1 - %2)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/AcceptLanguageDialog.cpp" line="146"/> <source>Custom</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::AddressWidget</name> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="94"/> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="116"/> <source>Enter address or search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="251"/> <source>Undo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="252"/> <source>Redo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="254"/> <source>Cut</source> <translation>Klipp Ut</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="255"/> <source>Copy</source> <translation>Kopiera</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="256"/> <source>Paste</source> <translation>Klistra In</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="263"/> <source>Delete</source> <translation>Radera</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="265"/> <source>Copy to Note</source> <translation>Kopiera till Anteckning</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="267"/> <source>Clear All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="268"/> <source>Select All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="507"/> <source>Remove Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="507"/> <source>Add Bookmark</source> <translation>Lägg till Bokmärke</translation> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="523"/> <source>Feed List</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="551"/> <source>Click to load all plugins on the page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="910"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/AddressWidget.cpp" line="945"/> <source>Remove This Icon</source> <translation>Ta Bort Ikon </translation> </message> </context> <context> <name>Otter::Application</name> <message> <location filename="../../src/core/Application.cpp" line="393"/> <source>Warning</source> <translation>Varning</translation> </message> <message> <location filename="../../src/core/Application.cpp" line="393"/> <source>This session was not saved correctly. Are you sure that you want to restore this session anyway?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="496"/> <source>New update %1 from %2 channel is available!</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="663"/> <location filename="../../src/core/Application.cpp" line="712"/> <source>Question</source> <translation>Fråga</translation> </message> <message numerus="yes"> <location filename="../../src/core/Application.cpp" line="664"/> <source>You are about to quit while %n files are still being downloaded.</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/core/Application.cpp" line="665"/> <location filename="../../src/core/Application.cpp" line="714"/> <source>Do you want to continue?</source> <translation>Vill du fortsätta?</translation> </message> <message> <location filename="../../src/core/Application.cpp" line="669"/> <location filename="../../src/core/Application.cpp" line="718"/> <source>Do not show this message again</source> <translation>Visa inte detta meddelande igen</translation> </message> <message> <location filename="../../src/core/Application.cpp" line="671"/> <location filename="../../src/core/Application.cpp" line="720"/> <source>Hide</source> <translation>Göm</translation> </message> <message> <location filename="../../src/core/Application.cpp" line="713"/> <source>You are about to quit the current Otter Browser session.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::AuthenticationDialog</name> <message> <location filename="../../src/ui/AuthenticationDialog.ui" line="14"/> <source>Authentication Required</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/AuthenticationDialog.ui" line="22"/> <source>Server:</source> <translation>Server:</translation> </message> <message> <location filename="../../src/ui/AuthenticationDialog.ui" line="29"/> <source>Message:</source> <translation>Meddelande:</translation> </message> <message> <location filename="../../src/ui/AuthenticationDialog.ui" line="36"/> <source>User:</source> <translation>Användare:</translation> </message> <message> <location filename="../../src/ui/AuthenticationDialog.ui" line="46"/> <source>Password:</source> <translation>Lösenord:</translation> </message> </context> <context> <name>Otter::BookmarkPropertiesDialog</name> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="19"/> <source>Title:</source> <translation>Titel:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="29"/> <source>Description:</source> <translation>Beskrivning:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="39"/> <source>Address:</source> <translation>Adress:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="49"/> <source>Folder:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="71"/> <source>New</source> <translation>Ny</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="96"/> <source>Visits:</source> <translation>Besök:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="103"/> <source>Last Visit:</source> <translation>Senaste Besök:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="110"/> <source>Created:</source> <translation>Skapad:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="138"/> <source>Modified:</source> <translation>Modifierad:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.ui" line="152"/> <source>Keyword:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="49"/> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="50"/> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="54"/> <source>Unknown</source> <translation>Okänd:</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="67"/> <source>Edit Bookmark</source> <translation>Redigera Bokmärke</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="71"/> <source>Add Bookmark</source> <translation>Lägg till Bokmärke</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="84"/> <source>View Bookmark</source> <translation>Visa Bokmärke</translation> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="132"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarkPropertiesDialog.cpp" line="132"/> <source>Bookmark with this keyword already exists.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarkWidget</name> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="83"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="99"/> <source>Title: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="103"/> <source>Address: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="108"/> <source>Description: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="113"/> <source>Created: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/BookmarkWidget.cpp" line="118"/> <source>Visited: %1</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarksBarDialog</name> <message> <location filename="../../src/ui/BookmarksBarDialog.ui" line="14"/> <source>Edit Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksBarDialog.ui" line="22"/> <source>Folder:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksBarDialog.ui" line="35"/> <source>Name:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarksComboBoxWidget</name> <message> <location filename="../../src/ui/BookmarksComboBoxWidget.cpp" line="50"/> <source>Folder Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksComboBoxWidget.cpp" line="50"/> <source>Select name of new folder:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarksContentsWidget</name> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="85"/> <source>Address:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="92"/> <source>Title:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="99"/> <source>Description:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="115"/> <source>Keyword:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="133"/> <source>Properties</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="143"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.ui" line="150"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="45"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="165"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="202"/> <source>Add Folder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="46"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="166"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="201"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="203"/> <source>Add Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="47"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="167"/> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="204"/> <source>Add Separator</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="161"/> <source>Empty Trash</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="173"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="174"/> <source>Open in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="175"/> <source>Open in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="177"/> <source>Open in New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="178"/> <source>Open in New Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="213"/> <source>Restore Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="221"/> <source>Properties…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="326"/> <source>Bookmarks Manager</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarksImporterWidget</name> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="17"/> <source>Remove existing bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="51"/> <source>Import into folder:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="70"/> <source>New</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="81"/> <source>Allow to duplicate already existing bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="107"/> <source>Import into subfolder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="120"/> <source>Leave empty to import into main folder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/BookmarksImporterWidget.ui" line="127"/> <source>Subfolder name:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::BookmarksModel</name> <message> <location filename="../../src/core/BookmarksModel.cpp" line="177"/> <source>Notes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="177"/> <source>Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="182"/> <source>Trash</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="194"/> <source>Failed to open notes file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="194"/> <source>Failed to open bookmarks file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="218"/> <source>Failed to load notes file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="218"/> <source>Failed to load bookmarks file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="220"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="220"/> <source>Failed to load notes file.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/BookmarksModel.cpp" line="220"/> <source>Failed to load bookmarks file.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::CacheContentsWidget</name> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="100"/> <source>Address:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="110"/> <source>Type:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="120"/> <source>Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="130"/> <source>Last Modified:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="140"/> <source>Expires:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="150"/> <source>Location:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="171"/> <source>Preview</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.ui" line="210"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="116"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="116"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="116"/> <source>Size</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="116"/> <source>Last Modified</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="116"/> <source>Expires</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="389"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="390"/> <source>Open in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="391"/> <source>Open in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="393"/> <source>Open in New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="394"/> <source>Open in New Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="396"/> <source>Copy Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="398"/> <source>Remove Entry</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="403"/> <source>Remove All Entries from This Domain</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="465"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cache/CacheContentsWidget.cpp" line="596"/> <source>Cache</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ClearHistoryDialog</name> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="14"/> <source>Clear History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="35"/> <source>Period to Clear:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="42"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="45"/> <source> h</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="61"/> <source>Clear browsing history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="68"/> <source>Clear cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="78"/> <source>Clear forms History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="85"/> <source>Clear downloads history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="95"/> <source>Clear search history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="102"/> <source>Clear caches</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="112"/> <source>Clear websites storage data</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.ui" line="122"/> <source>Clear passwords</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ClearHistoryDialog.cpp" line="53"/> <source>Clear Now</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ConfigurationContentsWidget</name> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="83"/> <source>Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="83"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="83"/> <source>Value</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="262"/> <source>Copy Option Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="263"/> <source>Copy Option Value</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="265"/> <source>Restore Default Value</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/configuration/ConfigurationContentsWidget.cpp" line="272"/> <source>Configuration Manager</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ConsoleWidget</name> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="35"/> <source>All tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="40"/> <source>Current tab only</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="45"/> <source>Current tab and unspecified</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="53"/> <location filename="../../src/ui/ConsoleWidget.cpp" line="103"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="66"/> <location filename="../../src/ui/ConsoleWidget.cpp" line="107"/> <source>Security</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="79"/> <location filename="../../src/ui/ConsoleWidget.cpp" line="111"/> <source>JS</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="92"/> <location filename="../../src/ui/ConsoleWidget.cpp" line="115"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="121"/> <source>Clear</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.ui" line="147"/> <source>Filter…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ConsoleWidget.cpp" line="223"/> <source>Copy</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ContentBlockingDialog</name> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="14"/> <source>Content Blocking</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="26"/> <source>Profiles (AdBlock Plus compatible)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="60"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="70"/> <source>Edit</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="80"/> <source>Update</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.ui" line="90"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.cpp" line="48"/> <source>Title</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.cpp" line="48"/> <source>Update Interval</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingDialog.cpp" line="48"/> <source>Last Update</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ContentBlockingIntervalDelegate</name> <message numerus="yes"> <location filename="../../src/ui/preferences/ContentBlockingIntervalDelegate.cpp" line="36"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingIntervalDelegate.cpp" line="36"/> <location filename="../../src/ui/preferences/ContentBlockingIntervalDelegate.cpp" line="63"/> <source>Never</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ContentBlockingIntervalDelegate.cpp" line="62"/> <source> day(s)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ContentBlockingProfile</name> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="48"/> <source>(Unknown)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ContentsDialog</name> <message> <location filename="../../src/ui/ContentsDialog.cpp" line="70"/> <source>Close</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::CookiesContentsWidget</name> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="99"/> <source>Domain:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="112"/> <source>Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="125"/> <source>Value:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="138"/> <source>Expires:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="151"/> <source>MM.dd.yyyy HH:mm</source> <comment>Date and time format</comment> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="173"/> <source>Secure</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="180"/> <source>HTTP only</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="195"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="205"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.ui" line="228"/> <source>Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="273"/> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="292"/> <source>Question</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="274"/> <source>You are about to delete %n cookies.</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="275"/> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="294"/> <source>Do you want to continue?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="293"/> <source>You are about to delete all cookies.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="314"/> <source>Remove Cookie</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="317"/> <source>Remove All Cookies from This Domain…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="320"/> <source>Remove All Cookies…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/cookies/CookiesContentsWidget.cpp" line="449"/> <source>Cookies Manager</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::FilePathWidget</name> <message> <location filename="../../src/ui/FilePathWidget.cpp" line="36"/> <source>Browse…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/FilePathWidget.cpp" line="61"/> <source>Select File</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/FilePathWidget.cpp" line="61"/> <source>Select Directory</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::FreeDesktopOrgPlatformIntegration</name> <message> <location filename="../../src/modules/platforms/freedesktoporg/FreeDesktopOrgPlatformIntegration.cpp" line="195"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/freedesktoporg/FreeDesktopOrgPlatformIntegration.cpp" line="199"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/freedesktoporg/FreeDesktopOrgPlatformIntegration.cpp" line="203"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/freedesktoporg/FreeDesktopOrgPlatformIntegration.cpp" line="216"/> <source>Notification</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::GoBackActionWidget</name> <message> <location filename="../../src/ui/toolbars/GoBackActionWidget.cpp" line="63"/> <location filename="../../src/ui/toolbars/GoBackActionWidget.cpp" line="87"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::GoForwardActionWidget</name> <message> <location filename="../../src/ui/toolbars/GoForwardActionWidget.cpp" line="63"/> <location filename="../../src/ui/toolbars/GoForwardActionWidget.cpp" line="87"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::HistoryContentsWidget</name> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Today</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Yesterday</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Earlier This Week</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Previous Week</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Earlier This Month</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Earlier This Year</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="44"/> <source>Older</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="52"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="52"/> <source>Title</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="52"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="246"/> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="280"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="400"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="401"/> <source>Open in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="402"/> <source>Open in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="404"/> <source>Open in New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="405"/> <source>Open in New Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="407"/> <source>Add to Bookmarks…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="408"/> <source>Copy Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="410"/> <source>Remove Entry</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="411"/> <source>Remove All Entries from This Domain</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/history/HistoryContentsWidget.cpp" line="444"/> <source>History</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::HtmlBookmarksImporter</name> <message> <location filename="../../src/modules/importers/html/HtmlBookmarksImporter.cpp" line="170"/> <source>HTML Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/html/HtmlBookmarksImporter.cpp" line="175"/> <source>Imports bookmarks from HTML file (Netscape format).</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/html/HtmlBookmarksImporter.cpp" line="185"/> <source>HTML files (*.htm *.html)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ImagePropertiesDialog</name> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="14"/> <source>Image Properties</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="22"/> <source>Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="29"/> <source>Type:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="36"/> <source>File Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="43"/> <source>Address:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="50"/> <source>Alternative Text:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.ui" line="57"/> <source>Long Description:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="36"/> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="37"/> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="38"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="65"/> <source>%1 GB (%2 bytes)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="69"/> <source>%1 MB (%2 bytes)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="74"/> <source>%1 KB (%2 bytes)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="79"/> <source>%1 B</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="95"/> <source>%1 x %2 pixels @ %3 bits per pixel in %n frames</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="99"/> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="106"/> <source>%1 x %2 pixels @ %3 bits per pixel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImagePropertiesDialog.cpp" line="110"/> <source>%1 x %2 pixels</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ImportDialog</name> <message> <location filename="../../src/ui/ImportDialog.ui" line="22"/> <source>Source:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImportDialog.cpp" line="96"/> <location filename="../../src/ui/ImportDialog.cpp" line="113"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImportDialog.cpp" line="96"/> <source>Unable to import selected type.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ImportDialog.cpp" line="113"/> <source>Failed to open file for reading.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::JavaScriptPreferencesDialog</name> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="14"/> <source>JavaScript Options</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="26"/> <source>Allow moving and resizing of windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="39"/> <source>Allow changing of status field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="49"/> <source>Allow script to hide address bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="56"/> <source>Allow access to clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="63"/> <source>Allow to disable context menu</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="70"/> <source>Allow to open windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.ui" line="79"/> <source>Allow to close windows:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.cpp" line="37"/> <source>Ask</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.cpp" line="38"/> <source>Always</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/JavaScriptPreferencesDialog.cpp" line="39"/> <source>Never</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::LocalListingNetworkReply</name> <message> <location filename="../../src/core/LocalListingNetworkReply.cpp" line="61"/> <source>Directory Contents</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/LocalListingNetworkReply.cpp" line="64"/> <source>Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/LocalListingNetworkReply.cpp" line="65"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/LocalListingNetworkReply.cpp" line="66"/> <source>Size</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/LocalListingNetworkReply.cpp" line="67"/> <source>Date</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::LocaleDialog</name> <message> <location filename="../../src/ui/LocaleDialog.ui" line="14"/> <source>Switch Application Language</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/LocaleDialog.ui" line="22"/> <source>Language:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/LocaleDialog.ui" line="32"/> <source>Custom path:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/LocaleDialog.ui" line="43"/> <source>System</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/LocaleDialog.ui" line="48"/> <source>Custom</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::MainWindow</name> <message> <location filename="../../src/ui/MainWindow.ui" line="19"/> <source>Console</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="480"/> <source>Open File</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="740"/> <source>&lt;b&gt;Otter %1&lt;/b&gt;&lt;br&gt;Web browser controlled by the user, not vice-versa.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="741"/> <source>Web backend: %1 %2.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="745"/> <source>SSL library version: %1.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="749"/> <source>SSL library not available.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="838"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/MainWindow.cpp" line="838"/> <source>You already have this address in your bookmarks. Do you want to continue?</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::Menu</name> <message> <location filename="../../src/ui/Menu.cpp" line="96"/> <source>Import Opera Bookmarks…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="97"/> <source>Import HTML Bookmarks…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="99"/> <source>Import Opera Notes…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="184"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="185"/> <source>Open in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="186"/> <source>Open in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="188"/> <source>Open in New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="189"/> <source>Open in New Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="311"/> <source>Open All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="319"/> <source>This Folder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="338"/> <location filename="../../src/ui/Menu.cpp" line="486"/> <location filename="../../src/ui/Menu.cpp" line="501"/> <location filename="../../src/ui/Menu.cpp" line="518"/> <location filename="../../src/ui/Menu.cpp" line="568"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="376"/> <source>Auto Detect</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="431"/> <source>Clear</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="441"/> <source>Window - %1</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/ui/Menu.cpp" line="501"/> <source>%1 (%n tab(s))</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/ui/Menu.cpp" line="530"/> <source>Add New</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="531"/> <source>Add Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="532"/> <source>Add Bookmarks Bar…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="537"/> <source>Reset to Defaults…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="556"/> <source>Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Menu.cpp" line="578"/> <source>Custom</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::MenuButtonWidget</name> <message> <location filename="../../src/ui/toolbars/MenuButtonWidget.cpp" line="36"/> <source>Menu</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::NetworkManager</name> <message> <location filename="../../src/core/NetworkManager.cpp" line="127"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NetworkManager.cpp" line="127"/> <source>SSL errors occured: %1 Do you want to continue?</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::NetworkManagerFactory</name> <message> <location filename="../../src/core/NetworkManagerFactory.cpp" line="269"/> <source>Custom</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NetworkManagerFactory.cpp" line="284"/> <source>Default</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::NetworkProxyFactory</name> <message> <location filename="../../src/core/NetworkProxyFactory.cpp" line="64"/> <source>Failed to load proxy auto-config (PAC): %1</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::NotesContentsWidget</name> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.ui" line="29"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.ui" line="100"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.ui" line="107"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="46"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="155"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="186"/> <source>Add Folder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="47"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="185"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="187"/> <source>Add Note</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="48"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="157"/> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="188"/> <source>Add Separator</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="58"/> <source>Add note…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="103"/> <source>Select Folder Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="103"/> <source>Enter folder name:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="151"/> <source>Empty Trash</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="156"/> <source>Add Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="171"/> <source>Open source page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="197"/> <source>Restore Note</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="372"/> <source>Notes Manager</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::NotificationDialog</name> <message> <location filename="../../src/ui/NotificationDialog.cpp" line="73"/> <source>Close</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::OpenAddressDialog</name> <message> <location filename="../../src/ui/OpenAddressDialog.ui" line="14"/> <source>Go to Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/OpenAddressDialog.ui" line="20"/> <source>Enter a web address or choose one from the list:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::OpenBookmarkDialog</name> <message> <location filename="../../src/ui/OpenBookmarkDialog.ui" line="14"/> <source>Go to Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/OpenBookmarkDialog.ui" line="20"/> <source>Enter the keyword of bookmark:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::OperaBookmarksImporter</name> <message> <location filename="../../src/modules/importers/opera/OperaBookmarksImporter.cpp" line="88"/> <source>Opera Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/opera/OperaBookmarksImporter.cpp" line="93"/> <source>Imports bookmarks from Opera Browser version 12 or earlier</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/opera/OperaBookmarksImporter.cpp" line="103"/> <source>Opera bookmarks files (bookmarks.adr)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::OperaNotesImporter</name> <message> <location filename="../../src/modules/importers/opera/OperaNotesImporter.cpp" line="109"/> <source>Import into folder:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/opera/OperaNotesImporter.cpp" line="117"/> <source>Opera Notes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/opera/OperaNotesImporter.cpp" line="122"/> <source>Imports notes from Opera Browser version 12 or earlier</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/importers/opera/OperaNotesImporter.cpp" line="132"/> <source>Opera notes files (notes.adr)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::OptionWidget</name> <message> <location filename="../../src/ui/OptionWidget.cpp" line="122"/> <source>Defaults</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/OptionWidget.cpp" line="125"/> <source>Save</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PasswordBarWidget</name> <message> <location filename="../../src/modules/windows/web/PasswordBarWidget.ui" line="61"/> <source>Save</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PasswordBarWidget.ui" line="68"/> <source>Cancel</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PermissionBarWidget</name> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.ui" line="62"/> <source>Allow this time</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.ui" line="67"/> <source>Always allow</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.ui" line="72"/> <source>Always deny</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.ui" line="80"/> <source>OK</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.ui" line="87"/> <source>Cancel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="40"/> <source>%1 wants access to your location.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="45"/> <source>%1 wants to access your microphone.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="50"/> <source>%1 wants to access your camera.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="55"/> <source>%1 wants to access your microphone and camera.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="60"/> <source>%1 wants to show notifications.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="65"/> <source>%1 wants to lock mouse pointer.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/PermissionBarWidget.cpp" line="70"/> <source>Invalid permission request from %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PlatformIntegration</name> <message> <location filename="../../src/core/PlatformIntegration.cpp" line="105"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/PlatformIntegration.cpp" line="105"/> <source>Failed to install update.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesAdvancedPageWidget</name> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="27"/> <source>Notifications</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="32"/> <source>Address Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="37"/> <source>Content</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="42"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="47"/> <source>Security</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="52"/> <source>Keyboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="57"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="78"/> <source>Events</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="118"/> <source>Play sound:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="133"/> <source>Show notification</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="140"/> <source>Mark taskbar entry</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="156"/> <source>Options</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="163"/> <source>Prefer native notifications</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="193"/> <source>Suggestions</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="202"/> <source>Suggest bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="212"/> <source>Suggest history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="222"/> <source>Suggest search results</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="254"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="344"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="961"/> <source>General</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="261"/> <source>Enable images</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="270"/> <source>Enable JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="277"/> <source>JavaScript Options…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="286"/> <source>Enable Java</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="295"/> <source>Plugins:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="309"/> <source>User style sheet:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="351"/> <source>Send referrer information</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="360"/> <source>User Agent:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="373"/> <source>Manage…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="388"/> <source>Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="397"/> <source>Mode:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="411"/> <source>No proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="416"/> <source>System configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="421"/> <source>Manual configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="426"/> <source>Automatic configuration (PAC)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="528"/> <source>Port</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="535"/> <source>Protocol</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="542"/> <source>Servers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="549"/> <source>FTP</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="556"/> <source>SOCKS5</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="563"/> <source>HTTP</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="577"/> <source>HTTPS</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="591"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="629"/> <source>Path to PAC file:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="646"/> <source>Use system authentication</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="676"/> <source>SSL ciphers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="718"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="841"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="728"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="871"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="753"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="896"/> <source>Move Up</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="779"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="922"/> <source>Move Down</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="802"/> <source>Keyboard Shortcuts</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="851"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="861"/> <source>Clone</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="935"/> <source>Enable single key shortcuts</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.ui" line="977"/> <source>Show tray icon</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="55"/> <source>Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="55"/> <source>Description</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="87"/> <source>Enabled</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="88"/> <source>On demand</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="89"/> <source>Disabled</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="100"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="356"/> <source>Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="107"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="208"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="362"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="472"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="476"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="502"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="533"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="559"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="653"/> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="834"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="220"/> <source>New…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="221"/> <source>Readd</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="307"/> <source>WAV files (*.wav)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="579"/> <source>Question</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="580"/> <source>Do you really want to remove this profile?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesAdvancedPageWidget.cpp" line="589"/> <source>Delete profile permanently</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesContentPageWidget</name> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="23"/> <source>Blocking</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="38"/> <source>Pop-ups:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="52"/> <source>Block all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="57"/> <source>Open all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="62"/> <source>Open all pop-ups in background</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="78"/> <source>Zoom</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="90"/> <source>Default zoom:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="100"/> <source>%</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="118"/> <source>Zoom text only</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="131"/> <source>Fonts</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="172"/> <source>Style</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="177"/> <source>Font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="182"/> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="321"/> <source>Preview</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="192"/> <source>Default proportional font size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="202"/> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="228"/> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="257"/> <source> px</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="218"/> <source>Default fixed-width font size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="244"/> <source>Minimum font size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="254"/> <source>None</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="278"/> <source>Colors</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.ui" line="316"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Standard font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Fixed-width font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Serif font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Sans-serif font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Cursive font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="45"/> <source>Fantasy font</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="59"/> <source>The quick brown fox jumps over the lazy dog</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="71"/> <source>Background Color</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="71"/> <source>Text Color</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="71"/> <source>Link Color</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesContentPageWidget.cpp" line="71"/> <source>Visited Link Color</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesDialog</name> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="17"/> <source>Preferences</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="27"/> <source>General</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="33"/> <source>Content</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="39"/> <source>Privacy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="45"/> <source>Search</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="51"/> <source>Advanced</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/PreferencesDialog.ui" line="62"/> <source>All Settings</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesGeneralPageWidget</name> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="23"/> <source>Startup</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="35"/> <source>Startup behavior:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="48"/> <source>Home page:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="76"/> <source>Use Current Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="83"/> <source>Use Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="90"/> <source>Restore to Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="107"/> <source>Downloads</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="119"/> <source>Save files to:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="134"/> <source>Always ask me where to save files</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="147"/> <source>Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="154"/> <source>Open new windows in a new tab instead</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="161"/> <source>Delay loading of tabs until selected</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="168"/> <source>Reuse current tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="175"/> <source>Open new tab next to active</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="184"/> <source>When closing tab:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="198"/> <source>Activate the last active tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="203"/> <source>Activate the next tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="208"/> <source>Activate the first tab opened from current tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="224"/> <source>Language</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="233"/> <source>Preferred Webpage Language:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="258"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="275"/> <source>System Defaults</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.ui" line="287"/> <source>Set as a default browser</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="42"/> <source>Continue previous session</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="43"/> <source>Show startup dialog</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="44"/> <source>Show home page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="45"/> <source>Show start page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="46"/> <source>Show empty page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesGeneralPageWidget.cpp" line="74"/> <source>Run Otter Browser with administrator rights to set it as a default browser.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesPrivacyPageWidget</name> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="23"/> <source>Tracking</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="32"/> <source>Do Not Track:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="57"/> <source>History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="64"/> <source>Private mode</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="107"/> <source>Remember browsing history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="114"/> <source>Remember downloads history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="124"/> <source>Remember search history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="136"/> <source>Remember form history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="159"/> <source>Template…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="170"/> <source>Enable cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="215"/> <source>Accept cookies:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="228"/> <source>Keep until:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="241"/> <source>Accept third-party cookies:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="268"/> <source>Clear history when application closes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="288"/> <source>Settings…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="308"/> <source>Passwords</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="320"/> <source>Remember passwords</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="343"/> <source>Manage…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="357"/> <source>Use a master password</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.ui" line="380"/> <source>Change…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="36"/> <source>Inform websites that I do not want to be tracked</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="37"/> <source>Inform websites that I allow tracking</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="38"/> <source>Do not inform websites about my preference</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="49"/> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="64"/> <source>Always</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="50"/> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="65"/> <source>Only existing</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="51"/> <source>Only read existing</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="52"/> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="66"/> <source>Never</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="57"/> <source>Expires</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="58"/> <source>Current session is closed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesPrivacyPageWidget.cpp" line="59"/> <source>Always ask</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::PreferencesSearchPageWidget</name> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="21"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="63"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="73"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="83"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="108"/> <source>Move Up</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="134"/> <source>Move Down</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.ui" line="147"/> <source>Enable search suggestions</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="48"/> <source>Name</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="48"/> <source>Keyword</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="84"/> <source>New…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="85"/> <source>Readd</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="152"/> <source>New Search Engine</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="286"/> <source>Question</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="287"/> <source>Do you really want to remove this search engine?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="296"/> <source>Delete search engine permanently</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/PreferencesSearchPageWidget.cpp" line="366"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ProgressBarWidget</name> <message> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="62"/> <source>Document: %p%</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="123"/> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="147"/> <source>Time: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="190"/> <source>Elements: %1/%2</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="191"/> <source>Total: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/ProgressBarWidget.cpp" line="192"/> <source>Speed: %1</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::QtWebKitNetworkManager</name> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="107"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="129"/> <source>Waiting for authentication…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="180"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="180"/> <source>SSL errors occured, do you want to continue?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="184"/> <source>Do not show this message again</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="269"/> <source>Receiving data from %1…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="311"/> <source>Completed request to %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="508"/> <source>Sending request to %1…</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::QtWebKitPage</name> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="186"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="324"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="361"/> <source>JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="187"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="325"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="362"/> <source>Disable JavaScript popups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="274"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="287"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="467"/> <source>Question</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="274"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="288"/> <source>Are you sure that you want to send form data again?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="274"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="289"/> <source>Do you want to resend data?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="275"/> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="293"/> <source>Do not show this message again</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="403"/> <source>Open File</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="425"/> <source>Error %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="455"/> <source>%1 error #%2: %3</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="467"/> <source>The script on this page appears to have a problem.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPage.cpp" line="467"/> <source>Do you want to stop the script?</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::QtWebKitPluginWidget</name> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitPluginWidget.cpp" line="32"/> <source>Click to load content (%1) handled by plugin from: %2</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::QtWebKitWebBackend</name> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebBackend.cpp" line="179"/> <source>WebKit Backend</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebBackend.cpp" line="184"/> <source>Backend utilizing QtWebKit module</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::QtWebKitWebWidget</name> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="298"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="298"/> <source>Failed to open file for writing.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="318"/> <source>file</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="329"/> <source>Failed to save image: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="458"/> <source>Print Preview</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="517"/> <source>JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="517"/> <source>Webpage wants to close this tab, do you want to allow to close it?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="518"/> <source>Do not show this message again</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="638"/> <source>Undo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="638"/> <source>Undo: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="643"/> <source>Redo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="643"/> <source>Redo: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="1368"/> <source>Close</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="1667"/> <source>Blank Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp" line="1680"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ReloadTimeDialog</name> <message> <location filename="../../src/ui/ReloadTimeDialog.ui" line="14"/> <source>Automatic Page Reload</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ReloadTimeDialog.ui" line="29"/> <source>minutes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ReloadTimeDialog.ui" line="46"/> <source>seconds</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SaveSessionDialog</name> <message> <location filename="../../src/ui/SaveSessionDialog.ui" line="14"/> <source>Save Session</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.ui" line="22"/> <source>Session title:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.ui" line="32"/> <source>Session identifier:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.ui" line="50"/> <source>Store only current window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.cpp" line="72"/> <source>Question</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.cpp" line="72"/> <source>Session with specified indentifier already exists. Do you want to overwrite it?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.cpp" line="85"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SaveSessionDialog.cpp" line="85"/> <source>Failed to save session.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SearchBarWidget</name> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="35"/> <source>Find…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="45"/> <source>Find Next</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="59"/> <source>Find Previous</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="86"/> <source>Highlight</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="105"/> <source>Case Sensitive</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/SearchBarWidget.ui" line="118"/> <source>Close</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SearchPropertiesDialog</name> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="14"/> <source>Edit Search Engine</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="39"/> <source>Change Icon…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="58"/> <source>Title:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="68"/> <source>Description:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="81"/> <source>Keyword:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="94"/> <source>Encoding:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="113"/> <source>Set as Default Search Engine</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="124"/> <source>Results Query</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="132"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="240"/> <source>Address:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="145"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="256"/> <source>Query:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="160"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="268"/> <source>POST Method</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="201"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="309"/> <source>Data encoding (enctype):</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="212"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="320"/> <source>application/x-www-form-urlencoded</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="217"/> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="325"/> <source>multipart/form-data</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.ui" line="229"/> <source>Suggestions Query</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.cpp" line="97"/> <source>Select Icon</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.cpp" line="97"/> <source>Images (*.png *.jpg *.bmp *.gif *.ico)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.cpp" line="145"/> <source>Placeholders</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.cpp" line="146"/> <source>Search Terms</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SearchPropertiesDialog.cpp" line="147"/> <source>Language</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SearchWidget</name> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="94"/> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="321"/> <source>Search using %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="200"/> <source>Undo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="201"/> <source>Redo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="203"/> <source>Cut</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="204"/> <source>Copy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="205"/> <source>Paste</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="206"/> <source>Paste and Go</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="207"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="209"/> <source>Copy to Note</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="211"/> <source>Clear All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/toolbars/SearchWidget.cpp" line="212"/> <source>Select All</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SearchesManager</name> <message> <location filename="../../src/core/SearchesManager.cpp" line="169"/> <source>Manage Search Engines…</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SessionsManager</name> <message> <location filename="../../src/core/SessionsManager.cpp" line="214"/> <source>Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/SessionsManager.cpp" line="214"/> <location filename="../../src/core/SessionsManager.cpp" line="279"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SessionsManagerDialog</name> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="14"/> <source>Sessions Manager</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="62"/> <source>Title</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="67"/> <source>Identifier</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="72"/> <source>Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="82"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="89"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.ui" line="113"/> <source>Open session in current window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="44"/> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="67"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="102"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="102"/> <source>This session was not saved correctly. Are you sure that you want to restore this session anyway?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="119"/> <source>Confirm</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="119"/> <source>Are you sure that you want to delete session %1?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="127"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SessionsManagerDialog.cpp" line="127"/> <source>Failed to delete session.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ShortcutsProfileDialog</name> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="14"/> <source>Profile Configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="24"/> <source>Actions</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="30"/> <source>Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="91"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="101"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="129"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="135"/> <source>Title:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="145"/> <source>Description:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="155"/> <source>Version:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.ui" line="165"/> <source>Author:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.cpp" line="41"/> <source>Action</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/preferences/ShortcutsProfileDialog.cpp" line="129"/> <source>Shortcut</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SidebarWidget</name> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="216"/> <source>Add Web Panel…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="277"/> <source>Add web panel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="277"/> <source>Input address of web page to be shown in panel:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="431"/> <source>Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="436"/> <source>Cache</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="441"/> <source>Cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="446"/> <source>Configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="451"/> <source>History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="456"/> <source>Notes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SidebarWidget.cpp" line="461"/> <source>Transfers</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::SourceViewerWebWidget</name> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="87"/> <source>Failed to save file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="89"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="89"/> <source>Failed to save file.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="116"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="116"/> <source>The document has been modified. Do you want to save your changes or discard them?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="286"/> <source>Show Line Numbers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/SourceViewerWebWidget.cpp" line="476"/> <source>Source Viewer</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::StartPageModel</name> <message> <location filename="../../src/modules/windows/web/StartPageModel.cpp" line="175"/> <location filename="../../src/modules/windows/web/StartPageModel.cpp" line="176"/> <source>Add Tile…</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::StartPagePreferencesDialog</name> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="14"/> <source>Start Page Preferences</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="20"/> <source>Use custom background image</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="66"/> <source>Scaling mode:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="79"/> <source>Image path:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="96"/> <source>Columns per row:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="106"/> <source>Automatic</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="113"/> <source>Zoom level:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="123"/> <source>%</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="141"/> <source>Show search field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.ui" line="148"/> <source>Show tile to add new entries</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.cpp" line="39"/> <source>Images (*.png *.jpg *.bmp *.gif)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.cpp" line="40"/> <source>Best fit</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.cpp" line="41"/> <source>Center</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.cpp" line="42"/> <source>Stretch</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPagePreferencesDialog.cpp" line="43"/> <source>Tile</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::StartPageWidget</name> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="357"/> <source>Add Tile</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="510"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="512"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="516"/> <source>Reload</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="520"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="524"/> <source>Configure…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/StartPageWidget.cpp" line="525"/> <source>Add Tile…</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::StartupDialog</name> <message> <location filename="../../src/ui/StartupDialog.ui" line="14"/> <location filename="../../src/ui/StartupDialog.ui" line="27"/> <source>Welcome to Otter</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.ui" line="34"/> <source>Continue session</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.ui" line="104"/> <source>Begin with home page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.ui" line="114"/> <source>Begin with start page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.ui" line="124"/> <source>Begin with blank page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.cpp" line="43"/> <location filename="../../src/ui/StartupDialog.cpp" line="50"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.cpp" line="96"/> <source>Window %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/StartupDialog.cpp" line="200"/> <source>Default</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::TabBarWidget</name> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="163"/> <source>Arrange</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="173"/> <source>Switch tabs using the mouse wheel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="190"/> <source>Customize</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="477"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="962"/> <source>Close Tab</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ToolBarDialog</name> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="14"/> <source>Edit Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="26"/> <source>Options</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="35"/> <source>Visibility:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="46"/> <source>Always visible</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="51"/> <source>Always hidden</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="56"/> <source>Visible only when needed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="64"/> <source>Button style:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="75"/> <source>Follow style</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="80"/> <source>Only icon</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="85"/> <source>Only text</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="90"/> <source>Text beside icon</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="95"/> <source>Text under icon</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="103"/> <source>Icon size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="113"/> <source>Auto</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="116"/> <location filename="../../src/ui/ToolBarDialog.ui" line="142"/> <source> px</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="129"/> <source>Maximum size of item:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="139"/> <source>No limit</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="159"/> <source>Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="195"/> <source>Actions</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="231"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="241"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="250"/> <source>Current entries:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="358"/> <source>Available entries:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.ui" line="368"/> <location filename="../../src/ui/ToolBarDialog.ui" line="378"/> <source>Filter…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="45"/> <source>Custom Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="212"/> <source>--- separator ---</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="216"/> <source>--- spacer ---</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="220"/> <source>Address Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="224"/> <source>List of Closed Windows and Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="228"/> <source>Menu Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="232"/> <source>Menu Button</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="236"/> <source>Sidebar Panel Chooser</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="240"/> <source>Search Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="244"/> <source>Status Message Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="248"/> <source>Tab Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="252"/> <source>Zoom Slider</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="260"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="265"/> <source>Invalid Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarDialog.cpp" line="274"/> <location filename="../../src/ui/ToolBarDialog.cpp" line="286"/> <source>Invalid Entry</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ToolBarDragAreaWidget</name> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="53"/> <source>Drag to move toolbar</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ToolBarWidget</name> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="173"/> <source>Switch tabs using the mouse wheel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="190"/> <source>Arrange</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="460"/> <source>Closed Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="556"/> <source>Customize</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="558"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="559"/> <source>Configure…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="561"/> <source>Reset to Defaults…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="578"/> <source>Remove…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/ToolBarWidget.cpp" line="582"/> <source>Toolbars</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ToolBarsManager</name> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="318"/> <source>Reset Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="318"/> <source>Do you really want to reset this toolbar to default configuration?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="358"/> <source>Remove Toolbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="358"/> <source>Do you really want to remove this toolbar?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="372"/> <source>Reset Toolbars</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="372"/> <source>Do you really want to reset all toolbars to default configuration?</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::Transfer</name> <message> <location filename="../../src/core/Transfer.cpp" line="263"/> <location filename="../../src/core/Transfer.cpp" line="299"/> <source>Question</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Transfer.cpp" line="263"/> <source>File with that name already exists. Do you want to overwite it?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Transfer.cpp" line="299"/> <source>File with the same name already exists. Do you want to overwrite it? %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Transfer.cpp" line="607"/> <source>file</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::TransferDialog</name> <message> <location filename="../../src/ui/TransferDialog.ui" line="14"/> <source>Opening unknown file</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="22"/> <source>Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="29"/> <source>Type:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="36"/> <source>Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="43"/> <source>From:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="50"/> <source>Open with:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.ui" line="107"/> <source>Remember choice for this file type</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="41"/> <source>unknown file</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="63"/> <source>Default Application</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="69"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="79"/> <source>Opening %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="152"/> <source>unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TransferDialog.cpp" line="156"/> <source>%1 (download completed)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/ui/TransferDialog.cpp" line="162"/> <source>%1 (%n% downloaded)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> </context> <context> <name>Otter::TransfersContentsWidget</name> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="31"/> <source>Quick Download…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="126"/> <source>Source:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="136"/> <source>Target:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="146"/> <source>Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="156"/> <source>Downloaded:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="163"/> <source>Progress:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="196"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="402"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="436"/> <source>Stop</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.ui" line="206"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="403"/> <source>Redownload</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Filename</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Size</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Progress</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Time</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Speed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Started</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="50"/> <source>Finished</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="157"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="157"/> <source>This transfer is still running. Do you really want to remove it?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="244"/> <source>&lt;div style=&quot;white-space:pre;&quot;&gt;Source: %1 Target: %2 Size: %3 Downloaded: %4 Progress: %5&lt;/div&gt;</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="244"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="450"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="451"/> <source>%1 (%n B)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="379"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="385"/> <source>Open With</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="389"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="400"/> <source>Open Folder</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="402"/> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="431"/> <source>Resume</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="405"/> <source>Copy Transfer Information</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="407"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="421"/> <source>Clear Finished Transfers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/transfers/TransfersContentsWidget.cpp" line="549"/> <source>Transfers Manager</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::TransfersManager</name> <message> <location filename="../../src/core/TransfersManager.cpp" line="151"/> <source>Transfer completed: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="268"/> <source>%1 files (*.%2)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="271"/> <source>All files (*)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="273"/> <source>Save File</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="292"/> <location filename="../../src/core/TransfersManager.cpp" line="301"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="292"/> <source>Target path is already used by another transfer. Select another one.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/TransfersManager.cpp" line="301"/> <source>Target path is not writable. Select another one.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::TrayIcon</name> <message> <location filename="../../src/ui/TrayIcon.cpp" line="52"/> <location filename="../../src/ui/TrayIcon.cpp" line="128"/> <source>Otter Browser</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TrayIcon.cpp" line="119"/> <source>Show Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TrayIcon.cpp" line="119"/> <source>Hide Windows</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::UpdateCheckerDialog</name> <message> <location filename="../../src/ui/UpdateCheckerDialog.ui" line="14"/> <source>Check for Updates</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.ui" line="20"/> <source>Checking for update…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="51"/> <source>Checking for updates…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="96"/> <source>There are no new updates.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="102"/> <source>Available updates:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="106"/> <source>Details…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="109"/> <source>Download</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="122"/> <source>Version %1 from %2 channel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="132"/> <source>Some of the updates does not contains packages for your platform. Try to check for updates later or visit details page for more info.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="178"/> <source>Downloading:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="193"/> <source>Download finished!</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="194"/> <source>Install</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="196"/> <source>New version of Otter Browser is ready to install. Click Install button to restart browser and install the update or close this dialog to install the update during next browser restart.</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="218"/> <source>Download failed!</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UpdateCheckerDialog.cpp" line="220"/> <source>Check Error Console for more information.</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::UserAgentsManagerDialog</name> <message> <location filename="../../src/ui/UserAgentsManagerDialog.ui" line="14"/> <source>Manage User Agents</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UserAgentsManagerDialog.ui" line="61"/> <source>Add</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UserAgentsManagerDialog.ui" line="71"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UserAgentsManagerDialog.cpp" line="37"/> <source>Title</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UserAgentsManagerDialog.cpp" line="37"/> <source>Value</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/UserAgentsManagerDialog.cpp" line="46"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WebContentsWidget</name> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="415"/> <source>Open all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="416"/> <source>Open pop-ups in background</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="417"/> <source>Block all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="421"/> <source>Enable Images</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="426"/> <source>Enable JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="431"/> <source>Enable Java</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="436"/> <source>Enable Plugins</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="443"/> <source>Enable Cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="447"/> <source>Enable Referrer</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="451"/> <source>Enable Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/web/WebContentsWidget.cpp" line="456"/> <source>Reset Options</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WebWidget</name> <message> <location filename="../../src/ui/WebWidget.cpp" line="250"/> <source>Default Application</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="256"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="342"/> <source>Title: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="342"/> <source>Address: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="593"/> <source>No search engines defined</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="736"/> <source>Open Image in New Tab (Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="736"/> <source>Open Image in New Tab (%1)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="742"/> <source>Open Image in New Background Tab (Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="742"/> <source>Open Image in New Background Tab (%1)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1034"/> <source>30 Minutes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1035"/> <source>1 Hour</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1036"/> <source>2 Hours</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1037"/> <source>6 Hours</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1038"/> <source>Never</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1039"/> <source>Custom…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="1041"/> <source>Page Default</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WebsitePreferencesDialog</name> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="14"/> <source>Website Preferences</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="25"/> <source>Website:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="44"/> <source>Content</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="53"/> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="292"/> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="525"/> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="668"/> <source>Override</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="84"/> <source>Block all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="89"/> <source>Open all pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="94"/> <source>Open all pop-ups in background</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="112"/> <source>Encoding:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="122"/> <source>User style sheet:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="129"/> <source>Plugins:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="139"/> <source>Pop-ups:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="163"/> <source>Enable images</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="177"/> <source>Enable Java</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="211"/> <source>Privacy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="235"/> <source>Keep until:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="278"/> <source>Remember browsing history</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="299"/> <source>Enable cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="324"/> <source>Accept cookies:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="333"/> <source>Do Not Track:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="373"/> <source>Add…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="383"/> <source>Edit…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="393"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="435"/> <source>Accept third-party cookies:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="474"/> <source>Scripting</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="487"/> <source>Enable JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="504"/> <source>Allow script to hide address bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="511"/> <source>Allow moving and resizing of windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="532"/> <source>Allow changing of status field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="569"/> <source>Allow access to clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="583"/> <source>Allow to disable context menu</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="597"/> <source>Allow to open windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="627"/> <source>Allow to close windows:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="638"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="651"/> <source>User Agent:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="691"/> <source>Proxy mode:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="718"/> <source>No proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="723"/> <source>System configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="728"/> <source>Manual configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="733"/> <source>Automatic configuration (PAC)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="846"/> <source>Port</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="853"/> <source>Servers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="860"/> <source>FTP</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="867"/> <source>SOCKS5</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="874"/> <source>HTTP</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="888"/> <source>HTTPS</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="902"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="919"/> <source>Protocol</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="947"/> <source>Path to PAC file:</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.ui" line="964"/> <source>Send referrer information</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="55"/> <source>Auto Detect</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="69"/> <source>Enabled</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="70"/> <source>On demand</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="71"/> <source>Disabled</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="73"/> <source>Ask</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="74"/> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="81"/> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="90"/> <source>Always</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="75"/> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="84"/> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="92"/> <source>Never</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="77"/> <source>Inform websites that I do not want to be tracked</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="78"/> <source>Inform websites that I allow tracking</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="79"/> <source>Do not inform websites about my preference</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="82"/> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="91"/> <source>Only existing</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="83"/> <source>Only read existing</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="86"/> <source>Expires</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="87"/> <source>Current session is closed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="88"/> <source>Always ask</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="95"/> <source>Domain</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="95"/> <source>Path</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="95"/> <source>Value</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="95"/> <source>Expiration date</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="115"/> <source>Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebsitePreferencesDialog.cpp" line="122"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::Window</name> <message> <location filename="../../src/ui/Window.cpp" line="155"/> <source>Print Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Window.cpp" line="168"/> <source>Print Preview</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Window.cpp" line="353"/> <source>Select User Agent</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/Window.cpp" line="353"/> <source>Enter User Agent:</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WindowsManager</name> <message> <location filename="../../src/core/WindowsManager.cpp" line="235"/> <source>Question</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../../src/core/WindowsManager.cpp" line="236"/> <source>You are about to open %n bookmarks.</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../../src/core/WindowsManager.cpp" line="237"/> <source>Do you want to continue?</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/WindowsManager.cpp" line="241"/> <source>Do not show this message again</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/WindowsManager.cpp" line="809"/> <location filename="../../src/core/WindowsManager.cpp" line="862"/> <location filename="../../src/core/WindowsManager.cpp" line="986"/> <source>Empty</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WindowsPlatformIntegration</name> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="156"/> <source>Failed to run command &quot;%1&quot;, file is not executable</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="183"/> <source>Failed to run command &quot;%1&quot; (arguments: &quot;%2&quot;)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="228"/> <source>No valid suffix for given MIME type: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="290"/> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="340"/> <source>Failed to load a valid application path for MIME type %1: %2</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::WorkspaceWidget</name> <message> <location filename="../../src/ui/WorkspaceWidget.cpp" line="515"/> <source>Arrange</source> <translation type="unfinished"/> </message> </context> <context> <name>Otter::ZoomWidget</name> <message> <location filename="../../src/ui/toolbars/ZoomWidget.cpp" line="97"/> <location filename="../../src/ui/toolbars/ZoomWidget.cpp" line="98"/> <source>Zoom %1%</source> <translation type="unfinished"/> </message> </context> <context> <name>actions</name> <message> <location filename="../../src/core/ActionsManager.cpp" line="242"/> <source>File</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="243"/> <source>Sessions</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="244"/> <source>Import and Export</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="245"/> <source>Edit</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="246"/> <source>View</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="247"/> <source>Toolbars</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="248"/> <source>User Agent</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="249"/> <source>Character Encoding</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="250"/> <location filename="../../src/ui/TrayIcon.cpp" line="45"/> <source>History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="251"/> <source>Closed Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="252"/> <location filename="../../src/ui/TrayIcon.cpp" line="43"/> <source>Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="253"/> <source>Tools</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="254"/> <source>Help</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="255"/> <source>Tabs and Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="256"/> <source>Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="257"/> <source>Print</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="258"/> <source>Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="259"/> <source>Frame</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="263"/> <source>New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="264"/> <source>New Private Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="265"/> <source>New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="266"/> <source>New Private Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="267"/> <source>Open…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="268"/> <source>Save…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="269"/> <source>Clone Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="270"/> <location filename="../../src/ui/TabBarWidget.cpp" line="125"/> <source>Pin Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="271"/> <source>Detach Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="272"/> <source>Maximize</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="272"/> <source>Maximize Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="273"/> <source>Minimize</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="273"/> <source>Minimize Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="274"/> <source>Restore</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="274"/> <source>Restore Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="275"/> <source>Stay on Top</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="276"/> <source>Close Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="277"/> <source>Close Other Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="278"/> <source>Close All Private Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="278"/> <source>Close All Private Tabs in Current Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="279"/> <source>Close Private Tabs and Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="280"/> <source>Reopen Previously Closed Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="281"/> <source>Maximize All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="282"/> <source>Minimize All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="283"/> <source>Restore All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="284"/> <source>Cascade</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="285"/> <source>Tile</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="286"/> <source>Close Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="287"/> <source>Manage Sessions…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="288"/> <source>Save Current Session…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="289"/> <location filename="../../src/core/ActionsManager.cpp" line="305"/> <source>Open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="290"/> <source>Open in This Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="291"/> <location filename="../../src/core/ActionsManager.cpp" line="306"/> <source>Open in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="292"/> <location filename="../../src/core/ActionsManager.cpp" line="307"/> <source>Open in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="293"/> <source>Open in New Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="294"/> <source>Open in New Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="295"/> <source>Open in New Private Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="296"/> <source>Open in New Private Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="297"/> <source>Open in New Private Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="298"/> <source>Open in New Private Background Window</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="299"/> <location filename="../../src/core/ActionsManager.cpp" line="308"/> <location filename="../../src/core/ActionsManager.cpp" line="399"/> <source>Open with…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="299"/> <source>Open link with external application</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="300"/> <source>Copy Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="301"/> <location filename="../../src/ui/WebWidget.cpp" line="673"/> <source>Bookmark Link…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="302"/> <source>Save Link Target As…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="303"/> <source>Save to Downloads</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="304"/> <source>Go to This Address</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="305"/> <source>Open Frame in This Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="306"/> <source>Open Frame in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="307"/> <source>Open Frame in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="308"/> <source>Open frame with external application</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="309"/> <source>Copy Frame Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="310"/> <location filename="../../src/core/ActionsManager.cpp" line="335"/> <location filename="../../src/core/ActionsManager.cpp" line="336"/> <source>Reload</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="310"/> <source>Reload Frame</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="311"/> <source>View Frame Source</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="312"/> <source>Open Image In New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="313"/> <location filename="../../src/ui/WebWidget.cpp" line="742"/> <source>Open Image in New Background Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="314"/> <source>Save Image…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="315"/> <source>Copy Image to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="316"/> <source>Copy Image Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="317"/> <source>Reload Image</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="318"/> <source>Image Properties…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="319"/> <source>Save Media…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="320"/> <source>Copy Media Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="321"/> <source>Show Controls</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="322"/> <source>Looping</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="323"/> <location filename="../../src/ui/WebWidget.cpp" line="805"/> <source>Play</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="324"/> <location filename="../../src/ui/WebWidget.cpp" line="812"/> <source>Mute</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="325"/> <source>Go</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="326"/> <source>Back</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="327"/> <source>Forward</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="328"/> <source>Go to Page or Search</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="329"/> <source>Go to Home Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="330"/> <source>Go to Parent Directory</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="331"/> <source>Rewind</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="332"/> <source>Fast Forward</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="333"/> <source>Stop</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="334"/> <source>Stop Scheduled Page Reload</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="336"/> <source>Reload or Stop</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="337"/> <source>Reload and Bypass Cache</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="338"/> <source>Reload All Tabs</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="339"/> <source>Reload Every</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="340"/> <source>Show Context Menu</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="341"/> <source>Undo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="342"/> <source>Redo</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="343"/> <source>Cut</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="344"/> <source>Copy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="345"/> <source>Copy as Plain Text</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="346"/> <source>Copy Address</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="347"/> <source>Copy to Note</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="348"/> <source>Paste</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="349"/> <source>Paste and Go</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="350"/> <source>Insert Note</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="351"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="352"/> <source>Select All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="353"/> <source>Clear All</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="354"/> <source>Check Spelling</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="355"/> <source>Find…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="356"/> <source>Find Next</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="357"/> <source>Find Previous</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="358"/> <source>Quick Find</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="359"/> <location filename="../../src/ui/WebWidget.cpp" line="592"/> <source>Search</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="360"/> <source>Search Using</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="361"/> <source>Create Search…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="362"/> <source>Zoom In</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="363"/> <source>Zoom Out</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="364"/> <source>Zoom Original</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="365"/> <source>Go to Start of the Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="366"/> <source>Go to the End of the Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="367"/> <source>Page Up</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="368"/> <source>Page Down</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="369"/> <source>Page Left</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="370"/> <source>Page Right</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="371"/> <source>Enter Drag Scroll Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="372"/> <source>Enter Move Scroll Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="373"/> <source>Exit Scroll Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="374"/> <source>Print…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="375"/> <source>Print Preview</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="376"/> <source>Activate Address Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="377"/> <source>Activate Search Field</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="378"/> <source>Activate Content</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="379"/> <source>Go to Previously Used Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="380"/> <source>Go to Least Recently Used Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="381"/> <source>Go to Tab on Left</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="382"/> <source>Go to Tab on Right</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="383"/> <source>Manage Bookmarks</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="384"/> <location filename="../../src/ui/WebWidget.cpp" line="472"/> <source>Add Bookmark…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="385"/> <source>Quick Bookmark Access</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="386"/> <source>Block pop-ups</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="387"/> <source>Load Images</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="388"/> <source>Cookies</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="389"/> <source>Cookies Policy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="390"/> <source>Third-party Cookies Policy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="391"/> <source>Plugins</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="392"/> <source>Load Plugins</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="393"/> <source>Enable JavaScript</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="394"/> <source>Enable Java</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="395"/> <source>Enable Referrer</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="396"/> <source>Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="397"/> <source>Enable Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="398"/> <source>View Source</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="399"/> <source>Open current page with external application</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="400"/> <source>Validate</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="401"/> <source>Inspect Page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="402"/> <source>Inspect Element…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="403"/> <source>Work Offline</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="404"/> <source>Full Screen</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="405"/> <source>Show Tab Switcher</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="406"/> <source>Show Menubar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="407"/> <source>Show Tabbar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="408"/> <source>Show Sidebar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="409"/> <source>Show Error Console</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="410"/> <source>Lock Toolbars</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="411"/> <source>Open Panel as Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="412"/> <source>Close Panel</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="413"/> <source>Content Blocking…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="414"/> <source>View History</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="415"/> <source>Clear History…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="416"/> <location filename="../../src/ui/TrayIcon.cpp" line="46"/> <source>Notes</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="417"/> <location filename="../../src/ui/TrayIcon.cpp" line="44"/> <source>Transfers</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="418"/> <source>Preferences…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="419"/> <source>Website Preferences…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="420"/> <source>Quick Preferences</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="421"/> <source>Reset Options</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="422"/> <source>Switch Application Language…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="423"/> <source>Check for Updates…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="424"/> <source>About Otter…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="425"/> <source>About Qt…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ActionsManager.cpp" line="426"/> <source>Exit</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="46"/> <source>Menu Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="47"/> <source>Tab Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="48"/> <source>Navigation Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ToolBarsManager.cpp" line="49"/> <source>Status Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/bookmarks/BookmarksContentsWidget.cpp" line="300"/> <source>Remove Bookmark</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/windows/notes/NotesContentsWidget.cpp" line="338"/> <source>Copy address of source page</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TabBarWidget.cpp" line="125"/> <source>Unpin Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/TrayIcon.cpp" line="38"/> <source>Show Windows</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="472"/> <source>Edit Bookmark…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="673"/> <source>Edit Link Bookmark…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="736"/> <source>Open Image in New Tab</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="781"/> <source>Save Video…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="781"/> <source>Save Audio…</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="787"/> <source>Copy Video Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="787"/> <source>Copy Audio Link to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="805"/> <source>Pause</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WebWidget.cpp" line="812"/> <source>Unmute</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/ui/WorkspaceWidget.cpp" line="504"/> <source>Close</source> <translation type="unfinished"/> </message> </context> <context> <name>main</name> <message> <location filename="../../src/core/Application.cpp" line="103"/> <source>URL to open</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="104"/> <source>Uses &lt;path&gt; as cache directory</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="105"/> <source>Uses &lt;path&gt; as profile directory</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="106"/> <source>Restores session &lt;session&gt; if it exists</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="107"/> <source>Starts private session</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="108"/> <source>Forces session chooser dialog</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Application.cpp" line="109"/> <source>Sets profile and cache paths to directories inside the same directory as that of application binary</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="60"/> <source>Failed to open content blocking profile file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="69"/> <source>Failed to load content blocking profile file: invalid header</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="444"/> <location filename="../../src/core/ContentBlockingProfile.cpp" line="466"/> <source>Failed to update content blocking profile: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="456"/> <source>Failed to update content blocking profile: checksum mismatch</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="548"/> <source>Failed to update content blocking profile, update URL is empty</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/ContentBlockingProfile.cpp" line="552"/> <source>Failed to update content blocking profile, update URL (%1) is invalid</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NetworkAutomaticProxy.cpp" line="105"/> <source>Failed to parse entry of proxy auto-config (PAC): %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/PlatformIntegration.cpp" line="103"/> <source>Failed to install update Updater: %1 Script: %2</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/SessionsManager.h" line="86"/> <location filename="../../src/core/SessionsManager.h" line="89"/> <source>(Untitled)</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/UpdateChecker.cpp" line="45"/> <source>Unable to check for updates. Invalid URL: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/UpdateChecker.cpp" line="66"/> <source>Unable to check for updates: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/UpdateChecker.cpp" line="99"/> <source>Unable to parse version number: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/Updater.cpp" line="90"/> <source>Unable to download update: %1 Error: %2</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/main.cpp" line="124"/> <source>Default</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/backends/web/qtwebkit/QtWebKitNetworkManager.cpp" line="460"/> <source>Blocked request</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="436"/> <source>Failed to run File Associations Manager, error code: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/modules/platforms/windows/WindowsPlatformIntegration.cpp" line="491"/> <source>Failed to register application to system registry: %1, %2</source> <translation type="unfinished"/> </message> </context> <context> <name>notifications</name> <message> <location filename="../../src/core/NotificationsManager.cpp" line="88"/> <source>Transfer Completed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NotificationsManager.cpp" line="88"/> <source>File transfer was completed</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NotificationsManager.cpp" line="89"/> <source>Update Available</source> <translation type="unfinished"/> </message> <message> <location filename="../../src/core/NotificationsManager.cpp" line="89"/> <source>Update is available to be downloaded</source> <translation type="unfinished"/> </message> </context> </TS>
gpl-3.0
lizardsystem/lizard-measure
setup.py
1445
from setuptools import setup version = '1.80.6.dev0' long_description = '\n\n'.join([ open('README.rst').read(), open('TODO.rst').read(), open('CREDITS.rst').read(), open('CHANGES.rst').read(), ]) install_requires = [ 'pkginfo', 'Django', 'django-staticfiles', 'django-extensions', 'factory-boy', 'lizard-area', 'lizard-esf', 'lizard-history >= 0.2.3', 'lizard-graph', 'lizard-geo', 'lizard-fewsnorm', 'lizard-map >= 1.71', 'lizard-ui', 'lizard-security', 'lizard-layers >= 0.4.2', 'iso8601', 'lxml', 'south', 'suds', 'django-nose', 'django-treebeard', ], tests_require = [ ] setup(name='lizard-measure', version=version, description="Maatregelen", long_description=long_description, # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=['Programming Language :: Python', 'Framework :: Django', ], keywords=[], author='Jack Ha', author_email='jack.ha@nelen-schuurmans.nl', url='', license='GPL', packages=['lizard_measure'], include_package_data=True, zip_safe=False, install_requires=install_requires, tests_require=tests_require, extras_require = {'test': tests_require}, entry_points={ 'console_scripts': [ ], }, )
gpl-3.0
eMoflon/benchmarx
examples/ecoretosql/metamodels/SQL/src/org/benchmarx/sql/core/ForeignKeyBuilder.java
1424
package org.benchmarx.sql.core; import java.util.Optional; import sql.Annotation; import sql.Column; import sql.Event; import sql.ForeignKey; import sql.Schema; import sql.SqlFactory; import sql.Table; public class ForeignKeyBuilder extends SQLBuilder { private ForeignKey key; public ForeignKeyBuilder(ForeignKey c, SQLBuilder b) { super(b); this.key = c; } public AnnotationBuilder annotation() { Annotation a = SqlFactory.eINSTANCE.createAnnotation(); key.getOwnedAnnotations().add(a); return new AnnotationBuilder(a, this); } public EventBuilder event() { Event e = SqlFactory.eINSTANCE.createEvent(); key.getOwnedEvents().add(e); return new EventBuilder(e, this); } public ForeignKeyBuilder referencedTable(String name) { Schema s = key.getOwningTable().getOwningSchema(); Optional<Table> ot = s.getOwnedTables().stream().filter(t->t.getName().equals(name)).findAny(); if(!ot.isPresent()) { throw new IllegalArgumentException("Cannot find table with name: " + name); } key.setReferencedTable(ot.get()); return this; } public ForeignKeyBuilder referencedColumn(String name) { Table t = key.getOwningTable(); Optional<Column> oc = t.getOwnedColumns().stream().filter(c->c.getName().equals(name)).findAny(); if(!oc.isPresent()) { throw new IllegalArgumentException("Cannot find column with name: " + name); } key.setColumn(oc.get()); return this; } }
gpl-3.0
mzkrelx/milm-search-core
src/main/scala/org/milmsearch/core/api/ResourceHelper.scala
3078
/* * MilmSearch is a mailing list searching system. * * Copyright (C) 2013 MilmSearch Project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. * If not, see <http://www.gnu.org/licenses/>. * * You can contact MilmSearch Project at mailing list * milm-search-public@lists.sourceforge.jp. */ package org.milmsearch.core.api import javax.ws.rs.core.Response import net.liftweb.common.Loggable import org.milmsearch.core.domain.Page import org.milmsearch.core.domain.Sort import org.milmsearch.core.domain.SortOrder import org.milmsearch.core.domain.SortByEnum import org.milmsearch.core.domain.Sort import org.milmsearch.core.domain.MLProposalSortBy import org.milmsearch.core.domain.Filter import org.milmsearch.core.domain.MLProposalFilterBy import org.milmsearch.core.domain.FilterByEnum object ResourceHelper extends Loggable { def getLongParam(param: String): Option[Long] = param match { case null => None case p => try { Some(p.toLong) } catch { case e: NumberFormatException => throw new BadQueryParameterException( "[%s] is not numeric." format (param)) } } def getBooleanParam(param: String): Option[Boolean] = param match { case null => None case p => try { Some(p.toBoolean) } catch { case e: NumberFormatException => throw new BadQueryParameterException( "[%s] is not boolean." format (param)) } } def ok(body: String) = Response.ok(body).build() def noContent = Response.noContent.build() def err400(logMsg: String): Response = { logger.warn(logMsg) Response.status(Response.Status.BAD_REQUEST).build() } def err404(logMsg: String): Response = { logger.warn(logMsg) Response.status(Response.Status.NOT_FOUND).build() } def createSort[E <: SortByEnum](sortBy: Option[String], sortOrder: Option[String], toColumn: String => E#Value): Option[Sort[E]] = (sortBy, sortOrder) match { case (None, None) => None case (Some(by), Some(order)) => try { Some(Sort(toColumn(by), SortOrder.withName(order))) } catch { case e: NoSuchElementException => throw new BadQueryParameterException( "Can't create sort. by[%s], order[%s]" format (by, order)) } case _ => throw new BadQueryParameterException( "Invalid sort. Please query sortBy and sortOrder " + "at the same time.") } }
gpl-3.0
Ragtagteam/cta-aggregator
app/resources/v1/user_resource.rb
237
module V1 class UserResource < BaseResource attribute :email relationship :advocacy_campaigns, to: :many relationship :targets, to: :many relationship :events, to: :many relationship :locations, to: :many end end
gpl-3.0
yzhui/YufanPIM
src/main/java/com/sailmi/sailplat/foundation/domain/StorePartner.java
1038
package com.sailmi.sailplat.foundation.domain; import javax.persistence.Entity; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import com.sailmi.database.domain.IdEntity; @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @Entity @Table(name = "tbl_store_partner") public class StorePartner extends IdEntity { // 标题 private String title; private String url; // 序列 private int sequence; // 店铺 @ManyToOne private Store store; public Store getStore() { return this.store; } public void setStore(Store store) { this.store = store; } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return this.url; } public void setUrl(String url) { this.url = url; } public int getSequence() { return this.sequence; } public void setSequence(int sequence) { this.sequence = sequence; } }
gpl-3.0
Folatt/duniter
app/lib/streams/dtos.js
5605
"use strict"; let dtos; module.exports = dtos = {}; dtos.Summary = { duniter: { "software": String, "version": String, "forkWindowSize": Number } }; dtos.Parameters = { currency: String, c: Number, dt: Number, ud0: Number, sigDelay: Number, sigValidity: Number, sigQty: Number, sigWoT: Number, msValidity: Number, stepMax: Number, medianTimeBlocks: Number, avgGenTime: Number, dtDiffEval: Number, blocksRot: Number, percentRot: Number }; dtos.Membership = { "signature": String, "membership": { "version": Number, "currency": String, "issuer": String, "membership": String, "date": Number, "sigDate": Number, "raw": String } }; dtos.Memberships = { "pubkey": String, "uid": String, "sigDate": Number, "memberships": [ { "version": Number, "currency": String, "membership": String, "blockNumber": Number, "blockHash": String, "written": Number } ] }; dtos.TransactionOfBlock = { "version": Number, "currency": String, "comment": String, "signatures": [String], "outputs": [String], "inputs": [String], "signatories": [String], "block_number": Number, "time": Number, "issuers": [String] }; dtos.Block = { "version": Number, "currency": String, "nonce": Number, "number": Number, "issuer": String, "parameters": String, "membersCount": Number, "monetaryMass": Number, "powMin": Number, "time": Number, "medianTime": Number, "dividend": Number, "hash": String, "previousHash": String, "previousIssuer": String, "identities": [String], "certifications": [String], "joiners": [String], "actives": [String], "leavers": [String], "excluded": [String], "transactions": [dtos.TransactionOfBlock], "signature": String, "raw": String }; dtos.Hardship = { "block": Number, "level": Number }; dtos.Difficulty = { "uid": String, "level": Number }; dtos.Difficulties = { "block": Number, "levels": [dtos.Difficulty] }; dtos.Blocks = [dtos.Block]; dtos.Stat = { "result": { "blocks": [Number] } }; dtos.Branches = { "blocks": [dtos.Block] }; dtos.Peer = { "version": Number, "currency": String, "pubkey": String, "block": String, "endpoints": [String], "signature": String, "raw": String }; dtos.DBPeer = { "version": Number, "currency": String, "pubkey": String, "block": String, "status": String, "first_down": Number, "last_try": Number, "endpoints": [String], "signature": String, "raw": String }; dtos.Peers = { "peers": [dtos.DBPeer] }; dtos.MerkleOfPeers = { "depth": Number, "nodesCount": Number, "leavesCount": Number, "root": String, "leaves": [String], "leaf": { "hash": String, "value": dtos.DBPeer } }; dtos.Other = { "pubkey": String, "meta": { "block_number": Number }, "uids": [String], "isMember": Boolean, "wasMember": Boolean, "signature": String }; dtos.UID = { "uid": String, "meta": { "timestamp": Number }, "self": String, "others": [dtos.Other] }; dtos.Signed = { "uid": String, "pubkey": String, "meta": { "timestamp": Number }, "isMember": Boolean, "wasMember": Boolean, "signature": String }; dtos.Identity = { "pubkey": String, "uids": [dtos.UID], "signed": [dtos.Signed] }; dtos.Result = { "result": Boolean }; dtos.Lookup = { "partial": Boolean, "results": [dtos.Identity] }; dtos.Members = { "results": [{ pubkey: String, uid: String }] }; dtos.RequirementsCert = { from: String, to: String, expiresIn: Number }; dtos.Requirements = { "identities": [{ pubkey: String, uid: String, meta: { timestamp: Number }, outdistanced: Boolean, certifications: [dtos.RequirementsCert], membershipPendingExpiresIn: Number, membershipExpiresIn: Number }] }; dtos.Certification = { "pubkey": String, "uid": String, "isMember": Boolean, "wasMember": Boolean, "cert_time": { "block": Number, "medianTime": Number }, "sigDate": Number, "written": { "number": Number, "hash": String }, "signature": String }; dtos.Certifications = { "pubkey": String, "uid": String, "sigDate": Number, "isMember": Boolean, "certifications": [dtos.Certification] }; dtos.SimpleIdentity = { "pubkey": String, "uid": String, "sigDate": Number }; dtos.Transaction = { "version": Number, "currency": String, "issuers": [String], "inputs": [String], "outputs": [String], "comment": String, "signatures": [String], "raw": String, "hash": String }; dtos.Source = { "pubkey": String, "type": String, "number": Number, "fingerprint": String, "amount": Number }; dtos.Sources = { "currency": String, "pubkey": String, "sources": [dtos.Source] }; dtos.TxOfHistory = { "version": Number, "issuers": [String], "inputs": [String], "outputs": [String], "comment": String, "signatures": [String], "hash": String, "block_number": Number, "time": Number }; dtos.TxHistory = { "currency": String, "pubkey": String, "history": { "sent": [dtos.TxOfHistory], "received": [dtos.TxOfHistory], "sending": [dtos.TxOfHistory], "receiving": [dtos.TxOfHistory], "pending": [dtos.TxOfHistory] } }; dtos.TxPending = { "currency": String, "pending": [dtos.Transaction] }; dtos.UD = { "block_number": Number, "consumed": Boolean, "time": Number, "amount": Number }; dtos.UDHistory = { "currency": String, "pubkey": String, "history": { "history": [dtos.UD] } };
gpl-3.0
OpenInkpot-archive/iplinux-ppl
src/Determinate.defs.hh
9795
/* Determinate class declaration. Copyright (C) 2001-2009 Roberto Bagnara <bagnara@cs.unipr.it> This file is part of the Parma Polyhedra Library (PPL). The PPL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The PPL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. For the most up-to-date information see the Parma Polyhedra Library site: http://www.cs.unipr.it/ppl/ . */ #ifndef PPL_Determinate_defs_hh #define PPL_Determinate_defs_hh #include "Determinate.types.hh" #include "Constraint_System.types.hh" #include "Congruence_System.types.hh" #include "Variable.defs.hh" #include "globals.types.hh" #include <iosfwd> #include <cassert> namespace Parma_Polyhedra_Library { /*! \brief Returns <CODE>true</CODE> if and only if \p x and \p y are the same domain element. \relates Determinate */ template <typename PS> bool operator==(const Determinate<PS>& x, const Determinate<PS>& y); /*! \brief Returns <CODE>true</CODE> if and only if \p x and \p y are different domain elements. \relates Determinate */ template <typename PS> bool operator!=(const Determinate<PS>& x, const Determinate<PS>& y); namespace IO_Operators { //! Output operator. /*! \relates Parma_Polyhedra_Library::Determinate */ template <typename PS> std::ostream& operator<<(std::ostream&, const Determinate<PS>&); } // namespace IO_Operators } // namespace Parma_Polyhedra_Library //! Wraps a PPL class into a determinate constraint system interface. /*! \ingroup PPL_CXX_interface */ template <typename PS> class Parma_Polyhedra_Library::Determinate { public: //! \name Constructors and Destructor //@{ /*! \brief Injection operator: builds the determinate constraint system element corresponding to the base-level element \p p. */ Determinate(const PS& p); /*! \brief Injection operator: builds the determinate constraint system element corresponding to the base-level element represented by \p cs. */ Determinate(const Constraint_System& cs); //! \brief //! Injection operator: builds the determinate constraint system element //! corresponding to the base-level element represented by \p cgs. Determinate(const Congruence_System& cgs); //! Copy constructor. Determinate(const Determinate& y); //! Destructor. ~Determinate(); //@} // Constructors and Destructor //! \name Member Functions that Do Not Modify the Domain Element //@{ //! Returns a const reference to the embedded element. const PS& element() const; /*! \brief Returns <CODE>true</CODE> if and only if \p *this is the top of the determinate constraint system (i.e., the whole vector space). */ bool is_top() const; /*! \brief Returns <CODE>true</CODE> if and only if \p *this is the bottom of the determinate constraint system. */ bool is_bottom() const; //! Returns <CODE>true</CODE> if and only if \p *this entails \p y. bool definitely_entails(const Determinate& y) const; /*! \brief Returns <CODE>true</CODE> if and only if \p *this and \p y are equivalent. */ bool is_definitely_equivalent_to(const Determinate& y) const; /*! \brief Returns a lower bound to the total size in bytes of the memory occupied by \p *this. */ memory_size_type total_memory_in_bytes() const; /*! \brief Returns a lower bound to the size in bytes of the memory managed by \p *this. */ memory_size_type external_memory_in_bytes() const; /*! Returns <CODE>true</CODE> if and only if this domain has a nontrivial weakening operator. */ static bool has_nontrivial_weakening(); //! Checks if all the invariants are satisfied. bool OK() const; //@} // Member Functions that Do Not Modify the Domain Element //! \name Member Functions that May Modify the Domain Element //@{ //! Assigns to \p *this the upper bound of \p *this and \p y. void upper_bound_assign(const Determinate& y); //! Assigns to \p *this the meet of \p *this and \p y. void meet_assign(const Determinate& y); //! Assigns to \p *this the result of weakening \p *this with \p y. void weakening_assign(const Determinate& y); /*! \brief Assigns to \p *this the \ref Concatenating_Polyhedra "concatenation" of \p *this and \p y, taken in this order. */ void concatenate_assign(const Determinate& y); //! Returns a reference to the embedded element. PS& element(); #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS /*! \brief On return from this method, the representation of \p *this is not shared by different Determinate objects. */ #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) void mutate(); //! Assignment operator. Determinate& operator=(const Determinate& y); //! Swaps \p *this with \p y. void swap(Determinate& y); //@} // Member Functions that May Modify the Domain Element #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS //! A function adapter for the Determinate class. /*! \ingroup PPL_CXX_interface It lifts a Binary_Operator_Assign function object, taking arguments of type PS, producing the corresponding function object taking arguments of type Determinate<PS>. The template parameter Binary_Operator_Assign is supposed to implement an <EM>apply and assign</EM> function, i.e., a function having signature <CODE>void foo(PS& x, const PS& y)</CODE> that applies an operator to \c x and \c y and assigns the result to \c x. For instance, such a function object is obtained by <CODE>std::mem_fun_ref(&C_Polyhedron::intersection_assign)</CODE>. */ #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) template <typename Binary_Operator_Assign> class Binary_Operator_Assign_Lifter { public: //! Explicit unary constructor. explicit Binary_Operator_Assign_Lifter(Binary_Operator_Assign op_assign); //! Function-application operator. void operator()(Determinate& x, const Determinate& y) const; private: //! The function object to be lifted. Binary_Operator_Assign op_assign_; }; #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS /*! \brief Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of template arguments. */ #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) template <typename Binary_Operator_Assign> static Binary_Operator_Assign_Lifter<Binary_Operator_Assign> lift_op_assign(Binary_Operator_Assign op_assign); private: //! The possibly shared representation of a Determinate object. /*! \ingroup PPL_CXX_interface By adopting the <EM>copy-on-write</EM> technique, a single representation of the base-level object may be shared by more than one object of the class Determinate. */ class Rep { private: /*! \brief Count the number of references: - 0: leaked, \p ph is non-const; - 1: one reference, \p ph is non-const; - > 1: more than one reference, \p ph is const. */ mutable unsigned long references; //! Private and unimplemented: assignment not allowed. Rep& operator=(const Rep& y); //! Private and unimplemented: copies not allowed. Rep(const Rep& y); //! Private and unimplemented: default construction not allowed. Rep(); public: //! A possibly shared base-level domain element. PS ph; /*! \brief Builds a new representation by creating a domain element of the specified kind, in the specified vector space. */ Rep(dimension_type num_dimensions, Degenerate_Element kind); //! Builds a new representation by copying base-level element \p p. Rep(const PS& p); //! Builds a new representation by copying the constraints in \p cs. Rep(const Constraint_System& cs); //! Builds a new representation by copying the constraints in \p cgs. Rep(const Congruence_System& cgs); //! Destructor. ~Rep(); //! Registers a new reference. void new_reference() const; /*! \brief Unregisters one reference; returns <CODE>true</CODE> if and only if the representation has become unreferenced. */ bool del_reference() const; //! True if and only if this representation is currently shared. bool is_shared() const; /*! \brief Returns a lower bound to the total size in bytes of the memory occupied by \p *this. */ memory_size_type total_memory_in_bytes() const; /*! \brief Returns a lower bound to the size in bytes of the memory managed by \p *this. */ memory_size_type external_memory_in_bytes() const; }; /*! \brief A pointer to the possibly shared representation of the base-level domain element. */ Rep* prep; friend bool operator==<PS>(const Determinate<PS>& x, const Determinate<PS>& y); friend bool operator!=<PS>(const Determinate<PS>& x, const Determinate<PS>& y); }; namespace std { //! Specializes <CODE>std::swap</CODE>. /*! \relates Parma_Polyhedra_Library::Determinate */ template <typename PS> void swap(Parma_Polyhedra_Library::Determinate<PS>& x, Parma_Polyhedra_Library::Determinate<PS>& y); } // namespace std #include "Determinate.inlines.hh" #endif // !defined(PPL_Determinate_defs_hh)
gpl-3.0
helixsync/HelixSync
HelixSync/Commands/SyncDirection.cs
209
using System; using System.Collections.Generic; using System.Text; namespace HelixSync.Commands { public enum SyncDirection { Bidirectional, EncrToDecr, DecrToEncr, } }
gpl-3.0
Toothgip/Pong
src/Textfield.cpp
2909
#include "../include/Textfield.hpp" void Textfield::recordingCharacter(sf::Event &event) { if(sf::Keyboard::isKeyPressed(sf::Keyboard::BackSpace) && m_chaineCaractere.getSize() != 0) { m_caractereEntrer = 0; //Reset the number entered m_chaineCaractere.erase(m_chaineCaractere.getSize()- 1, 1); //Delete the number that was entered //There are currently no number entered m_text.setString(m_chaineCaractere); //Update the text that is draw on the window } if (event.type == sf::Event::TextEntered && // IF text is entered m_caractereEntrer >= 49 && m_caractereEntrer <= 57 && //If the text is number m_chaineCaractere.getSize() < 1 ) //If the Textfield is not full { m_caractereEntrer = event.text.unicode; //Store the number entered m_chaineCaractere.insert(0, m_caractereEntrer); //Insert in the string that will be //draw on the window m_sensi = atoi(&m_caractereEntrer); //Convert the char enter by user in a integer m_text.setString(m_chaineCaractere); //Update the text that is draw on the window } } void Textfield::focus(sf::RenderWindow &window) { if(sf::Mouse::getPosition(window).x >= 338 && sf::Mouse::getPosition(window).x <= 456 && sf::Mouse::getPosition(window).y >= 240 && sf::Mouse::getPosition(window).y <= 305 && //Textfield focus sf::Mouse::isButtonPressed(sf::Mouse::Left)) { m_sprite.setTexture(m_textureFocus); m_focus = 1; } else if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) //If user click Outside the Textfield { m_sprite.setTexture(m_texture); m_focus = 0; } } void Textfield::update(sf::RenderWindow &window, sf::Event &event) { focus(window); if(m_focus == 1) //If Textfield focused { recordingCharacter(event); //Record text entered by user } } void Textfield::draw(sf::RenderWindow &window) { window.draw(m_sprite); window.draw(m_text); } int Textfield::getSensi() { return m_sensi; } void Textfield::reset() { if(m_chaineCaractere.getSize() != 0) { m_chaineCaractere.erase(0, 1); //Delete text that was entered } m_text.setString(""); //Reset text that is draw } Textfield::Textfield() //Constructor { //Initialize sprite of Textfield m_textureFocus.loadFromFile("ressource/Menu/Parametre/Sensi-focus.png"); m_texture.loadFromFile("ressource/Menu/Parametre/Sensi.png"); m_sprite.setTexture(m_texture); //Initialize text of textField font.loadFromFile("arial.ttf"); m_text.setFont(font); m_text.setPosition(360, 227); m_text.setColor(sf::Color::Black); m_text.setCharacterSize(70); //Variable m_caractereEntrer = 0; } Textfield::~Textfield() //Destructor { }
gpl-3.0
storri/libreverse
reverse/io/input/file_readers/java_class/null_variable_info.hpp
1440
/* Null_Variable_Info.h Copyright (C) 2008 Stephen Torri This file is part of Libreverse. Libreverse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Libreverse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef JAVA_NULL_VARIABLE_INFO_H_ #define JAVA_NULL_VARIABLE_INFO_H_ #include "Verification_Type_Info.h" namespace reverse { namespace java_module { class Null_Variable_Info : public Verification_Type_Info { public: Null_Variable_Info (); virtual ~Null_Variable_Info(){} virtual std::string to_String ( boost::uint16_t index ) const; virtual boost::uint8_t get_Tag (void) const; virtual void read_Input ( java_types::Class_File::ptr_t ){} virtual bool is_Type ( boost::uint8_t id ) const; private: boost::uint8_t m_tag; }; } /* namespace java_module */ } /* namespace reverse */ #endif /* JAVA_NULL_VARIABLE_INFO_H_ */
gpl-3.0
iscumd/PowerWheels
BLDC/bldc-firmware/docs/html/search/all_5.js
3205
var searchData= [ ['ee_5finit',['EE_Init',['../de/d29/group___e_e_p_r_o_m___emulation.html#ga83834957567411c76bb7f659cf8a1a38',1,'EE_Init(void):&#160;eeprom.c'],['../de/d29/group___e_e_p_r_o_m___emulation.html#ga83834957567411c76bb7f659cf8a1a38',1,'EE_Init(void):&#160;eeprom.c']]], ['ee_5freadvariable',['EE_ReadVariable',['../de/d29/group___e_e_p_r_o_m___emulation.html#ga0776e2e16f54d3a675e4f2f401703a85',1,'EE_ReadVariable(uint16_t VirtAddress, uint16_t *Data):&#160;eeprom.c'],['../de/d29/group___e_e_p_r_o_m___emulation.html#ga0776e2e16f54d3a675e4f2f401703a85',1,'EE_ReadVariable(uint16_t VirtAddress, uint16_t *Data):&#160;eeprom.c']]], ['ee_5fwritevariable',['EE_WriteVariable',['../de/d29/group___e_e_p_r_o_m___emulation.html#ga516e9ced7438b9452c72884aa1df5915',1,'EE_WriteVariable(uint16_t VirtAddress, uint16_t Data):&#160;eeprom.c'],['../de/d29/group___e_e_p_r_o_m___emulation.html#ga516e9ced7438b9452c72884aa1df5915',1,'EE_WriteVariable(uint16_t VirtAddress, uint16_t Data):&#160;eeprom.c']]], ['eeprom_2ec',['eeprom.c',['../df/d83/eeprom_8c.html',1,'']]], ['eeprom_2eh',['eeprom.h',['../d0/ded/eeprom_8h.html',1,'']]], ['eeprom_5fbase_5fappconf',['EEPROM_BASE_APPCONF',['../d1/df9/conf__general_8c.html#a0bb7b359b30ad8512e1ce8ea983ae8fa',1,'conf_general.c']]], ['eeprom_5fbase_5fmcconf',['EEPROM_BASE_MCCONF',['../d1/df9/conf__general_8c.html#a163f4102b480a94854daadeb72e57be2',1,'conf_general.c']]], ['eeprom_5femulation',['EEPROM_Emulation',['../de/d29/group___e_e_p_r_o_m___emulation.html',1,'']]], ['eeprom_5fstart_5faddress',['EEPROM_START_ADDRESS',['../d0/ded/eeprom_8h.html#a96932befbe81496318633eab6e623adb',1,'eeprom.h']]], ['enable_5fgate',['ENABLE_GATE',['../d9/da3/hw__40_8h.html#a8c464f4293f4d6396c8773e0c124aefe',1,'ENABLE_GATE():&#160;hw_40.h'],['../d9/d67/hw__45_8h.html#a8c464f4293f4d6396c8773e0c124aefe',1,'ENABLE_GATE():&#160;hw_45.h'],['../d9/d89/hw__46_8h.html#a8c464f4293f4d6396c8773e0c124aefe',1,'ENABLE_GATE():&#160;hw_46.h'],['../d0/d5e/hw__r2_8h.html#a8c464f4293f4d6396c8773e0c124aefe',1,'ENABLE_GATE():&#160;hw_r2.h'],['../d9/d16/hw__victor__r1a_8h.html#a8c464f4293f4d6396c8773e0c124aefe',1,'ENABLE_GATE():&#160;hw_victor_r1a.h']]], ['encoder_2ec',['encoder.c',['../d2/dbf/encoder_8c.html',1,'']]], ['encoder_2eh',['encoder.h',['../d1/d79/encoder_8h.html',1,'']]], ['encoder_5fcounts',['ENCODER_COUNTS',['../df/df4/conf__general_8h.html#af219931ae59bfd17b6b02088d131fcc4',1,'conf_general.h']]], ['encoder_5fenable',['ENCODER_ENABLE',['../df/df4/conf__general_8h.html#a42c15799695a95f5cf1a7ad50390405e',1,'conf_general.h']]], ['encoder_5finit',['encoder_init',['../d2/dbf/encoder_8c.html#ab885d9bad57d89e5f53eb590dc3d6011',1,'encoder_init(void):&#160;encoder.c'],['../d1/d79/encoder_8h.html#ab885d9bad57d89e5f53eb590dc3d6011',1,'encoder_init(void):&#160;encoder.c']]], ['encoder_5fread_5fdeg',['encoder_read_deg',['../d2/dbf/encoder_8c.html#aba853e10b5e9bbd96d72888802c36db1',1,'encoder_read_deg(void):&#160;encoder.c'],['../d1/d79/encoder_8h.html#aba853e10b5e9bbd96d72888802c36db1',1,'encoder_read_deg(void):&#160;encoder.c']]], ['erased',['ERASED',['../d0/ded/eeprom_8h.html#ab34c8a09ba45ac4f5eca4545edb690d2',1,'eeprom.h']]] ];
gpl-3.0
CMPUT301W15T16/Comput-301GroupProject
Team16App/src/ca/ualberta/cs/team16app/AddDestActivity.java
2121
/** * This is a Activity file for add Destination * Team16App: travel expense tracking application * Copyright (C) 2015 peijen Chris Lin * dmeng Di Meng * tshen * qtan Qi Tan * yuentung * omoyeni Omoyeni Adeyemo * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package ca.ualberta.cs.team16app; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class AddDestActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_dest); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.add_dest, menu); return true; } public void saveDest(View v){ /** * click saveDest to save destination and jump to the DestlistAcivity */ Toast.makeText(this,"added a destination", Toast.LENGTH_SHORT).show(); // show message DestListController dest = new DestListController(); EditText textview = (EditText) findViewById(R.id.destName); EditText destreasonview = (EditText) findViewById(R.id.reasonDest); dest.addDest(new Destination(textview.getText().toString(),destreasonview.getText().toString())); Intent intent = new Intent(AddDestActivity.this,DestListActivity.class); startActivity(intent); } }
gpl-3.0
glyphr-studio/Glyphr-Studio-2
dev/glyph_elements/segment.test.js
5143
import Segment from './segment.js'; import {segmentsAreEqual, findSegmentIntersections, findOverlappingLineSegmentIntersections, findCrossingLineSegmentIntersections, findEndPointSegmentIntersections} from './poly_segment.js'; import {round} from '../common/functions.js'; // basically an upper-left quadrant quarter circle // Test Segment at t=0.5 is {x: 62.5, y: 137.5} const testSegment1 = {p1x: 0, p1y: 0, p2x: 0, p2y: 100, p3x: 100, p3y: 200, p4x: 200, p4y: 200}; /** * easy segment for testing * @returns {Segment} */ function sampleSegment() { return new Segment(testSegment1); } describe('Segment', () => { it('save', () => { expect(sampleSegment().save()).toEqual({ p1x: 0, p1y: 0, p2x: 0, p2y: 100, p3x: 100, p3y: 200, p4x: 200, p4y: 200}); }); it('length getter', () => { expect(sampleSegment().length).toBe(309.8050662153215); }); it('quickLength getter', () => { expect(sampleSegment().quickLength).toBe(341.4213562373095); }); it('maxes getter', () => { expect(sampleSegment().maxes.xMax).toBe(200); }); it('line getter', () => { const seg = new Segment({p1x: 0, p1y: 100, p4x: 100, p4y: 0}); expect(seg.lineType).toBe('diagonal'); }); it('split', () => { expect(sampleSegment().split()[1].p1x).toBe(62.5); }); it('getXYPointFromSplit', () => { expect(sampleSegment().getXYPointFromSplit().y).toBe(137.5); }); it('getSplitFromXYPoint', () => { expect(round(sampleSegment().getSplitFromXYPoint({x: 62.5, y: 137.5}).split, 2)).toBe(0.5); }); it('splitAtPoint', () => { expect(sampleSegment().splitAtPoint({x: 62.5, y: 137.5})[1].p1x).toBe(62.42971272735194); }); it('splitAtTime', () => { expect(sampleSegment().splitAtTime(0.5)[1].p1x).toBe(62.5); }); it('splitAtManyPoints', () => { const points = [ {x: 29.0763, y: 95.4063}, // t=0.33 {x: 101.9304, y: 169.2504}, // t=0.66 ]; const segs = sampleSegment().splitAtManyPoints(points); // debug(segs); expect(round(segs[2].p1x)).toBe(102); }); it('pointIsWithinMaxes', () => { expect(sampleSegment().pointIsWithinMaxes({x: 100, y: 100})).toBeTruthy(); }); it('convertToLine', () => { expect(sampleSegment().convertToLine().lineType).toBe('diagonal'); }); it('calculateLength', () => { expect(sampleSegment().calculateLength()).toBe(309.8050662153215); }); it('getReverse', () => { expect(sampleSegment().getReverse().p1x).toBe(200); }); it('getXYPoint', () => { expect(sampleSegment().getXYPoint(4).x).toBe(200); }); it('getFastMaxes', () => { expect(sampleSegment().getFastMaxes().xMax).toBe(200); }); it('isLineOverlappedByLine', () => { const seg = new Segment({p1x: 50, p1y: 50, p4x: 150, p4y: 150}); expect(seg.isLineOverlappedByLine(sampleSegment().convertToLine())).toBeTruthy(); }); it('containsTerminalPoint - start', () => { // also tests Segment.containsStartPoint expect(sampleSegment().containsTerminalPoint({x: 0, y: 0})).toBe('start'); }); it('containsTerminalPoint - end', () => { // also tests Segment.containsEndPoint expect(sampleSegment().containsTerminalPoint({x: 200, y: 200})).toBe('end'); }); it('containsPointOnCurve', () => { expect(sampleSegment().containsPointOnCurve({x: 29.0763, y: 95.4063})).toBeTruthy(); }); it('containsPointOnLine', () => { expect(sampleSegment().convertToLine().containsPointOnLine({x: 100, y: 100})).toBeTruthy(); }); it('precedes', () => { const seg2 = new Segment({p1x: 200, p1y: 200}); expect(sampleSegment().precedes(seg2)).toBeTruthy(); }); it('isLine', () => { expect(sampleSegment().convertToLine().lineType).toBeTruthy(); }); it('roundAll', () => { const seg = sampleSegment(); seg.p2y = 123.4559; expect(seg.roundAll(3).p2y).toBe(123.456); }); it('findSegmentIntersections', () => { // basically an upper-right quadrant quarter circle const seg2 = new Segment({p1x: 0, p1y: 200, p2x: 100, p2y: 200, p3x: 200, p3y: 100, p4x: 200, p4y: 0}); expect(findSegmentIntersections(sampleSegment(), seg2)[0]).toBe('100/168.004'); }); it('segmentsAreEqual', () => { expect(segmentsAreEqual(sampleSegment(), sampleSegment())).toBeTruthy(); }); it('findOverlappingLineSegmentIntersections', () => { const seg1 = new Segment({p1x: 0, p1y: 0, p4x: 100, p4y: 0}); const seg2 = new Segment({p1x: 50, p1y: 0, p4x: 200, p4y: 0}); expect(findOverlappingLineSegmentIntersections(seg1, seg2)[0]).toBe('50/0'); }); it('findCrossingLineSegmentIntersections', () => { const seg1 = new Segment({p1x: 0, p1y: 0, p4x: 100, p4y: 100}); const seg2 = new Segment({p1x: 0, p1y: 100, p4x: 100, p4y: 0}); expect(findCrossingLineSegmentIntersections(seg1, seg2)[0]).toBe('50/50'); }); it('findEndPointSegmentIntersections', () => { const seg1 = sampleSegment(); const seg2 = new Segment({p1x: 200, p1y: 200}); expect(findEndPointSegmentIntersections(seg1, seg2)[0]).toBe('200/200'); }); }); /* CANVAS METHODS drawSegmentOutline(color, dx, dy) drawSegmentPoints(color, txt) */
gpl-3.0
jukkes/TulipProject
library/tulip-gui/src/MouseInteractors.cpp
17372
/** * * This file is part of Tulip (www.tulip-software.org) * * Authors: David Auber and the Tulip development Team * from LaBRI, University of Bordeaux * * Tulip is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Tulip is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * */ #include <QEvent> #include <QWheelEvent> #include <QPinchGesture> #include <QPanGesture> #include <tulip/GlNode.h> #include <tulip/GlMainWidget.h> #include <tulip/View.h> #include <tulip/Observable.h> #include <tulip/GlGraphComposite.h> #include <tulip/GlMainView.h> #include <tulip/GlBoundingBoxSceneVisitor.h> #include <tulip/DrawingTools.h> #include <tulip/QtGlSceneZoomAndPanAnimator.h> #include <tulip/NodeLinkDiagramComponent.h> #include <tulip/MouseInteractors.h> #include <iostream> using namespace tlp; using namespace std; //=============================================================== bool MousePanNZoomNavigator::eventFilter(QObject *widget, QEvent *e) { // according to Qt's doc, this constant has been defined by wheel mouse vendors // we need it to interpret the value of QWheelEvent->delta() #define WHEEL_DELTA 120 GlMainWidget *g = static_cast<GlMainWidget *>(widget); if (e->type() == QEvent::Wheel) { QWheelEvent *we = static_cast<QWheelEvent*>(e); if (we->orientation() == Qt::Vertical && we->modifiers() == Qt::NoModifier) { g->getScene()->zoomXY(we->delta() / WHEEL_DELTA, we->x(), we->y()); g->draw(false); return true; } } if(e->type() == QEvent::Gesture) { QGestureEvent* gesture = static_cast<QGestureEvent*>(e); QPointF center; //swipe events and pan events are never fired, known Qt bug /*if(gesture->gesture(Qt::SwipeGesture)) { QSwipeGesture* swipe = (QSwipeGesture*)gesture->gesture(Qt::SwipeGesture); int x = cos(swipe->swipeAngle()) * swipe->property("velocity").toFloat(); int y = sin(swipe->swipeAngle()) * swipe->property("velocity").toFloat(); g->getScene()->translateCamera(x, y, 0); }*/ if(gesture->gesture(Qt::PinchGesture)) { QPinchGesture* pinch = static_cast<QPinchGesture*>(gesture->gesture(Qt::PinchGesture)); Camera& camera = g->getScene()->getGraphCamera(); //store the camera scale factor when starting the gesture if(pinch->state() == Qt::GestureStarted) { cameraScaleFactor = camera.getZoomFactor(); isGesturing = true; } if(pinch->changeFlags() & QPinchGesture::ScaleFactorChanged) { //only set the zoom factor if two events in a row were in the same direction (zoom in or out) to smooth a bit the effect. if((pinch->lastScaleFactor() > 1 && pinch->scaleFactor() > 1) || (pinch->lastScaleFactor() <= 1 && pinch->scaleFactor() <= 1)) { camera.setZoomFactor(cameraScaleFactor * pinch->totalScaleFactor()); } } if(pinch->changeFlags() & QPinchGesture::RotationAngleChanged) { /*//backup the current camera center Coord oldCenter = camera.getCenter(); Coord oldEye = camera.getEyes(); //sets the camera center to the center of the pich gesture Coord rotationCenter(g->mapFromGlobal(pinch->centerPoint().toPoint()).x(), g->mapFromGlobal(pinch->centerPoint().toPoint()).y(), oldCenter.getZ()); Coord rotationEye=camera.getEyes()+(rotationCenter-oldCenter); camera.setCenter(rotationCenter); camera.setEyes(rotationEye);*/ //rotates the camera camera.rotate((pinch->rotationAngle() - pinch->lastRotationAngle())/180*M_PI, 0, 0, 1); /* //restore old camera center and eyes camera.setCenter(oldCenter); camera.setEyes(oldEye); */ } if(pinch->state() == Qt::GestureFinished) { isGesturing = false; } if(gesture->gesture(Qt::PanGesture)) { QPanGesture* pan = static_cast<QPanGesture*>(gesture->gesture(Qt::PanGesture)); if(pan->state() == Qt::GestureStarted) { isGesturing = true; } if(pan->state() == Qt::GestureFinished) { isGesturing = false; } center = pan->delta(); g->getScene()->translateCamera(pan->delta().x(), -pan->delta().y(), 0); } } g->draw(false); return true; } return false; } //=============================================================== bool MouseElementDeleter::eventFilter(QObject *widget, QEvent *e) { QMouseEvent *qMouseEv = dynamic_cast<QMouseEvent *>(e); if(qMouseEv != NULL) { SelectedEntity selectedEntity; GlMainWidget *glMainWidget = static_cast<GlMainWidget *>(widget); if(e->type() == QEvent::MouseMove) { if (glMainWidget->pickNodesEdges(qMouseEv->x(), qMouseEv->y(), selectedEntity)) { glMainWidget->setCursor(QCursor(QPixmap(":/tulip/gui/icons/i_del.png"))); } else { glMainWidget->setCursor(Qt::ArrowCursor); } return false; } else if (e->type() == QEvent::MouseButtonPress && qMouseEv->button()==Qt::LeftButton) { if (glMainWidget->pickNodesEdges(qMouseEv->x(), qMouseEv->y(), selectedEntity)) { Observable::holdObservers(); Graph* graph = glMainWidget->getScene()->getGlGraphComposite()->getInputData()->getGraph(); // allow to undo graph->push(); switch(selectedEntity.getEntityType()) { case SelectedEntity::NODE_SELECTED: graph->delNode(node(selectedEntity.getComplexEntityId())); break; case SelectedEntity::EDGE_SELECTED: graph->delEdge(edge(selectedEntity.getComplexEntityId())); break; default : break; } glMainWidget->redraw(); Observable::unholdObservers(); return true; } } } return false; } void MouseElementDeleter::clear() { GlMainView *glMainView=static_cast<GlMainView*>(view()); glMainView->getGlMainWidget()->setCursor(QCursor()); } //=============================================================== class MouseRotXRotY:public InteractorComponent { public: MouseRotXRotY() : x(INT_MAX), y(INT_MAX) {} ~MouseRotXRotY() {} int x,y; bool eventFilter(QObject *, QEvent *); }; bool MouseRotXRotY::eventFilter(QObject *widget, QEvent *e) { if (e->type() == QEvent::MouseButtonPress) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); x = qMouseEv->x(); y = qMouseEv->y(); return true; } if (e->type() == QEvent::MouseMove) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); GlMainWidget *glMainWidget = static_cast<GlMainWidget *>(widget); int deltaX,deltaY; deltaX=qMouseEv->x()-x; deltaY=qMouseEv->y()-y; if (abs(deltaX)>abs(deltaY)) deltaY=0; else deltaX=0; if (deltaY!=0) glMainWidget->getScene()->rotateScene(deltaY,0,0); if (deltaX!=0) glMainWidget->getScene()->rotateScene(0,deltaX,0); x=qMouseEv->x(); y=qMouseEv->y(); glMainWidget->draw(false); return true; } return false; } //=============================================================== class MouseZoomRotZ:public InteractorComponent { public: MouseZoomRotZ(): x(INT_MAX), y(INT_MAX), inRotation(false), inZoom(false) {} ~MouseZoomRotZ() {} int x,y; bool inRotation, inZoom; bool eventFilter(QObject *, QEvent *); }; bool MouseZoomRotZ::eventFilter(QObject *widget, QEvent *e) { if (e->type() == QEvent::MouseButtonPress) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); x = qMouseEv->x(); y = qMouseEv->y(); inRotation=false; inZoom=false; return true; } if (e->type() == QEvent::MouseMove) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); GlMainWidget *glMainWidget = static_cast<GlMainWidget *>(widget); int deltaX,deltaY; if(!inRotation && !inZoom) { deltaX = qMouseEv->x() - x; deltaY= qMouseEv->y() - y; if (deltaY && abs(deltaX) >= 3 * abs(deltaY)) { inRotation=true; inZoom=false; } else if (deltaX && abs(deltaY) >= 3 * abs(deltaX)) { inZoom=true; inRotation=false; } else { } x = qMouseEv->x(); y = qMouseEv->y(); } if (inZoom) { // Zoom deltaY = qMouseEv->y() - y; glMainWidget->getScene()->zoom(-deltaY/2); y = qMouseEv->y(); } if(inRotation) { // Rotation deltaX = qMouseEv->x() - x; glMainWidget->getScene()->rotateScene(0,0,deltaX); x = qMouseEv->x(); } glMainWidget->draw(false); return true; } return false; } //=============================================================== class MouseMove:public InteractorComponent { public: int x,y; MouseMove() : x(INT_MAX), y(INT_MAX) {} ~MouseMove() {} bool eventFilter(QObject *, QEvent *); }; bool MouseMove::eventFilter(QObject *widget, QEvent *e) { if (e->type() == QEvent::MouseButtonPress) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); x = qMouseEv->x(); y = qMouseEv->y(); return true; } if (e->type() == QEvent::MouseMove) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); GlMainWidget *glMainWidget = static_cast<GlMainWidget *>(widget); if (qMouseEv->x() != x) glMainWidget->getScene()->translateCamera(qMouseEv->x()-x,0,0); if (qMouseEv->y() != y) glMainWidget->getScene()->translateCamera(0,y-qMouseEv->y(),0); x = qMouseEv->x(); y = qMouseEv->y(); glMainWidget->draw(false); return true; } return false; } // animation during meta node interaction class MyQtGlSceneZoomAndPanAnimator : public tlp::QtGlSceneZoomAndPanAnimator { public : MyQtGlSceneZoomAndPanAnimator(tlp::GlMainWidget *glWidget,tlp::View *view, const tlp::BoundingBox &boundingBox,tlp::Graph *graph,tlp::node n,const float &color):tlp::QtGlSceneZoomAndPanAnimator(glWidget,boundingBox),view(view),graph(graph),n(n),alphaEnd(color) { tlp::ColorProperty *colorProp=graph->getProperty<tlp::ColorProperty>("viewColor"); alphaBegin=colorProp->getNodeValue(n)[3]; } protected: virtual void zoomAndPanAnimStepSlot(int animationStep); protected : tlp::View *view; tlp::Graph *graph; tlp::node n; float alphaEnd; float alphaBegin; }; void MyQtGlSceneZoomAndPanAnimator::zoomAndPanAnimStepSlot(int animationStep) { int nbAnimationSteps = animationDurationMsec / 40 + 1; float decAlpha=(alphaEnd-alphaBegin)/nbAnimationSteps; ColorProperty *colorProp=graph->getProperty<ColorProperty>("viewColor"); Color color=colorProp->getNodeValue(n); color[3]=alphaBegin+decAlpha*animationStep; colorProp->setNodeValue(n,color); QtGlSceneZoomAndPanAnimator::zoomAndPanAnimationStep(animationStep); view->draw(); } //=============================================================== bool MouseNKeysNavigator::eventFilter(QObject *widget, QEvent *e) { if(isGesturing) { return MousePanNZoomNavigator::eventFilter(widget, e); } if(currentSpecInteractorComponent) { if(currentSpecInteractorComponent->eventFilter(widget,e)) return true; } GlMainWidget *glmainwidget = static_cast<GlMainWidget *>(widget); QMouseEvent * qMouseEv = static_cast<QMouseEvent *>(e); if (e->type() == QEvent::MouseButtonDblClick && qMouseEv->button() == Qt::LeftButton) { Graph *graph=glmainwidget->getScene()->getGlGraphComposite()->getInputData()->getGraph(); if (qMouseEv->modifiers()!=Qt::ControlModifier) { vector<SelectedEntity> tmpNodes; vector<SelectedEntity> tmpEdges; glmainwidget->pickNodesEdges(qMouseEv->x()-1,qMouseEv->y()-1,3,3,tmpNodes,tmpEdges); node metaNode; bool find=false; for(unsigned int i=0; i<tmpNodes.size(); ++i) { if(graph->isMetaNode(node(tmpNodes[i].getComplexEntityId()))) { metaNode=node(tmpNodes[i].getComplexEntityId()); find=true; break; } } if (find) { Graph *metaGraph=graph->getNodeMetaInfo(metaNode); if (metaGraph && nldc) { graphHierarchy.push_back(graph); nodeHierarchy.push_back(metaNode); cameraHierarchy.push_back(nldc->goInsideItem(metaNode)); } } else //no double click on a metanode. Do not block event. return false; return true; } else { if(!graphHierarchy.empty() && nldc) { Graph * oldGraph=graphHierarchy.back(); graphHierarchy.pop_back(); Camera camera=cameraHierarchy.back(); cameraHierarchy.pop_back(); node n=nodeHierarchy.back(); nodeHierarchy.pop_back(); Observable::holdObservers(); ColorProperty *colorProp=oldGraph->getProperty<ColorProperty>("viewColor"); float alphaOrigin=colorProp->getNodeValue(n)[3]; Color color=colorProp->getNodeValue(n); color[3]=0; colorProp->setNodeValue(n,color); Observable::unholdObservers(); nldc->requestChangeGraph(oldGraph); glmainwidget->getScene()->getLayer("Main")->getCamera().setCenter(camera.getCenter()); glmainwidget->getScene()->getLayer("Main")->getCamera().setEyes(camera.getEyes()); glmainwidget->getScene()->getLayer("Main")->getCamera().setSceneRadius(camera.getSceneRadius()); glmainwidget->getScene()->getLayer("Main")->getCamera().setUp(camera.getUp()); glmainwidget->getScene()->getLayer("Main")->getCamera().setZoomFactor(camera.getZoomFactor()); glmainwidget->draw(false); GlBoundingBoxSceneVisitor *visitor; visitor=new GlBoundingBoxSceneVisitor(glmainwidget->getScene()->getGlGraphComposite()->getInputData()); glmainwidget->getScene()->getLayer("Main")->acceptVisitor(visitor); BoundingBox boundingBox=visitor->getBoundingBox(); MyQtGlSceneZoomAndPanAnimator navigator(glmainwidget,nldc,boundingBox,oldGraph,n,alphaOrigin); navigator.animateZoomAndPan(); return true; } } } if (e->type() == QEvent::MouseButtonPress) { QMouseEvent *qMouseEv = static_cast<QMouseEvent *>(e); if (qMouseEv->buttons() == Qt::LeftButton) { oldCursor=glmainwidget->cursor(); InteractorComponent *currentMouse; // give focus so we can catch key events glmainwidget->setFocus(); if (qMouseEv->modifiers() & #if defined(__APPLE__) Qt::AltModifier #else Qt::ControlModifier #endif ) currentMouse = new MouseZoomRotZ(); else if (qMouseEv->modifiers() & Qt::ShiftModifier) currentMouse = new MouseRotXRotY(); else { currentMouse = new MouseMove(); glmainwidget->setCursor(QCursor(Qt::ClosedHandCursor)); } bool result = currentMouse->eventFilter(widget, e); currentSpecInteractorComponent=currentMouse; //currentMouseID = abstractView->pushInteractor(currentMouse); return result; } return false; } if (e->type() == QEvent::MouseButtonRelease) { glmainwidget->setCursor(oldCursor); delete currentSpecInteractorComponent; currentSpecInteractorComponent=NULL; return true; } if (e->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); int delta = (ke->isAutoRepeat() ? 3 : 1); switch(ke->key()) { case Qt::Key_Left: glmainwidget->getScene()->translateCamera(delta * 2,0,0); break; case Qt::Key_Right: glmainwidget->getScene()->translateCamera(-1 * delta * 2,0,0); break; case Qt::Key_Up: glmainwidget->getScene()->translateCamera(0,-1 * delta * 2,0); break; case Qt::Key_Down: glmainwidget->getScene()->translateCamera(0,delta * 2,0); break; case Qt::Key_PageUp: glmainwidget->getScene()->zoom(delta); break; case Qt::Key_PageDown: glmainwidget->getScene()->zoom(-1 * delta); break; case Qt::Key_Home: glmainwidget->getScene()->translateCamera(0,0,-1 * delta * 2); break; case Qt::Key_End: glmainwidget->getScene()->translateCamera(0,0,delta * 2); break; case Qt::Key_Insert: glmainwidget->getScene()->rotateScene(0,0,-1 * delta * 2); break; case Qt::Key_Delete : glmainwidget->getScene()->rotateScene(0,0,delta * 2); break; default: return false; } glmainwidget->draw(); return true; } if (e->type() == QEvent::KeyRelease) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); switch(ke->key()) { case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: case Qt::Key_PageUp: case Qt::Key_PageDown: case Qt::Key_Home: case Qt::Key_End: case Qt::Key_Insert: case Qt::Key_Delete: break; default: return false; } return true; } return MousePanNZoomNavigator::eventFilter(widget, e); } void MouseNKeysNavigator::viewChanged(View *view) { nldc=static_cast<NodeLinkDiagramComponent*>(view); } void MouseNKeysNavigator::clear() {}
gpl-3.0
Diveboard/diveboard-web
test/Integration/src/def/testEnvironment.java
1236
package def; import java.util.Map; import java.util.Set; import java.util.Iterator; public class testEnvironment { //returnes true if runs on local and false if runs on tc.diveboard.com public static boolean checkLocal(){ Map map = System.getenv(); Set keys = map.keySet(); Iterator iterator = keys.iterator(); // System.out.println("Variable Names:"); while (iterator.hasNext()){ String key = (String) iterator.next(); if (key.equals("SSH_CONNECTION")) return false; // String value = (String) map.get(key); // System.out.println(key); } return true; } //returnes https://stage.diveboard.com if not found environment variable DB_ENV_ROOT_URL // and value if get the environment variable DB_ENV_ROOT_URL public static String checkUrl(){ Map map = System.getenv(); Set keys = map.keySet(); Iterator iterator = keys.iterator(); // System.out.println("Variable Names:"); while (iterator.hasNext()){ String key = (String) iterator.next(); if (key.equals("DB_ENV_ROOT_URL")) return (String) map.get(key); // System.out.println(key); } return "https://stage.diveboard.com/"; } }
gpl-3.0
mojo2012/factorio-mojo-resource-processing
prototypes/item/ore-processing/ore-gemstone.lua
389
require("ore-general") -- Minable ressources data.raw["resource"]["gem-ore"].minable.result = nil data.raw["resource"]["gem-ore"].minable.results = { ressourceItemMinMaxProb("gem-ore", 1, 1, 0.3), -- 1 item at percentage 0.9 -- ressourceItemMinMaxProb("gravel", 1, 1, 0.5), ressourceItemMinMaxProb("stone", 1, 1, 0.4), ressourceItemMinMaxProb("dirt", 1, 1, 0.7) }
gpl-3.0
LafayetteCollegeLibraries/geoserver-client
Shapefile.php
4609
<?php /** * @file Object-Oriented API for Islandora Shapefiles * @author griffinj@lafayette.edu * */ include_once __DIR__ . "/IslandoraGeoServerClient.php"; use IslandoraGeoServer\IslandoraGeoServerSession; use IslandoraGeoServer\IslandoraGeoServerClient; /** * Class for Islandora GeoTIFF Images * */ define('FEDORA_RELS_EXT_URI', 'info:fedora/fedora-system:def/relations-external#'); class IslandoraGeoImage extends IslandoraLargeImage { public $geoserver_session; public $shapefiles; public $coverage_name; // hasDerivation // GeoServerCoverageStore function __construct($islandora_session, $geoserver_session = NULL, $pid = NULL, $workspace = 'default', $object = NULL) { parent::__construct($islandora_session, $pid, $object); //$this->coverage_name = preg_replace('/\:/', '_', $this->object->id); $this->coverage_name = preg_replace('/\:/', '_', $pid); if(!is_a($this->object, 'FedoraObject')) { throw new Exception("Failed to pass a tuque FedoraObject to the IslandoraGeoImage constructor"); } if(!is_null($geoserver_session)) { $this->client = new IslandoraGeoServerClient($geoserver_session); $workspace = $this->client->workspace($workspace); //$file_path = '/var/www/drupal/sites/all/modules/islandora_dss_solution_pack_gis/islandora_gis_geoserver/eapl-sanborn-easton-1919_010_modified.tif'; $file_path = '/tmp/IslandoraGeoImage_' . $this->coverage_name . '.tiff'; $ds_obj = $this->datastream('OBJ'); $ds_obj->getContent($file_path); $workspace->createCoverageStore($this->coverage_name, $file_path); unlink($file_path); } } function add_shapefile($shapefile) { $shapefile_uri = $shapefile->id; $this->object->relationships->add(FEDORA_RELS_EXT_URI, 'hasDependent', $shapefile_uri); } function to_layer() { $layer = new stdClass(); $layer->name = $this->coverage_name; $layer->title = $this->object->label; $layer->data = array('openlayers' => array('gwc_data' => array('isBaseLayer' => TRUE, 'projection' => array('EPSG:900913', 'EPSG:3857')))); return $layer; /* $openlayers = $gs_layer->data['openlayers']; if ($openlayers['gwc']) { $data = isset($openlayers['gwc_data']) ? $openlayers['gwc_data'] : array(); */ /* 'isBaseLayer' => isset($data['isBaseLayer']) ? $data['isBaseLayer'] : FALSE, 'projection' => isset($data['projection']) ? $data['projection'] : array('EPSG:900913', 'EPSG:3857'), 'params' => array( 'isBaseLayer' => isset($data['isBaseLayer']) ? $data['isBaseLayer'] : FALSE, */ } } /* * Class for Islandora Shapefiles * */ class IslandoraShapefile extends IslandoraObject { public $geoserver_session; public $base_maps; function __construct($session, $geoserver_session = NULL, $pid = NULL, $object = NULL) { parent::__construct($session, $pid, $object); $this->geoserver_session = $geoserver_session; $this->base_maps = array(); $this->get_base_maps(); if(!is_null($geoserver_session)) { $this->client = new IslandoraGeoServerClient($geoserver_session); $workspace = $this->client->workspace($workspace); //$file_path = '/var/www/drupal/sites/all/modules/islandora_dss_solution_pack_gis/islandora_gis_geoserver/eapl-sanborn-easton-1919_010_modified.tif'; $file_path = '/tmp/IslandoraGeoImage_' . $this->coverage_name . '.shp'; $ds_obj = $this->datastream('OBJ'); $ds_obj->getContent($file_path); $workspace->createDataStore($this->coverage_name, $file_path); unlink($file_path); } } function get_base_maps() { $query = 'SELECT $object $title $content FROM <#ri> WHERE { $object <fedora-rels-ext:hasDependent> <info:fedora/' . $this->object->id . '> ; <fedora-model:label> $title ; <fedora-model:hasModel> $content ; <fedora-model:state> <fedora-model:Active> .'; $query .= '} ORDER BY $title'; $query_array = array('query' => $query, 'type' => 'sparql', //'pid' => $obj_pid, // Seems as though this is ignored completely. //'page_size' => $page_size, //'page_number' => $page_number, ); foreach($this->session->connection->repository->ri->query($query_array['query'], $query_array['type']) as $result) { $this->base_maps[] = new IslandoraGeoImage($this->session, $this->geoserver_session, $result['object']['value']); } } function to_layer() { } }
gpl-3.0
teddy-michel/TMediaPlayer
Sources/Dialog/CDialogEditMetadata.cpp
25929
/* Copyright (C) 2012-2016 Teddy Michel This file is part of TMediaPlayer. TMediaPlayer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. TMediaPlayer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with TMediaPlayer. If not, see <http://www.gnu.org/licenses/>. */ #include "CDialogEditMetadata.hpp" #include "CDialogEditXiphComment.hpp" #include "../CSong.hpp" #include "../CMainWindow.hpp" #include "../CMediaManager.hpp" #include <QPushButton> #include <QStandardItemModel> #include <QMessageBox> // TagLib #include <fileref.h> #include <tag.h> #include <flac/flacfile.h> #include <mpeg/mpegfile.h> #include <ogg/vorbis/vorbisfile.h> #include <wavpack/wavpackfile.h> #include <toolkit/tmap.h> #include <mpeg/id3v1/id3v1tag.h> #include <mpeg/id3v1/id3v1genres.h> #include <mpeg/id3v2/id3v2tag.h> #include <ape/apetag.h> #include <ogg/xiphcomment.h> #include <mpeg/id3v2/frames/textidentificationframe.h> #include <mpeg/id3v2/frames/urllinkframe.h> #include <mpeg/id3v2/frames/unsynchronizedlyricsframe.h> #include <mpeg/id3v2/frames/commentsframe.h> #include <QtDebug> /** * Construit la boite de dialogue. * * \param mainWindow Pointeur sur la fenêtre principale de l'application. * \param song Morceau dont on veut afficher les métadonnées. */ CDialogEditMetadata::CDialogEditMetadata(CMainWindow * mainWindow, CSong * song) : QDialog (mainWindow), m_uiWidget (new Ui::DialogEditMetadata()), m_mainWindow (mainWindow), m_song (song) { Q_CHECK_PTR(m_mainWindow); Q_CHECK_PTR(song); setAttribute(Qt::WA_DeleteOnClose); m_uiWidget->setupUi(this); const QString songTitle = m_song->getTitle(); const QString songArtist = m_song->getArtistName(); if (songArtist.isEmpty()) setWindowTitle(tr("Metadata") + " - " + songTitle); else setWindowTitle(tr("Metadata") + " - " + songTitle + " - " + songArtist); // Genres ID3v1 TagLib::StringList genreList = TagLib::ID3v1::genreList(); for (TagLib::StringList::ConstIterator it = genreList.begin(); it != genreList.end(); ++it) { m_uiWidget->editID3v1Genre->addItem(QString::fromUtf8(it->toCString(true))); } m_uiWidget->editID3v1Genre->setCurrentIndex(-1); // Modèles m_modelID3v2Text = new QStandardItemModel(this); m_uiWidget->tableID3v2Text->setModel(m_modelID3v2Text); m_modelID3v2URL = new QStandardItemModel(this); m_uiWidget->tableID3v2URL->setModel(m_modelID3v2URL); m_modelID3v2Lyrics = new QStandardItemModel(this); m_uiWidget->tableID3v2Lyrics->setModel(m_modelID3v2Lyrics); m_modelID3v2Comments = new QStandardItemModel(this); m_uiWidget->tableID3v2Comments->setModel(m_modelID3v2Comments); m_modelID3v2Pictures = new QStandardItemModel(this); m_uiWidget->tableID3v2Pictures->setModel(m_modelID3v2Pictures); m_modelAPE = new QStandardItemModel(this); m_uiWidget->tableAPE->setModel(m_modelAPE); m_modelXiphComment = new QStandardItemModel(this); m_uiWidget->tableXiphComment->setModel(m_modelXiphComment); // Connexions des signaux des boutons QPushButton * btnSave = m_uiWidget->buttonBox->addButton(tr("Save"), QDialogButtonBox::AcceptRole); QPushButton * btnCancel = m_uiWidget->buttonBox->addButton(tr("Cancel"), QDialogButtonBox::RejectRole); QPushButton * btnApply = m_uiWidget->buttonBox->addButton(tr("Apply"), QDialogButtonBox::ApplyRole); QPushButton * btnReset = m_uiWidget->buttonBox->addButton(tr("Reset"), QDialogButtonBox::ResetRole); // TODO: Enlever ces 2 lignes quand tout sera fonctionnel btnSave->setEnabled(false); btnApply->setEnabled(false); connect(btnSave, SIGNAL(clicked()), this, SLOT(save())); connect(btnCancel, SIGNAL(clicked()), this, SLOT(close())); connect(btnApply, SIGNAL(clicked()), this, SLOT(apply())); connect(btnReset, SIGNAL(clicked()), this, SLOT(reset())); connect(m_uiWidget->enableID3v1, SIGNAL(clicked(bool)), this, SLOT(enableTagID3v1(bool))); connect(m_uiWidget->enableID3v2, SIGNAL(clicked(bool)), this, SLOT(enableTagID3v2(bool))); connect(m_uiWidget->enableAPE, SIGNAL(clicked(bool)), this, SLOT(enableTagAPE(bool))); connect(m_uiWidget->enableXiphComment, SIGNAL(clicked(bool)), this, SLOT(enableTagXiphComment(bool))); // Boutons d'édition connect(m_uiWidget->buttonXiphAdd, SIGNAL(clicked()), this, SLOT(addXiphTag())); connect(m_uiWidget->buttonXiphEdit, SIGNAL(clicked()), this, SLOT(editSelectedXiphTag())); connect(m_uiWidget->buttonXiphRemove, SIGNAL(clicked()), this, SLOT(removeSelectedXiphTag())); connect(m_uiWidget->tableXiphComment->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(selectedXiphChanged(QModelIndex, QModelIndex))); // Suppression des onglets selon le format du morceau switch (m_song->getFormat()) { default: m_mainWindow->getMediaManager()->logError(tr("unknown format"), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; case CSong::FormatMP3: m_uiWidget->tabWidget->removeTab(3); break; case CSong::FormatOGG: m_uiWidget->tabWidget->removeTab(0); m_uiWidget->tabWidget->removeTab(1); m_uiWidget->tabWidget->removeTab(2); break; case CSong::FormatFLAC: m_uiWidget->tabWidget->removeTab(2); break; case CSong::FormatWAV: m_uiWidget->tabWidget->removeTab(1); m_uiWidget->tabWidget->removeTab(3); break; } reset(); } /** * Détruit la boite de dialogue. */ CDialogEditMetadata::~CDialogEditMetadata() { delete m_uiWidget; } /** * Enregistre les modifications effectuées sur le morceau. * * \todo Implémentation. */ void CDialogEditMetadata::apply() { //... } /** * Enregistre les modifications effectuées sur le morceau et ferme la boite de dialogue. */ void CDialogEditMetadata::save() { apply(); close(); } /** * Recharge les métadonnées du morceau. */ void CDialogEditMetadata::reset() { m_uiWidget->buttonXiphEdit->setEnabled(false); m_uiWidget->buttonXiphRemove->setEnabled(false); // Titres des colonnes m_modelID3v2Text->clear(); m_modelID3v2Text->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value")); m_modelID3v2URL->clear(); m_modelID3v2URL->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value")); m_modelID3v2Lyrics->clear(); m_modelID3v2Lyrics->setHorizontalHeaderLabels(QStringList() << tr("Description") << tr("Language") << tr("Lyrics")); m_modelID3v2Comments->clear(); m_modelID3v2Comments->setHorizontalHeaderLabels(QStringList() << tr("Description") << tr("Language") << tr("Comments")); m_modelID3v2Pictures->clear(); m_modelID3v2Pictures->setHorizontalHeaderLabels(QStringList() << tr("Description") << tr("Type") << tr("Format") << tr("Size")); m_modelAPE->clear(); m_modelAPE->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value")); m_modelXiphComment->clear(); m_modelXiphComment->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value")); switch (m_song->getFormat()) { default: m_mainWindow->getMediaManager()->logError(tr("unknown format"), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; case CSong::FormatMP3: { #ifdef Q_OS_WIN32 //TagLib::MPEG::File file(qPrintable(m_song->getFileName()), false); TagLib::MPEG::File file(reinterpret_cast<const wchar_t *>(m_song->getFileName().constData()), false); #else TagLib::MPEG::File file(qPrintable(m_song->getFileName()), false); #endif if (!file.isValid()) { m_mainWindow->getMediaManager()->logError(tr("can't read the MP3 file \"%1\"").arg(m_song->getFileName()), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; } initTagID3v1(file.ID3v1Tag(true)); initTagID3v2(file.ID3v2Tag(true)); initTagAPE(file.APETag(false)); initTagXiphComment(nullptr); break; } case CSong::FormatOGG: { #ifdef Q_OS_WIN32 //TagLib::Ogg::Vorbis::File file(qPrintable(m_song->getFileName()), false); TagLib::Ogg::Vorbis::File file(reinterpret_cast<const wchar_t *>(m_song->getFileName().constData()), false); #else TagLib::Ogg::Vorbis::File file(qPrintable(m_song->getFileName()), false); #endif if (!file.isValid()) { m_mainWindow->getMediaManager()->logError(tr("can't read the Ogg file \"%1\"").arg(m_song->getFileName()), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; } initTagID3v1(nullptr); initTagID3v2(nullptr); initTagAPE(nullptr); initTagXiphComment(file.tag()); break; } case CSong::FormatFLAC: { #ifdef Q_OS_WIN32 //TagLib::FLAC::File file(qPrintable(m_song->getFileName()), false); TagLib::FLAC::File file(reinterpret_cast<const wchar_t *>(m_song->getFileName().constData()), false); #else TagLib::FLAC::File file(qPrintable(m_song->getFileName()), false); #endif if (!file.isValid()) { m_mainWindow->getMediaManager()->logError(tr("can't read the FLAC file \"%1\"").arg(m_song->getFileName()), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; } initTagID3v1(file.ID3v1Tag(false)); initTagID3v2(file.ID3v2Tag(false)); initTagAPE(nullptr); initTagXiphComment(file.xiphComment(true)); break; } case CSong::FormatWAV: { #ifdef Q_OS_WIN32 //TagLib::WavPack::File file(qPrintable(m_song->getFileName()), false); TagLib::WavPack::File file(reinterpret_cast<const wchar_t *>(m_song->getFileName().constData()), false); #else TagLib::WavPack::File file(qPrintable(m_song->getFileName()), false); #endif if (!file.isValid()) { m_mainWindow->getMediaManager()->logError(tr("can't read the WAV file \"%1\"").arg(m_song->getFileName()), __FUNCTION__, __FILE__, __LINE__); QMessageBox::warning(m_mainWindow, QString(), tr("Error while loading tags."), QMessageBox::Ok); close(); return; } initTagID3v1(file.ID3v1Tag(true)); initTagID3v2(nullptr); initTagAPE(file.APETag(false)); initTagXiphComment(nullptr); break; } } } /** * Active ou désactive les tags ID3 v1. * * \param enable True si on veut activer les tags ID3 v1, false sinon. */ void CDialogEditMetadata::enableTagID3v1(bool enable) { m_uiWidget->enableID3v1->setChecked(enable); m_uiWidget->editID3v1Title->setEnabled(enable); m_uiWidget->editID3v1Artist->setEnabled(enable); m_uiWidget->editID3v1Album->setEnabled(enable); m_uiWidget->editID3v1Year->setEnabled(enable); m_uiWidget->editID3v1Comments->setEnabled(enable); m_uiWidget->editID3v1Track->setEnabled(enable); m_uiWidget->editID3v1Genre->setEnabled(enable); } /** * Active ou désactive les tags ID3 v2. * * \param enable True si on veut activer les tags ID3 v2, false sinon. */ void CDialogEditMetadata::enableTagID3v2(bool enable) { m_uiWidget->enableID3v2->setChecked(enable); m_uiWidget->tabID3v2Type->setEnabled(enable); } /** * Active ou désactive les tags APE. * * \param enable True si on veut activer les tags APE, false sinon. */ void CDialogEditMetadata::enableTagAPE(bool enable) { m_uiWidget->enableAPE->setChecked(enable); m_uiWidget->tableAPE->setEnabled(enable); } /** * Active ou désactive les tags XiphComment. * * \param enable True si on veut activer les tags XiphComment, false sinon. */ void CDialogEditMetadata::enableTagXiphComment(bool enable) { m_uiWidget->enableXiphComment->setChecked(enable); m_uiWidget->tableXiphComment->setEnabled(enable); } /** * Initialise l'onglet avec les tags ID3 version 1. * * \param tags Tags à afficher. */ void CDialogEditMetadata::initTagID3v1(TagLib::ID3v1::Tag * tags) { enableTagID3v1(tags); if (tags == nullptr) { return; } m_uiWidget->editID3v1Title->setText(QString::fromUtf8(tags->title().toCString(true))); m_uiWidget->editID3v1Artist->setText(QString::fromUtf8(tags->artist().toCString(true))); m_uiWidget->editID3v1Album->setText(QString::fromUtf8(tags->album().toCString(true))); m_uiWidget->editID3v1Year->setValue(tags->year()); m_uiWidget->editID3v1Comments->setText(QString::fromUtf8(tags->comment().toCString(true))); m_uiWidget->editID3v1Track->setValue(tags->track()); m_uiWidget->editID3v1Genre->setCurrentIndex(TagLib::ID3v1::genreIndex(tags->genre())); } /** * Initialise l'onglet avec les tags ID3 version 2. * * \todo Implémentation complète. * * \param tags Tags à afficher. */ void CDialogEditMetadata::initTagID3v2(TagLib::ID3v2::Tag * tags) { enableTagID3v2(tags); if (tags == nullptr) { return; } TagLib::ID3v2::FrameListMap tagMap = tags->frameListMap(); // Liste des tags for (TagLib::ID3v2::FrameListMap::ConstIterator it = tagMap.begin(); it != tagMap.end(); ++it) { QString tagKey = QByteArray(it->first.data(), it->first.size()); for (TagLib::ID3v2::FrameList::ConstIterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { // Texte { TagLib::ID3v2::TextIdentificationFrame * frame = dynamic_cast<TagLib::ID3v2::TextIdentificationFrame *>(*it2); if (frame) { QList<QStandardItem *> itemList; itemList.append(new QStandardItem(tagKey)); itemList.append(new QStandardItem(QString::fromUtf8(frame->toString().toCString(true)))); m_modelID3v2Text->appendRow(itemList); continue; } } // URL { TagLib::ID3v2::UrlLinkFrame * frame = dynamic_cast<TagLib::ID3v2::UrlLinkFrame *>(*it2); if (frame) { QList<QStandardItem *> itemList; itemList.append(new QStandardItem(tagKey)); itemList.append(new QStandardItem(QString::fromUtf8(frame->url().toCString(true)))); m_modelID3v2URL->appendRow(itemList); continue; } } // Paroles { TagLib::ID3v2::UnsynchronizedLyricsFrame * frame = dynamic_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame *>(*it2); if (frame) { QList<QStandardItem *> itemList; itemList.append(new QStandardItem(QString::fromUtf8(frame->description().toCString(true)))); itemList.append(new QStandardItem(getLanguageName(getLanguageForISO3Code(QByteArray(frame->language().data(), 3))))); itemList.append(new QStandardItem(QString::fromUtf8(frame->text().toCString(true)))); m_modelID3v2Lyrics->appendRow(itemList); continue; } } // Commentaires { TagLib::ID3v2::CommentsFrame * frame = dynamic_cast<TagLib::ID3v2::CommentsFrame *>(*it2); if (frame) { QList<QStandardItem *> itemList; itemList.append(new QStandardItem(QString::fromUtf8(frame->description().toCString(true)))); itemList.append(new QStandardItem(getLanguageName(getLanguageForISO3Code(QByteArray(frame->language().data(), 3))))); itemList.append(new QStandardItem(QString::fromUtf8(frame->text().toCString(true)))); m_modelID3v2Comments->appendRow(itemList); continue; } } // Illustrations { TagLib::ID3v2::AttachedPictureFrame * frame = dynamic_cast<TagLib::ID3v2::AttachedPictureFrame *>(*it2); if (frame) { QList<QStandardItem *> itemList; itemList.append(new QStandardItem(QString::fromUtf8(frame->description().toCString(true)))); itemList.append(new QStandardItem(pictureType(frame->type()))); itemList.append(new QStandardItem(QString::fromUtf8(frame->mimeType().toCString(true)))); itemList.append(new QStandardItem(QString::number(frame->picture().size()))); m_modelID3v2Pictures->appendRow(itemList); continue; } } //... } } } /** * Retourne une chaine correspondant à un type d'illustration. * * \param type Type d'illustration. * \return Chaine de caractères. */ QString CDialogEditMetadata::pictureType(TagLib::ID3v2::AttachedPictureFrame::Type type) const { switch (type) { default: case TagLib::ID3v2::AttachedPictureFrame::Other: return tr("Other"); case TagLib::ID3v2::AttachedPictureFrame::FileIcon: return tr("FileIcon"); case TagLib::ID3v2::AttachedPictureFrame::OtherFileIcon: return tr("OtherFileIcon"); case TagLib::ID3v2::AttachedPictureFrame::FrontCover: return tr("FrontCover"); case TagLib::ID3v2::AttachedPictureFrame::BackCover: return tr("BackCover"); case TagLib::ID3v2::AttachedPictureFrame::LeafletPage: return tr("LeafletPage"); case TagLib::ID3v2::AttachedPictureFrame::Media: return tr("Media"); case TagLib::ID3v2::AttachedPictureFrame::LeadArtist: return tr("LeadArtist"); case TagLib::ID3v2::AttachedPictureFrame::Artist: return tr("Artist"); case TagLib::ID3v2::AttachedPictureFrame::Conductor: return tr("Conductor"); case TagLib::ID3v2::AttachedPictureFrame::Band: return tr("Band"); case TagLib::ID3v2::AttachedPictureFrame::Composer: return tr("Composer"); case TagLib::ID3v2::AttachedPictureFrame::Lyricist: return tr("Lyricist"); case TagLib::ID3v2::AttachedPictureFrame::RecordingLocation: return tr("RecordingLocation"); case TagLib::ID3v2::AttachedPictureFrame::DuringRecording: return tr("DuringRecording"); case TagLib::ID3v2::AttachedPictureFrame::DuringPerformance: return tr("DuringPerformance"); case TagLib::ID3v2::AttachedPictureFrame::MovieScreenCapture: return tr("MovieScreenCapture"); case TagLib::ID3v2::AttachedPictureFrame::ColouredFish: return tr("ColouredFish"); case TagLib::ID3v2::AttachedPictureFrame::Illustration: return tr("Illustration"); case TagLib::ID3v2::AttachedPictureFrame::BandLogo: return tr("BandLogo"); case TagLib::ID3v2::AttachedPictureFrame::PublisherLogo: return tr("PublisherLogo"); } } /** * Initialise l'onglet avec les tags APE. * * \todo Afficher les tags binaires et locator. * * \param tags Tags APE. */ void CDialogEditMetadata::initTagAPE(TagLib::APE::Tag * tags) { enableTagAPE(tags); if (tags == nullptr) { return; } TagLib::APE::ItemListMap tagMap = tags->itemListMap(); // Liste des tags for (TagLib::APE::ItemListMap::ConstIterator it = tagMap.begin(); it != tagMap.end(); ++it) { switch (it->second.type()) { case TagLib::APE::Item::Text: { QString tagValue = QString::fromUtf8(it->second.values().toString().toCString(true)).replace('\r', ' ').replace('\n', ' '); QList<QStandardItem *> itemList; itemList.append(new QStandardItem(QString::fromUtf8(it->first.toCString(true)))); if (tagValue.size() > 100) itemList.append(new QStandardItem(tagValue.left(100-6) + " [...]")); else itemList.append(new QStandardItem(tagValue)); m_modelAPE->appendRow(itemList); break; } case TagLib::APE::Item::Binary: //... break; case TagLib::APE::Item::Locator: //... break; } } } /** * Initialise l'onglet avec les tags xiphComment. * * \param tags Tags xiphComment. */ void CDialogEditMetadata::initTagXiphComment(TagLib::Ogg::XiphComment * tags) { enableTagXiphComment(tags); if (tags == nullptr) { return; } TagLib::Ogg::FieldListMap tagMap = tags->fieldListMap(); for (TagLib::Ogg::FieldListMap::ConstIterator it = tagMap.begin(); it != tagMap.end(); ++it) { QString tagKey = QString::fromUtf8(it->first.toCString(true)); for (TagLib::StringList::ConstIterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { QString tagValue = QString::fromUtf8(it2->toCString(true)); QStandardItem * itemValue = new QStandardItem(); itemValue->setData(tagValue, Qt::UserRole + 1); if (tagValue.size() > 100) { itemValue->setText(tagValue.replace('\r', ' ').replace('\n', ' ').left(100-6) + " [...]"); } else { itemValue->setText(tagValue.replace('\r', ' ').replace('\n', ' ')); } QList<QStandardItem *> itemList; itemList.append(new QStandardItem(tagKey)); itemList.append(itemValue); m_modelXiphComment->appendRow(itemList); } } } void CDialogEditMetadata::addXiphTag() { CDialogEditXiphComment dialog(m_mainWindow); if (dialog.exec() == QDialog::Rejected) { return; } QString tag = dialog.getTag(); QString value = dialog.getValue(); // Modification du modèle QStandardItem * itemValue = new QStandardItem(); itemValue->setData(value, Qt::UserRole + 1); if (value.size() > 100) { itemValue->setText(value.left(100-6) + " [...]"); } else { itemValue->setText(value); } QList<QStandardItem *> itemList; itemList.append(new QStandardItem(tag)); itemList.append(itemValue); m_modelXiphComment->appendRow(itemList); } void CDialogEditMetadata::editSelectedXiphTag() { QModelIndexList selectedRows = m_uiWidget->tableXiphComment->selectionModel()->selectedRows(); if (selectedRows.isEmpty()) { return; } QStandardItem * itemTag = m_modelXiphComment->item(selectedRows.at(0).row(), 0); QStandardItem * itemValue = m_modelXiphComment->item(selectedRows.at(0).row(), 1); if (itemTag == nullptr || itemValue == nullptr) { return; } CDialogEditXiphComment dialog(m_mainWindow, itemTag->text(), itemValue->data(Qt::UserRole + 1).toString()); if (dialog.exec() == QDialog::Rejected) { return; } // Modification du modèle itemTag->setText(dialog.getTag()); QString value = dialog.getValue(); itemValue->setData(value, Qt::UserRole + 1); if (value.size() > 100) { itemValue->setText(value.left(100-6) + " [...]"); } else { itemValue->setText(value); } } void CDialogEditMetadata::removeSelectedXiphTag() { QModelIndexList selectedRows = m_uiWidget->tableXiphComment->selectionModel()->selectedIndexes(); if (selectedRows.isEmpty()) { return; } // Confirmation QMessageBox dialog(QMessageBox::Question, QString(), tr("Are you sure you want to remove this tag?"), QMessageBox::NoButton, this); /*QPushButton * buttonYes =*/ dialog.addButton(tr("Yes"), QMessageBox::YesRole); QPushButton * buttonNo = dialog.addButton(tr("No"), QMessageBox::NoRole); dialog.exec(); if (dialog.clickedButton() == buttonNo) { return; } // Suppression du tag m_modelXiphComment->removeRow(selectedRows.at(0).row()); } void CDialogEditMetadata::selectedXiphChanged(const QModelIndex& current, const QModelIndex& previous) { Q_UNUSED(previous); if (current.isValid()) { m_uiWidget->buttonXiphEdit->setEnabled(false); m_uiWidget->buttonXiphRemove->setEnabled(false); } else { m_uiWidget->buttonXiphEdit->setEnabled(true); m_uiWidget->buttonXiphRemove->setEnabled(true); } }
gpl-3.0
active-citizen/android.java
app/src/main/java/ru/mos/polls/profile/state/AddPrivatePropertyState.java
1103
package ru.mos.polls.profile.state; import android.content.Context; import android.support.annotation.Nullable; import me.ilich.juggler.gui.JugglerFragment; import me.ilich.juggler.states.ContentBelowToolbarState; import me.ilich.juggler.states.VoidParams; import ru.mos.polls.R; import ru.mos.polls.base.ui.CommonToolbarFragment; import ru.mos.polls.profile.ui.fragment.AddressesPropertyFragment; public class AddPrivatePropertyState extends ContentBelowToolbarState<VoidParams> { public AddPrivatePropertyState(@Nullable VoidParams params) { super(params); } @Override protected JugglerFragment onConvertContent(VoidParams params, @Nullable JugglerFragment fragment) { return AddressesPropertyFragment.newInstance(); } @Override protected JugglerFragment onConvertToolbar(VoidParams params, @Nullable JugglerFragment fragment) { return CommonToolbarFragment.createBack(); } @Nullable @Override public String getTitle(Context context, VoidParams params) { return context.getString(R.string.property_addresses); } }
gpl-3.0
ecbush/xenoGI
xenoGI/Island.py
2390
class LocusIsland: def __init__(self, idnum, mrca, locusFamilyL): '''Create a LocusIsland object.''' self.id = idnum self.mrca = mrca self.locusFamilyL=locusFamilyL # list of locus family numbers in the island, in order def __repr__(self): return "<id:"+str(self.id)+", mrca:"+str(self.mrca)+", locusFamilyL:"+str(self.locusFamilyL)+">" def __len__(self): return len(self.locusFamilyL) def fileStr(self): '''Return a string which can be used for saving a island compactly in a file.''' return str(self.id)+"\t"+self.mrca+"\t"+",".join(map(str,self.locusFamilyL)) def merge(self,other,orientation): '''Merge island other into self. The argument orientation tells us which orientation to combine the families of self and other in. The meaning of the different values is determined by the cases in the score function. ''' if orientation == 0: newFamilyL= self.locusFamilyL + other.locusFamilyL elif orientation == 1: newFamilyL= self.locusFamilyL + other.locusFamilyL[::-1] elif orientation == 2: newFamilyL= other.locusFamilyL[::-1] + self.locusFamilyL elif orientation == 3: newFamilyL= other.locusFamilyL + self.locusFamilyL self.locusFamilyL=newFamilyL def iterLocusFamilies(self,familiesO): '''Iterates, yielding LocusFamily objects.''' for locusFamNum in self.locusFamilyL: yield familiesO.getLocusFamily(locusFamNum) def iterGenes(self,familiesO): '''Iterate though all the genes in this LocusIsland.''' for lfO in self.iterLocusFamilies(familiesO): for gene in lfO.iterGenes(): yield gene def getLocusFamilyOriginStr(self,familiesO,rootFocalClade): '''Return a string with the origin for each locus family in the island (C,X,R).''' L = [] for lfO in self.iterLocusFamilies(familiesO): L.append(lfO.origin(familiesO,rootFocalClade)) return "".join(L) def str2Island(islandStr): '''Given a island string (e.g. produced by the fileStr method) parse to produce island.''' L=islandStr.split('\t') id=int(L[0]) mrca=L[1] locusFamilyL=[int(x) for x in L[2].split(',')] return LocusIsland(id,mrca,locusFamilyL)
gpl-3.0
emakis/erpnext
erpnext/public/js/controllers/transaction.js
35824
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt erpnext.TransactionController = erpnext.taxes_and_totals.extend({ setup: function() { this._super(); frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) { var item = frappe.get_doc(cdt, cdn); var has_margin_field = frappe.meta.has_field(cdt, 'margin_type'); frappe.model.round_floats_in(item, ["rate", "price_list_rate"]); if(item.price_list_rate) { if(item.rate > item.price_list_rate && has_margin_field) { // if rate is greater than price_list_rate, set margin // or set discount item.discount_percentage = 0; item.margin_type = 'Amount'; item.margin_rate_or_amount = flt(item.rate - item.price_list_rate, precision("margin_rate_or_amount", item)); item.rate_with_margin = item.rate; } else { item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0, precision("discount_percentage", item)); item.margin_type = ''; item.margin_rate_or_amount = 0; item.rate_with_margin = 0; } } else { item.discount_percentage = 0.0; item.margin_type = ''; item.margin_rate_or_amount = 0; item.rate_with_margin = 0; } cur_frm.cscript.set_gross_profit(item); cur_frm.cscript.calculate_taxes_and_totals(); }) frappe.ui.form.on(this.frm.cscript.tax_table, "rate", function(frm, cdt, cdn) { cur_frm.cscript.calculate_taxes_and_totals(); }); frappe.ui.form.on(this.frm.cscript.tax_table, "tax_amount", function(frm, cdt, cdn) { cur_frm.cscript.calculate_taxes_and_totals(); }); frappe.ui.form.on(this.frm.cscript.tax_table, "row_id", function(frm, cdt, cdn) { cur_frm.cscript.calculate_taxes_and_totals(); }); frappe.ui.form.on(this.frm.cscript.tax_table, "included_in_print_rate", function(frm, cdt, cdn) { cur_frm.cscript.set_dynamic_labels(); cur_frm.cscript.calculate_taxes_and_totals(); }); frappe.ui.form.on(this.frm.doctype, "apply_discount_on", function(frm) { if(frm.doc.additional_discount_percentage) { frm.trigger("additional_discount_percentage"); } else { cur_frm.cscript.calculate_taxes_and_totals(); } }); frappe.ui.form.on(this.frm.doctype, "additional_discount_percentage", function(frm) { if(!frm.doc.apply_discount_on) { frappe.msgprint(__("Please set 'Apply Additional Discount On'")); return; } frm.via_discount_percentage = true; if(frm.doc.additional_discount_percentage && frm.doc.discount_amount) { // Reset discount amount and net / grand total frm.doc.discount_amount = 0; frm.cscript.calculate_taxes_and_totals(); } var total = flt(frm.doc[frappe.model.scrub(frm.doc.apply_discount_on)]); var discount_amount = flt(total*flt(frm.doc.additional_discount_percentage) / 100, precision("discount_amount")); frm.set_value("discount_amount", discount_amount) .then(() => delete frm.via_discount_percentage); }); frappe.ui.form.on(this.frm.doctype, "discount_amount", function(frm) { frm.cscript.set_dynamic_labels(); if (!frm.via_discount_percentage) { frm.doc.additional_discount_percentage = 0; } frm.cscript.calculate_taxes_and_totals(); }); var me = this; if(this.frm.fields_dict["items"].grid.get_field('batch_no')) { this.frm.set_query("batch_no", "items", function(doc, cdt, cdn) { return me.set_query_for_batch(doc, cdt, cdn) }); } }, onload: function() { var me = this; if(this.frm.doc.__islocal) { var today = frappe.datetime.get_today(), currency = frappe.defaults.get_user_default("currency"); $.each({ currency: currency, price_list_currency: currency, status: "Draft", is_subcontracted: "No", }, function(fieldname, value) { if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) me.frm.set_value(fieldname, value); }); if(this.frm.doc.company && !this.frm.doc.amended_from) { this.frm.trigger("company"); } } if(this.frm.fields_dict["taxes"]) { this["taxes_remove"] = this.calculate_taxes_and_totals; } if(this.frm.fields_dict["items"]) { this["items_remove"] = this.calculate_taxes_and_totals; } if(this.frm.fields_dict["recurring_print_format"]) { this.frm.set_query("recurring_print_format", function(doc) { return{ filters: [ ['Print Format', 'doc_type', '=', cur_frm.doctype], ] } }); } if(this.frm.fields_dict["return_against"]) { this.frm.set_query("return_against", function(doc) { var filters = { "docstatus": 1, "is_return": 0, "company": doc.company }; if (me.frm.fields_dict["customer"] && doc.customer) filters["customer"] = doc.customer; if (me.frm.fields_dict["supplier"] && doc.supplier) filters["supplier"] = doc.supplier; return { filters: filters } }); } this.setup_quality_inspection(); }, setup_quality_inspection: function() { if(!in_list(["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)) { return; } var me = this; var inspection_type = in_list(["Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype) ? "Incoming" : "Outgoing"; var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection"); quality_inspection_field.get_route_options_for_new_doc = function(row) { if(me.frm.is_new()) return; return { "inspection_type": inspection_type, "reference_type": me.frm.doc.doctype, "reference_name": me.frm.doc.name, "item_code": row.doc.item_code, "description": row.doc.description, "item_serial_no": row.doc.serial_no ? row.doc.serial_no.split("\n")[0] : null, "batch_no": row.doc.batch_no } } this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { filters: { docstatus: 1, inspection_type: inspection_type, item_code: d.item_code } } }); }, onload_post_render: function() { var me = this; if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length && !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) { this.apply_default_taxes(); } else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"] && !this.frm.doc.is_pos) { me.calculate_taxes_and_totals(); } if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) { this.setup_item_selector(); } }, refresh: function() { erpnext.toggle_naming_series(); erpnext.hide_company(); this.show_item_wise_taxes(); this.set_dynamic_labels(); this.setup_sms(); }, apply_default_taxes: function() { var me = this; var taxes_and_charges_field = frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges", me.frm.doc.name); if(taxes_and_charges_field) { return frappe.call({ method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges", args: { "master_doctype": taxes_and_charges_field.options }, callback: function(r) { if(!r.exc) { me.frm.set_value("taxes", r.message); me.calculate_taxes_and_totals(); } } }); } }, setup_sms: function() { var me = this; if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status) && this.frm.doctype != "Purchase Invoice") { this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); }); } }, send_sms: function() { var sms_man = new erpnext.SMSManager(this.frm.doc); }, barcode: function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if(d.barcode=="" || d.barcode==null) { // barcode cleared, remove item d.item_code = ""; } this.item_code(doc, cdt, cdn, true); }, item_code: function(doc, cdt, cdn, from_barcode) { var me = this; var item = frappe.get_doc(cdt, cdn); var update_stock = 0, show_batch_dialog = 0; if(['Sales Invoice', 'Purchase Invoice'].includes(this.frm.doc.doctype)) { update_stock = cint(me.frm.doc.update_stock); show_batch_dialog = update_stock; } else if((this.frm.doc.doctype === 'Purchase Receipt' && me.frm.doc.is_return) || this.frm.doc.doctype === 'Delivery Note') { show_batch_dialog = 1; } // clear barcode if setting item (else barcode will take priority) if(!from_barcode) { item.barcode = null; } if(item.item_code || item.barcode || item.serial_no) { if(!this.validate_company_and_party()) { this.frm.fields_dict["items"].grid.grid_rows[item.idx - 1].remove(); } else { return this.frm.call({ method: "erpnext.stock.get_item_details.get_item_details", child: item, args: { args: { item_code: item.item_code, barcode: item.barcode, serial_no: item.serial_no, warehouse: item.warehouse, customer: me.frm.doc.customer, supplier: me.frm.doc.supplier, currency: me.frm.doc.currency, update_stock: update_stock, conversion_rate: me.frm.doc.conversion_rate, price_list: me.frm.doc.selling_price_list || me.frm.doc.buying_price_list, price_list_currency: me.frm.doc.price_list_currency, plc_conversion_rate: me.frm.doc.plc_conversion_rate, company: me.frm.doc.company, order_type: me.frm.doc.order_type, is_pos: cint(me.frm.doc.is_pos), is_subcontracted: me.frm.doc.is_subcontracted, transaction_date: me.frm.doc.transaction_date || me.frm.doc.posting_date, ignore_pricing_rule: me.frm.doc.ignore_pricing_rule, doctype: me.frm.doc.doctype, name: me.frm.doc.name, project: item.project || me.frm.doc.project, qty: item.qty || 1, stock_qty: item.stock_qty, conversion_factor: item.conversion_factor } }, callback: function(r) { if(!r.exc) { me.frm.script_manager.trigger("price_list_rate", cdt, cdn); me.toggle_conversion_factor(item); if(show_batch_dialog) { var d = locals[cdt][cdn]; $.each(r.message, function(k, v) { if(!d[k]) d[k] = v; }); erpnext.show_serial_batch_selector(me.frm, d); } } } }); } } }, serial_no: function(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); if (item.serial_no) { if (!item.item_code) { this.frm.trigger("item_code", cdt, cdn); } else { var sr_no = []; // Replacing all occurences of comma with carriage return var serial_nos = item.serial_no.trim().replace(/,/g, '\n'); serial_nos = serial_nos.trim().split('\n'); // Trim each string and push unique string to new list for (var x=0; x<=serial_nos.length - 1; x++) { if (serial_nos[x].trim() != "" && sr_no.indexOf(serial_nos[x].trim()) == -1) { sr_no.push(serial_nos[x].trim()); } } // Add the new list to the serial no. field in grid with each in new line item.serial_no = ""; for (var x=0; x<=sr_no.length - 1; x++) item.serial_no += sr_no[x] + '\n'; refresh_field("serial_no", item.name, item.parentfield); if(!doc.is_return) { frappe.model.set_value(item.doctype, item.name, "qty", sr_no.length / item.conversion_factor); frappe.model.set_value(item.doctype, item.name, "stock_qty", sr_no.length); } } } }, validate: function() { this.calculate_taxes_and_totals(false); this.set_item_wise_tax_breakup(); }, company: function() { var me = this; var set_pricing = function() { if(me.frm.doc.company && me.frm.fields_dict.currency) { var company_currency = me.get_company_currency(); var company_doc = frappe.get_doc(":Company", me.frm.doc.company); if (!me.frm.doc.currency) { me.frm.set_value("currency", company_currency); } if (me.frm.doc.currency == company_currency) { me.frm.set_value("conversion_rate", 1.0); } if (me.frm.doc.price_list_currency == company_currency) { me.frm.set_value('plc_conversion_rate', 1.0); } if (company_doc.default_letter_head) { if(me.frm.fields_dict.letter_head) { me.frm.set_value("letter_head", company_doc.default_letter_head); } } if (company_doc.default_terms && me.frm.doc.doctype != "Purchase Invoice" && frappe.meta.has_field(me.frm.doc.doctype, "tc_name")) { me.frm.set_value("tc_name", company_doc.default_terms); } me.frm.script_manager.trigger("currency"); me.apply_pricing_rule(); } } var set_party_account = function(set_pricing) { if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) { if(me.frm.doc.doctype=="Sales Invoice") { var party_type = "Customer"; var party_account_field = 'debit_to'; } else { var party_type = "Supplier"; var party_account_field = 'credit_to'; } var party = me.frm.doc[frappe.model.scrub(party_type)]; if(party) { return frappe.call({ method: "erpnext.accounts.party.get_party_account", args: { company: me.frm.doc.company, party_type: party_type, party: party }, callback: function(r) { if(!r.exc && r.message) { me.frm.set_value(party_account_field, r.message); set_pricing(); } } }); } else { set_pricing(); } } else { set_pricing(); } } if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; else var date = this.frm.doc.transaction_date; if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") && in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){ erpnext.utils.get_shipping_address(this.frm, function(){ set_party_account(set_pricing); }) } else { set_party_account(set_pricing); } if(this.frm.doc.company) { erpnext.last_selected_company = this.frm.doc.company; } }, transaction_date: function() { if (this.frm.doc.transaction_date) { this.frm.transaction_date = this.frm.doc.transaction_date; frappe.ui.form.trigger(this.frm.doc.doctype, "currency"); } }, posting_date: function() { var me = this; if (this.frm.doc.posting_date) { this.frm.posting_date = this.frm.doc.posting_date; if ((this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.customer) || (this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.supplier)) { return frappe.call({ method: "erpnext.accounts.party.get_due_date", args: { "posting_date": me.frm.doc.posting_date, "party_type": me.frm.doc.doctype == "Sales Invoice" ? "Customer" : "Supplier", "party": me.frm.doc.doctype == "Sales Invoice" ? me.frm.doc.customer : me.frm.doc.supplier, "company": me.frm.doc.company }, callback: function(r, rt) { if(r.message) { me.frm.set_value("due_date", r.message); frappe.ui.form.trigger(me.frm.doc.doctype, "currency"); } } }) } else { frappe.ui.form.trigger(me.frm.doc.doctype, "currency"); } } }, get_company_currency: function() { return erpnext.get_currency(this.frm.doc.company); }, contact_person: function() { erpnext.utils.get_contact_details(this.frm); }, currency: function() { /* manqala 19/09/2016: let the translation date be whichever of the transaction_date or posting_date is available */ var transaction_date = this.frm.doc.transaction_date || this.frm.doc.posting_date; /* end manqala */ var me = this; this.set_dynamic_labels(); var company_currency = this.get_company_currency(); // Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc if(this.frm.doc.currency && this.frm.doc.currency !== company_currency && !this.frm.doc.ignore_pricing_rule) { this.get_exchange_rate(transaction_date, this.frm.doc.currency, company_currency, function(exchange_rate) { me.frm.set_value("conversion_rate", exchange_rate); }); } else { this.conversion_rate(); } }, conversion_rate: function() { if(this.frm.doc.currency === this.get_company_currency()) { this.frm.set_value("conversion_rate", 1.0); } if(this.frm.doc.currency === this.frm.doc.price_list_currency && this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) { this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate); } if(flt(this.frm.doc.conversion_rate)>0.0) { if(this.frm.doc.ignore_pricing_rule) { this.calculate_taxes_and_totals(); } else if (!this.in_apply_price_list){ this.apply_price_list(); } } }, get_exchange_rate: function(transaction_date, from_currency, to_currency, callback) { if (!transaction_date || !from_currency || !to_currency) return; return frappe.call({ method: "erpnext.setup.utils.get_exchange_rate", args: { transaction_date: transaction_date, from_currency: from_currency, to_currency: to_currency }, callback: function(r) { callback(flt(r.message)); } }); }, price_list_currency: function() { var me=this; this.set_dynamic_labels(); var company_currency = this.get_company_currency(); // Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc if(this.frm.doc.price_list_currency !== company_currency && !this.frm.doc.ignore_pricing_rule) { this.get_exchange_rate(this.frm.doc.posting_date, this.frm.doc.price_list_currency, company_currency, function(exchange_rate) { me.frm.set_value("plc_conversion_rate", exchange_rate); }); } else { this.plc_conversion_rate(); } }, plc_conversion_rate: function() { if(this.frm.doc.price_list_currency === this.get_company_currency()) { this.frm.set_value("plc_conversion_rate", 1.0); } else if(this.frm.doc.price_list_currency === this.frm.doc.currency && this.frm.doc.plc_conversion_rate && cint(this.frm.doc.plc_conversion_rate) != 1 && cint(this.frm.doc.plc_conversion_rate) != cint(this.frm.doc.conversion_rate)) { this.frm.set_value("conversion_rate", this.frm.doc.plc_conversion_rate); } if(!this.in_apply_price_list) { this.apply_price_list(); } }, uom: function(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); if(item.item_code && item.uom) { return this.frm.call({ method: "erpnext.stock.get_item_details.get_conversion_factor", child: item, args: { item_code: item.item_code, uom: item.uom }, callback: function(r) { if(!r.exc) { me.conversion_factor(me.frm.doc, cdt, cdn); } } }); } }, conversion_factor: function(doc, cdt, cdn, dont_fetch_price_list_rate) { if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) { var item = frappe.get_doc(cdt, cdn); frappe.model.round_floats_in(item, ["qty", "conversion_factor"]); item.stock_qty = flt(item.qty * item.conversion_factor, precision("stock_qty", item)); refresh_field("stock_qty", item.name, item.parentfield); this.toggle_conversion_factor(item); if(!dont_fetch_price_list_rate) this.apply_price_list(item, true); } }, toggle_conversion_factor: function(item) { // toggle read only property for conversion factor field if the uom and stock uom are same if(this.frm.get_field('items').grid.fields_map.conversion_factor) { this.frm.fields_dict.items.grid.toggle_enable("conversion_factor", (item.uom != item.stock_uom)? true: false); } }, qty: function(doc, cdt, cdn) { this.conversion_factor(doc, cdt, cdn, true); this.apply_pricing_rule(frappe.get_doc(cdt, cdn), true); }, set_dynamic_labels: function() { // What TODO? should we make price list system non-mandatory? this.frm.toggle_reqd("plc_conversion_rate", !!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency)); if(this.frm.doc_currency!==this.frm.doc.currency) { // reset names only when the currency is different var company_currency = this.get_company_currency(); this.change_form_labels(company_currency); this.change_grid_labels(company_currency); this.frm.refresh_fields(); this.frm.doc_currency = this.frm.doc.currency; } }, change_form_labels: function(company_currency) { var me = this; this.frm.set_currency_labels(["base_total", "base_net_total", "base_total_taxes_and_charges", "base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "total_amount_to_pay", "base_paid_amount", "base_write_off_amount", "base_change_amount", "base_operating_cost", "base_raw_material_cost", "base_total_cost", "base_scrap_material_cost" ], company_currency); this.frm.set_currency_labels(["total", "net_total", "total_taxes_and_charges", "discount_amount", "grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted", "rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost", "scrap_material_cost", "raw_material_cost", "total_cost"], this.frm.doc.currency); this.frm.set_currency_labels(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency); cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency + " = [?] " + company_currency) if(this.frm.doc.price_list_currency && this.frm.doc.price_list_currency!=company_currency) { cur_frm.set_df_property("plc_conversion_rate", "description", "1 " + this.frm.doc.price_list_currency + " = [?] " + company_currency) } // toggle fields this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount", "base_paid_amount", "base_write_off_amount", "base_operating_cost", "base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"], this.frm.doc.currency != company_currency); this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], this.frm.doc.price_list_currency != company_currency); var show =cint(cur_frm.doc.discount_amount) || ((cur_frm.doc.taxes || []).filter(function(d) {return d.included_in_print_rate===1}).length); if(frappe.meta.get_docfield(cur_frm.doctype, "net_total")) cur_frm.toggle_display("net_total", show); if(frappe.meta.get_docfield(cur_frm.doctype, "base_net_total")) cur_frm.toggle_display("base_net_total", (show && (me.frm.doc.currency != company_currency))); }, change_grid_labels: function(company_currency) { var me = this; this.frm.set_currency_labels(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"], company_currency, "items"); this.frm.set_currency_labels(["rate", "net_rate", "price_list_rate", "amount", "net_amount"], this.frm.doc.currency, "items"); if(this.frm.fields_dict["operations"]) { this.frm.set_currency_labels(["operating_cost", "hour_rate"], this.frm.doc.currency, "operations"); this.frm.set_currency_labels(["base_operating_cost", "base_hour_rate"], company_currency, "operations"); var item_grid = this.frm.fields_dict["operations"].grid; $.each(["base_operating_cost", "base_hour_rate"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency); }); } if(this.frm.fields_dict["scrap_items"]) { this.frm.set_currency_labels(["rate", "amount"], this.frm.doc.currency, "scrap_items"); this.frm.set_currency_labels(["base_rate", "base_amount"], company_currency, "scrap_items"); var item_grid = this.frm.fields_dict["scrap_items"].grid; $.each(["base_rate", "base_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency); }); } if(this.frm.fields_dict["taxes"]) { this.frm.set_currency_labels(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes"); this.frm.set_currency_labels(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes"); } if(this.frm.fields_dict["advances"]) { this.frm.set_currency_labels(["advance_amount", "allocated_amount"], this.frm.doc.party_account_currency, "advances"); } // toggle columns var item_grid = this.frm.fields_dict["items"].grid; $.each(["base_rate", "base_price_list_rate", "base_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency); }); var show = (cint(cur_frm.doc.discount_amount)) || ((cur_frm.doc.taxes || []).filter(function(d) {return d.included_in_print_rate===1}).length); $.each(["net_rate", "net_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, show); }); $.each(["base_net_rate", "base_net_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, (show && (me.frm.doc.currency != company_currency))); }); // set labels var $wrapper = $(this.frm.wrapper); }, recalculate: function() { this.calculate_taxes_and_totals(); }, recalculate_values: function() { this.calculate_taxes_and_totals(); }, calculate_charges: function() { this.calculate_taxes_and_totals(); }, ignore_pricing_rule: function() { if(this.frm.doc.ignore_pricing_rule) { var me = this; var item_list = []; $.each(this.frm.doc["items"] || [], function(i, d) { if (d.item_code) { item_list.push({ "doctype": d.doctype, "name": d.name, "pricing_rule": d.pricing_rule }) } }); return this.frm.call({ method: "erpnext.accounts.doctype.pricing_rule.pricing_rule.remove_pricing_rules", args: { item_list: item_list }, callback: function(r) { if (!r.exc && r.message) { me._set_values_for_item_list(r.message); me.calculate_taxes_and_totals(); if(me.frm.doc.apply_discount_on) me.frm.trigger("apply_discount_on") } } }); } else { this.apply_pricing_rule(); } }, apply_pricing_rule: function(item, calculate_taxes_and_totals) { var me = this; var args = this._get_args(item); if (!(args.items && args.items.length)) { if(calculate_taxes_and_totals) me.calculate_taxes_and_totals(); return; } return this.frm.call({ method: "erpnext.accounts.doctype.pricing_rule.pricing_rule.apply_pricing_rule", args: { args: args }, callback: function(r) { if (!r.exc && r.message) { me._set_values_for_item_list(r.message); if(item) me.set_gross_profit(item); if(calculate_taxes_and_totals) me.calculate_taxes_and_totals(); if(me.frm.doc.apply_discount_on) me.frm.trigger("apply_discount_on") } } }); }, _get_args: function(item) { var me = this; return { "items": this._get_item_list(item), "customer": me.frm.doc.customer, "customer_group": me.frm.doc.customer_group, "territory": me.frm.doc.territory, "supplier": me.frm.doc.supplier, "supplier_type": me.frm.doc.supplier_type, "currency": me.frm.doc.currency, "conversion_rate": me.frm.doc.conversion_rate, "price_list": me.frm.doc.selling_price_list || me.frm.doc.buying_price_list, "price_list_currency": me.frm.doc.price_list_currency, "plc_conversion_rate": me.frm.doc.plc_conversion_rate, "company": me.frm.doc.company, "transaction_date": me.frm.doc.transaction_date || me.frm.doc.posting_date, "campaign": me.frm.doc.campaign, "sales_partner": me.frm.doc.sales_partner, "ignore_pricing_rule": me.frm.doc.ignore_pricing_rule, "doctype": me.frm.doc.doctype, "name": me.frm.doc.name, "is_return": cint(me.frm.doc.is_return), "update_stock": in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0, "conversion_factor": me.frm.doc.conversion_factor }; }, _get_item_list: function(item) { var item_list = []; var append_item = function(d) { if (d.item_code) { item_list.push({ "doctype": d.doctype, "name": d.name, "item_code": d.item_code, "item_group": d.item_group, "brand": d.brand, "qty": d.qty, "parenttype": d.parenttype, "parent": d.parent, "pricing_rule": d.pricing_rule, "warehouse": d.warehouse, "serial_no": d.serial_no, "conversion_factor": d.conversion_factor || 1.0 }); // if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list if (in_list(["Quotation Item", "Sales Order Item", "Delivery Note Item", "Sales Invoice Item"]), d.doctype){ item_list[0]["margin_type"] = d.margin_type item_list[0]["margin_rate_or_amount"] = d.margin_rate_or_amount } } }; if (item) { append_item(item); } else { $.each(this.frm.doc["items"] || [], function(i, d) { append_item(d); }); } return item_list; }, _set_values_for_item_list: function(children) { var me = this; var price_list_rate_changed = false; for(var i=0, l=children.length; i<l; i++) { var d = children[i]; var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule"); for(var k in d) { var v = d[k]; if (["doctype", "name"].indexOf(k)===-1) { if(k=="price_list_rate") { if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true; } frappe.model.set_value(d.doctype, d.name, k, v); } } // if pricing rule set as blank from an existing value, apply price_list if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) { me.apply_price_list(frappe.get_doc(d.doctype, d.name)); } } if(!price_list_rate_changed) me.calculate_taxes_and_totals(); }, apply_price_list: function(item) { var me = this; var args = this._get_args(item); if (!((args.items && args.items.length) || args.price_list)) { return; } return this.frm.call({ method: "erpnext.stock.get_item_details.apply_price_list", args: { args: args }, callback: function(r) { if (!r.exc) { me.in_apply_price_list = true; me.frm.set_value("price_list_currency", r.message.parent.price_list_currency); me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate); me.in_apply_price_list = false; if(args.items.length) { me._set_values_for_item_list(r.message.children); } } } }); }, validate_company_and_party: function() { var me = this; var valid = true; $.each(["company", "customer"], function(i, fieldname) { if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) && me.frm.doc.doctype != "Purchase Order") { if (!me.frm.doc[fieldname]) { frappe.msgprint(__("Please specify") + ": " + frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + ". " + __("It is needed to fetch Item Details.")); valid = false; } } }); return valid; }, get_terms: function() { var me = this; erpnext.utils.get_terms(this.frm.doc.tc_name, this.frm.doc, function(r) { if(!r.exc) { me.frm.set_value("terms", r.message); } }); }, taxes_and_charges: function() { var me = this; if(this.frm.doc.taxes_and_charges) { return this.frm.call({ method: "erpnext.controllers.accounts_controller.get_taxes_and_charges", args: { "master_doctype": frappe.meta.get_docfield(this.frm.doc.doctype, "taxes_and_charges", this.frm.doc.name).options, "master_name": this.frm.doc.taxes_and_charges, }, callback: function(r) { if(!r.exc) { me.frm.set_value("taxes", r.message); me.calculate_taxes_and_totals(); } } }); } }, is_recurring: function() { // set default values for recurring documents if(this.frm.doc.is_recurring && this.frm.doc.__islocal) { frappe.msgprint(__("Please set recurring after saving")); this.frm.set_value('is_recurring', 0); return; } if(this.frm.doc.is_recurring) { if(!this.frm.doc.recurring_id) { this.frm.set_value('recurring_id', this.frm.doc.name); } var owner_email = this.frm.doc.owner=="Administrator" ? frappe.user_info("Administrator").email : this.frm.doc.owner; this.frm.doc.notification_email_address = $.map([cstr(owner_email), cstr(this.frm.doc.contact_email)], function(v) { return v || null; }).join(", "); this.frm.doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(this.frm.doc.posting_date).getDate(); } refresh_many(["notification_email_address", "repeat_on_day_of_month"]); }, from_date: function() { // set to_date if(this.frm.doc.from_date) { var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}; var months = recurring_type_map[this.frm.doc.recurring_type]; if(months) { var to_date = frappe.datetime.add_months(this.frm.doc.from_date, months); this.frm.doc.to_date = frappe.datetime.add_days(to_date, -1); refresh_field('to_date'); } } }, set_gross_profit: function(item) { if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) { var rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1); item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item)); } }, setup_item_selector: function() { // TODO: remove item selector return; // if(!this.item_selector) { // this.item_selector = new erpnext.ItemSelector({frm: this.frm}); // } }, get_advances: function() { if(!this.frm.is_return) { return this.frm.call({ method: "set_advances", doc: this.frm.doc, callback: function(r, rt) { refresh_field("advances"); } }) } }, make_payment_entry: function() { return frappe.call({ method: cur_frm.cscript.get_method_for_payment(), args: { "dt": cur_frm.doc.doctype, "dn": cur_frm.doc.name }, callback: function(r) { var doclist = frappe.model.sync(r.message); frappe.set_route("Form", doclist[0].doctype, doclist[0].name); // cur_frm.refresh_fields() } }); }, get_method_for_payment: function(){ var method = "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry" if(cur_frm.doc.__onload && cur_frm.doc.__onload.make_payment_via_journal_entry){ if(in_list(['Sales Invoice', 'Purchase Invoice'], cur_frm.doc.doctype)){ method = "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_invoice" }else { method= "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_order" } } return method }, set_query_for_batch: function(doc, cdt, cdn) { // Show item's batches in the dropdown of batch no var me = this; var item = frappe.get_doc(cdt, cdn); if(!item.item_code) { frappe.throw(__("Please enter Item Code to get batch no")); } else if (doc.doctype == "Purchase Receipt" || (doc.doctype == "Purchase Invoice" && doc.update_stock)) { return { filters: {'item': item.item_code} } } else { filters = { 'item_code': item.item_code, 'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(), } if(item.warehouse) filters["warehouse"] = item.warehouse return { query : "erpnext.controllers.queries.get_batch_no", filters: filters } } }, }); erpnext.show_serial_batch_selector = function(frm, d) { frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() { new erpnext.SerialNoBatchSelector({ frm: frm, item: d, warehouse_details: { type: "Warehouse", name: d.warehouse }, }); }); }
gpl-3.0
fluoxa/Evolution
src/main/java/de/baleipzig/configuration/IocConfig.java
3942
package de.baleipzig.configuration; import de.baleipzig.configuration.strategies.*; import de.baleipzig.genome.DoubleGenome; import de.baleipzig.genome.Genome; import de.baleipzig.individual.Individual; import de.baleipzig.individual.SuperHero; import de.baleipzig.population.Avengers; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @Configuration public class IocConfig { private final EvoConfig evoConfig; @Setter private Strategy selectedStrategy; @Getter private final Strategy constMutationMixedParentSelection; @Getter private final Strategy ageBasedIncreasingMutationMixedParentSelection; @Getter private final Strategy ageBasedDecreasingMutationMixedParentSelection; @Getter private final Strategy caroTimStrategy; @Autowired public IocConfig(EvoConfig evoConfig) { this.evoConfig = evoConfig; constMutationMixedParentSelection = new Strategy(ParentSelection.mixedParentSelectionFactory(evoConfig.getDeterministicRandomParentRatio()), NaturalSelection.rankRandomSelectionFactory(evoConfig.getRankRandomRatioNaturalSelection()), Mutation.getConstantRateMutationStrategy(evoConfig.getGenomeConfig()), GenomeRecombination.INTERMEDIATE_RECOMBINATION); ageBasedIncreasingMutationMixedParentSelection = new Strategy(ParentSelection.mixedParentSelectionFactory(evoConfig.getDeterministicRandomParentRatio()), NaturalSelection.rankRandomSelectionFactory(evoConfig.getRankRandomRatioNaturalSelection()), Mutation.getAgeBasedIncreasingMutationStrategy(evoConfig.getGenomeConfig()), GenomeRecombination.INTERMEDIATE_RECOMBINATION); ageBasedDecreasingMutationMixedParentSelection = new Strategy(ParentSelection.mixedParentSelectionFactory(evoConfig.getDeterministicRandomParentRatio()), NaturalSelection.rankRandomSelectionFactory(evoConfig.getRankRandomRatioNaturalSelection()), Mutation.getAgeBasedDecreasingMutationStrategy(evoConfig.getGenomeConfig()), GenomeRecombination.INTERMEDIATE_RECOMBINATION); caroTimStrategy = new Strategy( ParentSelection.mixedParentSelectionFactory(0.), NaturalSelection.rankRandomSelectionFactory(evoConfig.getRankRandomRatioNaturalSelection()), Mutation.getAgeBasedDecreasingMutationStrategy(evoConfig.getGenomeConfig()), GenomeRecombination.INTERMEDIATE_RECOMBINATION); switch (evoConfig.getTasksConfig().getStrategy()) { case "constMutationMixedParentSelection": selectedStrategy = constMutationMixedParentSelection; break; case "ageBasedIncreasingMutationMixedParentSelection": selectedStrategy = ageBasedIncreasingMutationMixedParentSelection; break; case "ageBasedDecreasingMutationMixedParentSelection": selectedStrategy = ageBasedDecreasingMutationMixedParentSelection; break; default: throw new RuntimeException(evoConfig.getTasksConfig().getStrategy() + "not found"); } } @Bean @Scope("prototype") public Avengers getPopulation() { return new Avengers(evoConfig.getPopulationConfig(), selectedStrategy); } @Bean @Scope("prototype") public Individual getIndividual() { return new SuperHero(FitnessFunction.griewankFitnessFactory(evoConfig.getGenomeConfig().getNumberOfGenes()), selectedStrategy); } @Bean @Scope("prototype") public Genome getGenome() { return new DoubleGenome(evoConfig.getGenomeConfig()); } }
gpl-3.0
mpmendenhall/MPMUtils
Framework/ContextMap.cc
1127
/// \file ContextMap.cc #include "ContextMap.hh" std::vector<ContextMap*>& ContextMap::getContextStack() { static std::vector<ContextMap*> v; return v; } ContextMap& ContextMap::getContext() { auto& v = getContextStack(); if(!v.size()) v.push_back(new ContextMap); return *v.back(); } ContextMap& ContextMap::pushContext() { auto& v = getContextStack(); v.push_back(new ContextMap(v.size()? v.back() : nullptr)); return *v.back(); } bool ContextMap::popContext() { auto& v = getContextStack(); if(v.size()) { delete v.back(); v.pop_back(); return true; } return false; } ContextMap& ContextMap::operator=(const ContextMap& M) { if(&M == this) return *this; for(auto& kv: M.dat) { if(kv.second.second) dat[kv.first] = {kv.second.second->clone(kv.second.first), kv.second.second->clowner()}; else dat.emplace(kv); } return *this; } void ContextMap::disown(tp_t x) { auto it = dat.find(x); if(it == dat.end()) return; if(it->second.second) it->second.second->deletep(it->second.first); dat.erase(it); }
gpl-3.0
CCAFS/ccafs-ap
impactPathways/src/main/webapp/js/projects/projectDeliverables.js
20422
var $deliverablesTypes, $deliverablesSubTypes,$alreadyDisseminated, $disseminationChannels; var $statuses, $statusDescription; var implementationStatus var hashRegenerated = false; hashScroll = false; $(document).ready(init); function init() { $deliverablesTypes = $("#deliverable_mainType"); $deliverablesSubTypes = $("#deliverable_deliverable_type"); $alreadyDisseminated = $('input[name="deliverable.dissemination.alreadyDisseminated"]'); $disseminationChannels = $('#deliverable_deliverable_dissemination_disseminationChannel'); $statuses = $('#deliverable_deliverable_status'); $statusDescription = $('#statusDescription'); implementationStatus = $statuses.find('option[value="2"]').text(); $endDate = $('#deliverable_deliverable_year'); attachEvents(); // Initialize the tabs initDeliverableTabs(); // Initialize metadata functions initMetadataFunctions(); // Initialize datepicker for period inputs $('input.period').datepicker(); $('input.period').datepicker( "option", "dateFormat", "yy-mm-dd" ); // Execute a change in deliverables types once $deliverablesTypes.trigger('change'); // Set word limits to inputs that contains class limitWords-value, for example : <input class="limitWords-100" /> setWordCounterToInputs('limitWords'); // Create a dropzone to attach files addDropzone(); // Check option selected checkOption(); // Add some plugins addSelect2(); addHoverStar(); addDeliverablesTypesDialog(); // Set names to deliverable files already uploaded setDeliverableFilesIndexes(); // Validate justification at save if(isPlanningCycle()){validateEvent([ "#justification" ]);} } function attachEvents() { // Deliverables Events $(".removeDeliverable, .removeNextUser, .removeElement").click(removeElementEvent); $deliverablesTypes.on("change", changeDeliverableTypes); $deliverablesSubTypes.on("change", changeDeliverableSubTypes); $('.helpMessage3').on("click", openDialog); // Next users events $(".addNextUser").on("click", addNextUserEvent); // Partnership contribution to deliverable $(".addPartner").on("click", addPartnerEvent); // Event when open access restriction is changed $('.openAccessRestrictionOption input').on('change', changeOARestriction); $disseminationChannels.on('change', changeDisseminationChannel); $alreadyDisseminated.on('change', changeDisseminatedOption); // Yes / No Event $('input.onoffswitch-radio').on('change', yesnoEvent); // This event is for check if files smaller than 30MB will be hosted in CCAFS $("#dataSharingOptions input[type=radio]").on("click", checkOption); // This event is for remove file upload fields and inputs $(".removeInput").on("click", removeFileUploaded); // This event is when will be add one URL $(".addFileURL").on("click", addfileURL); // Status $statuses.on('change', function(e) { var statusId = $(this).val(); if(isStatusCancelled(statusId) || isStatusExtended(statusId) || isStatusOnGoing(statusId) ) { $statusDescription.show(400); $statusDescription.find('label').html($('#status-'+statusId).html()); } else { $statusDescription.hide(400); } $statusDescription.find('textarea').val(''); }); $endDate.on('change', changeStatus); $endDate.trigger('change'); } function changeDisseminatedOption(){ var isChecked = ($(this).val() === "true"); if (isChecked){ $('[href="#deliverable-dataSharing"]').parent().hide(); }else{ // Show metadata fields $('#deliverable-metadata').show(200); $('[href="#deliverable-dataSharing"]').parent().show().addClass('animated bounceInUp'); } } function changeStatus(){ checkImplementationStatus($(this).val()); } function isStatusCancelled(statusId) { return(statusId == "5") } function isStatusComplete(statusId) { return(statusId == "3") } function isStatusExtended(statusId) { return(statusId == "4") } function isStatusOnGoing(statusId) { return(statusId == "2") } function checkImplementationStatus(year) { if(year <= currentReportingYear) { $statuses.removeOption(2); } else { $statuses.addOption(2, implementationStatus); } $statuses.select2(); } function changeDisseminationChannel() { var channel = $disseminationChannels.val(); if(channel != "-1") { if(channel == "other") { $('#disseminationName').slideDown("slow"); } else { $('#disseminationName').slideUp("slow"); } $('#disseminationUrl').slideDown("slow"); } else { $('#disseminationUrl').slideUp("slow"); } } function changeOARestriction() { var $period = $('#period-' + this.value); if($period.exists()) { $period.show().siblings().hide(); } else { $('[id*="period"]').hide(); } } function yesnoEvent() { // var isChecked = $(this).is(':checked'); var isChecked = ($(this).val() === "true"); $(this).siblings().removeClass('radio-checked'); $(this).next().addClass('radio-checked'); var array = (this.name).split('.'); var $aditional = $('#aditional-' + array[array.length - 1]); if($(this).hasClass('inverse')) { isChecked = !isChecked; } if(isChecked) { $aditional.slideDown("slow"); } else { $aditional.slideUp("slow"); $aditional.find('input:text,textarea').val(''); } } function addSelect2() { $("#projectDeliverable select").select2({ search_contains: true }); } function openDialog() { $("#dialog").dialog("open"); } function initDeliverableTabs() { $('#projectDeliverable').tabs({ show: { effect: "fadeIn", duration: 200 }, hide: { effect: "fadeOut", duration: 100 } }); if(window.location.hash == ""){ // Set index tab after save $( "#projectDeliverable" ).tabs({ active: $('#indexTab').val() }); } // Check tab for justification field var currentIndexTab = $('#projectDeliverable ul.ui-tabs-nav li.ui-state-active').index(); checkIndexTab(currentIndexTab); $('#indexTab').val(currentIndexTab); // Event when tabs are clicked $('#projectDeliverable ul.ui-tabs-nav li').on('click', function(){ var indexTab = $(this).index(); $('#indexTab').val(indexTab); checkIndexTab(indexTab); }); } function checkIndexTab(indexTab){ if(indexTab == "0"){ $("#justification").parent().show(); }else{ $("#justification").parent().hide(); } } function changeDeliverableTypes(event) { var typeId = $(event.target).val(); updateDeliverableSubTypes(typeId); } function changeDeliverableSubTypes() { var typeId = $deliverablesSubTypes.val(); checkRequiredBlock(typeId); checkOtherSubType(typeId); } function checkRequiredBlock(typeId) { $('[class*="requiredForType"]').hide(); var $requiredTypeBlock = $('.requiredForType-' + typeId); $requiredTypeBlock.show(); } function checkOtherSubType(typeId) { if(typeId == 38) { $(".input-otherType").show('slow').find('input').attr('disabled', false); } else { $(".input-otherType").hide('slow').find('input').attr('disabled', true); } } /* Deliverable information functions */ function setDeliverablesIndexes() { // Updating next users names $("#projectDeliverable .projectNextUser").each(function(i,nextUser) { var elementName = $('#nextUsersName').val() + "[" + i + "]."; $(nextUser).attr("id", "projectNextUser-" + i); $(nextUser).find("span.index").html(i + 1); $(nextUser).find("[name$='].id']").attr("name", elementName + "id"); $(nextUser).find("[name$='user']").attr("name", elementName + "user"); $(nextUser).find("[name$='expectedChanges']").attr("name", elementName + "expectedChanges"); $(nextUser).find("[name$='strategies']").attr("name", elementName + "strategies"); }); // Updating partners contribution names $('#projectDeliverable .deliverablePartner').each(function(i,element) { var elementName = $('#partnersName').val() + "[" + i + "]."; $(element).find("span.index").html(i + 1); $(element).find(".id").attr("name", elementName + "id"); $(element).find(".type").attr("name", elementName + "type"); $(element).find(".partner").attr("name", elementName + "partner"); }); } function addNextUserEvent(e) { e.preventDefault(); var $newElement = $("#projectNextUserTemplate").clone(true).removeAttr("id").addClass("projectNextUser"); $(e.target).parent().before($newElement); $('#deliverable-nextUsers').find('.emptyText').hide(); $newElement.fadeIn("slow"); setDeliverablesIndexes(); } function addPartnerEvent(e) { e.preventDefault(); var $newElement = $("#deliverablePartnerTemplate").clone(true).removeAttr("id"); $(e.target).parent().parent().find('.emptyText').hide(); $(e.target).parent().before($newElement); $newElement.fadeIn("slow"); addSelect2(); setDeliverablesIndexes(); } function addDeliverablesTypesDialog() { $("#dialog").dialog({ autoOpen: false, buttons: { Close: function() { $(this).dialog("close"); } }, width: 925, modal: true }); } function updateDeliverableSubTypes(typeId) { var $subTypeSelect = $("#projectDeliverable select[name$='type'] "); var source = baseURL + "/json/deliverablesByType.do?deliverableTypeID=" + typeId; $.getJSON(source).done(function(data) { // First delete all the options already present in the subtype select $subTypeSelect.empty(); $subTypeSelect.append(setOption('-1', 'Select an option')); $.each(data.subTypes, function(index,subType) { var isSelected = (($("#subTypeSelected").val() == subType.id) ? "selected" : ""); $subTypeSelect.append("<option value='" + subType.id + "' " + isSelected + ">" + subType.name + "</option>"); }); // Refresh the plugin in order to show the changes $subTypeSelect.select2(); // Check if other specify is selected changeDeliverableSubTypes(); // Regenerating hash from form information if(!hashRegenerated) { setFormHash(); hashRegenerated = true; } }).fail(function() { console.log("Error updating deliverables sub types"); }); } function removeElementEvent(e) { e.preventDefault(); var $parent = $(e.target).parent(); $parent.hide("slow", function() { $parent.remove(); setDeliverablesIndexes(); }); } /* Deliverable Rating functions */ function addHoverStar() { $('.hover-star').rating({ cancel: 'Cancel', cancelValue: '0', focus: function(value,link) { var $tip = $(this).parent().find('.hover-test'); $tip[0].data = $tip[0].data || $tip.html(); $tip.html(link.title || 'value: ' + value); }, blur: function(value,link) { var $tip = $(this).parent().find('.hover-test'); $tip.html($tip[0].data || ''); } }); } /* Deliverable Data sharing functions */ function removeFileUploaded() { $(this).parent().fadeOut(function() { $(this).remove(); setDeliverableFilesIndexes(); }); } function checkOption() { var $optionSelectd = $('#dataSharingOptions input[type=radio]:checked'); $(".uploadBlock").hide(); $optionSelectd.parent().next().fadeIn(); } function addDropzone() { $("div#dragAndDrop").dropzone({ init: initDropzone, fallback: fallBackDropzone, // Run this function if the browser not support dropzone plugin forceFallback: false, paramName: "file", // The name that will be used to transfer the file addRemoveLinks: true, params: { projectID: $("input[name^='projectID']").val(), deliverableID: $("input[name^='deliverableID']").val() }, url: baseURL + '/reporting/uploadDeliverable.do', maxFilesize: 30, accept: function(file,done) { canAddFile = true; console.log(file.name); // Check is file is already uploaded if(checkDuplicateFile(file.name)) { $.prompt("Do you want replace this file (" + file.name + ") ?", { title: "There is already a file with the same name.", buttons: { "Yes": true, "No": false }, submit: function(e,v,m,f) { if(v == true) { done(); canAddFile = false; } else { done("There is already a file with the same name"); } } }); } else { done(); } } }); } function initDropzone() { this.on("success", function(file,done) { var result = jQuery.parseJSON(done); if(result.fileSaved) { file.hosted = "Locally"; file.fileID = result.fileID; if(canAddFile) { addFileToUploaded(file); } this.removeFile(file); } }); } function addfileURL(e) { var $target = $(e.target).parent(); var $parent = $target.parent(); var urlString = $target.find("input").val(); if(checkUrl(urlString)) { var file = { "name": urlString, "hosted": $parent.find("input[type=radio]").val(), fileID: -1 }; addFileToUploaded(file); $target.find("input").val("http://"); } else { var notyOptions = jQuery.extend({}, notyDefaultOptions); notyOptions.text = 'Invalid URL'; noty(notyOptions); } } // This function run when the browser not support dropzone plugin function fallBackDropzone() { $("#addFileInput").on("click", function() { var $newElement = $("#fileInputTemplate").clone(true).removeAttr("id"); $(this).parent().prepend($newElement); $newElement.fadeIn(); }); $('#fileInputTemplate input').on("change", checkDublicateFileInput); $("#addFileInput").trigger("click", true); } function checkDublicateFileInput(e) { var $file = $(this); var fileName = $file.val().split('/').pop().split('\\').pop(); if(checkDuplicateFile(fileName)) { $.prompt("Do you want replace this file (" + fileName + ") ?", { title: "There is already a file with the same name.", buttons: { "Yes": true, "No": false }, submit: function(e,v,m,f) { if(v == true) { } else { $file.replaceWith($('#fileInputTemplate input').clone(true)); } } }); } } function addFileToUploaded(file) { var $newElement = $("#deliverableFileTemplate").clone(true).removeAttr("id"); // Filling information obtained $newElement.find(".fileID").val(file.fileID); if(file.hosted == "Locally") { $newElement.find("input[type='hidden'].fileHosted").remove(); $newElement.find("input[type='hidden'].fileLink").remove(); $newElement.find(".fileSize").html((file.size / 1024).toFixed(1) + " KB"); } $newElement.find(".fileHosted").val(file.hosted); $newElement.find(".fileLink").val(file.name); if((file.name).length > 70) { file.name = (file.name).substring(0, 70) + "..."; } $newElement.find(".fileName").html(file.name); $newElement.find(".fileFormat").html(file.hosted); $("#filesUploaded .text").hide(); // Show file uploaded $("#filesUploaded ul").prepend($newElement); $newElement.show("slow"); setDeliverableFilesIndexes(); } function setDeliverableFilesIndexes() { $("form .fileUploaded").each(function(i,element) { var elementName = "deliverable.files[" + i + "]."; $(element).find("input[type='hidden'].fileID").attr("name", elementName + "id"); $(element).find("input[type='hidden'].fileHosted").attr("name", elementName + "hosted"); $(element).find("input[type='hidden'].fileLink").attr("name", elementName + "link"); var fileName = $(element).find(".fileName").html(); if((fileName).length > 70) { $(element).find(".fileName").html((fileName).substring(0, 70) + "..."); } $(element).find(".fileName").attr("title", fileName); }); if($("form .fileUploaded").length == 0) { $("#filesUploaded .text").show(); } } function checkUrl(url) { return url.match(/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?/); } function checkDuplicateFile(fileName) { var alreadyExist = false; $("form .fileUploaded .fileName").each(function(i,element) { if(fileName == $(element).text()) { alreadyExist = true; } }); return alreadyExist; } /* * Metadata functions */ var $disseminationUrl, $metadataOutput, $checkButton; var timeoutID; function initMetadataFunctions() { // Setting vars $disseminationUrl = $('#disseminationUrl input'); $metadataOutput = $('#metadata-output'); $checkButton = $('#fillMetadata'); // Events $disseminationUrl.on('keyup', urlCheck); $checkButton.on("click", function(){ getMetadata(true); }); $disseminationChannels.on('change',function(e) { e.preventDefault(); var optionSelected = $disseminationChannels.val(); $checkButton.show(); if(optionSelected == -1) { $('.example').fadeOut(); $disseminationUrl.fadeOut(500); return; }else if(optionSelected == "other"){ $('.example').fadeOut(); $checkButton.fadeOut(); $metadataOutput.html(""); // Show metadata fields $('#deliverable-metadata').show(200); } $disseminationUrl.val(''); $disseminationUrl.fadeIn(500); $('#info-' + optionSelected).siblings().hide(); $('#info-' + optionSelected).fadeIn(500); }); } function urlCheck(e) { if(($(this).val()).length > 1) { if(timeoutID) { clearTimeout(timeoutID); } // Start a timer that will search when finished timeoutID = setTimeout(getMetadata(true), 1000); } } function getMetadata(fillData) { var optionSelected = $disseminationChannels.val(); var channelUrl = $disseminationUrl.val(); if(channelUrl.length > 1) { var uri = new Uri(channelUrl); var uriPath = uri.path(); var uriHost = uri.host(); var ajaxData = { pageID: optionSelected }; if(optionSelected == 'cgspace') { if(uriHost== "hdl.handle.net"){ ajaxData.metadataID = "oai:cgspace.cgiar.org:" + uriPath.slice(1, uriPath.length); }else{ ajaxData.metadataID = "oai:" + uriHost + ":" + uriPath.slice(8, uriPath.length); } }else if(optionSelected == 'other'){ return } else { ajaxData.metadataID = channelUrl; } // Show metadata fields $('#deliverable-metadata').show(200); $.ajax({ 'url': baseURL + '/metadataByLink.do', 'type': "GET", 'data': ajaxData, 'dataType': "json", beforeSend: function() { $disseminationUrl.addClass('input-loading'); $metadataOutput.html("Searching ... " + ajaxData.metadataID); }, success: function(data) { if(data.errorMessage) { $metadataOutput.html(data.errorMessage); } else { data.metadata = JSON.parse(data.metadata); if (jQuery.isEmptyObject(data.metadata)){ $metadataOutput.html("Metdata empty"); }else{ var fields = []; $.each( data.metadata, function( key, value ) { fields.push(key.charAt(0).toUpperCase() + key.slice(1)); }); $metadataOutput.empty().append("Found metadata for " + ajaxData.metadataID +" <br /> " + fields.reverse().join(', ')); if(fillData){ setMetadata(data.metadata);} } } }, complete: function() { $disseminationUrl.removeClass('input-loading'); }, error: function() { $metadataOutput.empty().append("Invalid URL for searching metadata"); } }); } } function setMetadata(data) { console.log(data); $(".descriptionMetadata").val(data['description.abstract']).autoGrow(); $(".creatorMetadata").val(data['contributor.author']); $(".identifierMetadata").val(data['identifier.doi']); $(".publishierMetadata").val(data.publishier); $(".dateMetadata").val(data['date.available']); $(".relationMetadata").val(data.relation); $(".contributorMetadata").val(data.contributor); $(".subjectMetadata").val(data.subject); $(".sourceMetadata").val(data.source); $(".publicationMetada").val(data.publication); $(".languageMetadata").val(data['language.iso']); $(".coverageMetadata").val(data['coverage']); $(".formatMetadata").val(data.format); $(".rigthsMetadata").val(data.rigths); $(".citation").val(data.citation); }
gpl-3.0
ddcampayo/ddcampayo.github.io
cursos_previos/Curso_CFD_OS/cylinder/dynamicCode/_7bc590e07d9f90da5c97f8a66fc7714bd96d35ee/codeStreamTemplate.C
3444
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Description Template for use with codeStream. \*---------------------------------------------------------------------------*/ #include "dictionary.H" #include "Ostream.H" #include "Pstream.H" #include "unitConversion.H" //{{{ begin codeInclude #line 23 "/home/daniel/ddcampayo.github.io/Curso_CFD_OS/cylinder/system/blockMeshDict.#codeStream" #include "pointField.H" //}}} end codeInclude // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // //{{{ begin localCode //}}} end localCode // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // extern "C" { void codeStream_7bc590e07d9f90da5c97f8a66fc7714bd96d35ee ( Ostream& os, const dictionary& dict ) { //{{{ begin code #line 28 "/home/daniel/ddcampayo.github.io/Curso_CFD_OS/cylinder/system/blockMeshDict.#codeStream" pointField points(19); points[0] = point(0.5, 0, -0.5); points[1] = point(1, 0, -0.5); points[2] = point(2, 0, -0.5); points[3] = point(2, 0.707107, -0.5); points[4] = point(0.707107, 0.707107, -0.5); points[5] = point(0.353553, 0.353553, -0.5); points[6] = point(2, 2, -0.5); points[7] = point(0.707107, 2, -0.5); points[8] = point(0, 2, -0.5); points[9] = point(0, 1, -0.5); points[10] = point(0, 0.5, -0.5); points[11] = point(-0.5, 0, -0.5); points[12] = point(-1, 0, -0.5); points[13] = point(-2, 0, -0.5); points[14] = point(-2, 0.707107, -0.5); points[15] = point(-0.707107, 0.707107, -0.5); points[16] = point(-0.353553, 0.353553, -0.5); points[17] = point(-2, 2, -0.5); points[18] = point(-0.707107, 2, -0.5); // Duplicate z points label sz = points.size(); points.setSize(2*sz); for (label i = 0; i < sz; i++) { const point& pt = points[i]; points[i+sz] = point(pt.x(), pt.y(), -pt.z()); } os << points; //}}} end code } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //
gpl-3.0
coderbone/SickRage-alt
sickbeard/searchBacklog.py
6930
# coding=utf-8 # Author: Nic Wolfe <nic@wolfeden.ca> # URL: https://sickchill.github.io # # This file is part of SickChill. # # SickChill is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SickChill is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SickChill. If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals # Stdlib Imports import datetime import threading # Third Party Imports import six # First Party Imports import sickbeard # Local Folder Imports from . import common, db, logger, scheduler, search_queue, ui class BacklogSearchScheduler(scheduler.Scheduler): def forceSearch(self): self.action._set_lastBacklog(1) self.lastRun = datetime.datetime.fromordinal(1) def nextRun(self): if self.action._lastBacklog <= 1: return datetime.date.today() else: return datetime.date.fromordinal(self.action._lastBacklog + self.action.cycleTime) class BacklogSearcher(object): def __init__(self): self._lastBacklog = self._get_lastBacklog() self.cycleTime = sickbeard.BACKLOG_FREQUENCY / 60 / 24 self.lock = threading.Lock() self.amActive = False self.amPaused = False self.amWaiting = False self.currentSearchInfo = {'title': 'Initializing'} self._resetPI() def _resetPI(self): self.percentDone = 0 self.currentSearchInfo = {'title': 'Initializing'} def getProgressIndicator(self): if self.amActive: return ui.ProgressIndicator(self.percentDone, self.currentSearchInfo) else: return None def am_running(self): logger.log("amWaiting: " + str(self.amWaiting) + ", amActive: " + str(self.amActive), logger.DEBUG) return (not self.amWaiting) and self.amActive def searchBacklog(self, which_shows=None): if self.amActive: logger.log("Backlog is still running, not starting it again", logger.DEBUG) return self.amActive = True self.amPaused = False if which_shows: show_list = which_shows else: show_list = sickbeard.showList self._get_lastBacklog() curDate = datetime.date.today().toordinal() fromDate = datetime.date.fromordinal(1) if not (which_shows or curDate - self._lastBacklog >= self.cycleTime): logger.log("Running limited backlog on missed episodes " + str(sickbeard.BACKLOG_DAYS) + " day(s) and older only") fromDate = datetime.date.today() - datetime.timedelta(days=sickbeard.BACKLOG_DAYS) # go through non air-by-date shows and see if they need any episodes for curShow in show_list: if curShow.paused: continue segments = self._get_segments(curShow, fromDate) for season, segment in six.iteritems(segments): self.currentSearchInfo = {'title': curShow.name + " Season " + str(season)} backlog_queue_item = search_queue.BacklogQueueItem(curShow, segment) sickbeard.searchQueueScheduler.action.add_item(backlog_queue_item) # @UndefinedVariable if not segments: logger.log("Nothing needs to be downloaded for {0}, skipping".format(curShow.name), logger.DEBUG) # don't consider this an actual backlog search if we only did recent eps # or if we only did certain shows if fromDate == datetime.date.fromordinal(1) and not which_shows: self._set_lastBacklog(curDate) self.amActive = False self._resetPI() def _get_lastBacklog(self): logger.log("Retrieving the last check time from the DB", logger.DEBUG) main_db_con = db.DBConnection() sql_results = main_db_con.select("SELECT last_backlog FROM info") if not sql_results: lastBacklog = 1 elif sql_results[0][b"last_backlog"] is None or sql_results[0][b"last_backlog"] == "": lastBacklog = 1 else: lastBacklog = int(sql_results[0][b"last_backlog"]) if lastBacklog > datetime.date.today().toordinal(): lastBacklog = 1 self._lastBacklog = lastBacklog return self._lastBacklog @staticmethod def _get_segments(show, fromDate): wanted = {} if show.paused: logger.log("Skipping backlog for {0} because the show is paused".format(show.name), logger.DEBUG) return wanted allowed_qualities, preferred_qualities = common.Quality.splitQuality(show.quality) logger.log("Seeing if we need anything from {0}".format(show.name), logger.DEBUG) con = db.DBConnection() sql_results = con.select( "SELECT status, season, episode FROM tv_episodes WHERE airdate > ? AND showid = ?", [fromDate.toordinal(), show.indexerid] ) # check through the list of statuses to see if we want any for sql_result in sql_results: cur_status, cur_quality = common.Quality.splitCompositeStatus(int(sql_result[b"status"] or -1)) if cur_status not in {common.WANTED, common.DOWNLOADED, common.SNATCHED, common.SNATCHED_PROPER}: continue if cur_status != common.WANTED: if preferred_qualities: if cur_quality in preferred_qualities: continue elif cur_quality in allowed_qualities: continue ep_obj = show.getEpisode(sql_result[b"season"], sql_result[b"episode"]) if ep_obj.season not in wanted: wanted[ep_obj.season] = [ep_obj] else: wanted[ep_obj.season].append(ep_obj) return wanted @staticmethod def _set_lastBacklog(when): logger.log("Setting the last backlog in the DB to " + str(when), logger.DEBUG) main_db_con = db.DBConnection() sql_results = main_db_con.select("SELECT last_backlog FROM info") if not sql_results: main_db_con.action("INSERT INTO info (last_backlog, last_indexer) VALUES (?,?)", [str(when), 0]) else: main_db_con.action("UPDATE info SET last_backlog=" + str(when)) def run(self, force=False): try: self.searchBacklog() except Exception: self.amActive = False raise
gpl-3.0
tinyivc/java-demo
src/test/java/com/tinyivc/design/proxy/LogicServiceImpl.java
365
package com.tinyivc.design.proxy; public class LogicServiceImpl implements LogicService { @Override public void operation1(int i, String[] stra) { System.out.println("operation1"); } @Override public void operation2() { System.out.println("operation2"); } @Override public void operation3() { System.out.println("operation3"); } }
gpl-3.0
stombre/inAndOut
index.js
461
const buildStorage = require('./libs/internal/storage'); const storage = buildStorage(); const pipe = require('./libs/pipe')(storage); const addCommands = require('./libs/commands')(storage); //Default operations : addCommands(require('./libs/embed/commands/system')); module.exports = { PIPE: { Console: require('./libs/embed/pipe/console') }, COMMANDS: { processEnv: require('./libs/embed/commands/processEnv') }, pipe, addCommands };
gpl-3.0
fernandomr/odoo-brazil-banking
l10n_br_account_payment_mode/__openerp__.py
1595
# -*- coding: utf-8 -*- ############################################################################## # # Odoo Brazil Account Payment Partner module for Odoo # Copyright (C) 2015 KMEE (http://www.kmee.com.br) # @author Luis Felipe Miléo <mileo@kmee.com.br> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'Odoo Brazil Account Banking Payment Infrastructure', 'version': '0.1', 'category': 'Banking addons', 'license': 'AGPL-3', 'summary': '', 'description': """ """, 'author': 'KMEE', 'website': 'http://www.kmee.com.br', 'depends': [ 'l10n_br_account', 'l10n_br_data_base', 'account_due_list_payment_mode', 'account_banking_payment_export' ], 'data': [ 'views/payment_mode_view.xml', ], 'demo': [ 'demo/payment_demo.xml' ], 'active': False, }
gpl-3.0
jrrpanix/master
examples/java/gui/FunctionGraph.java
4372
package gui; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.font.FontRenderContext; import java.awt.geom.Line2D; import javax.swing.JFrame; import javax.swing.JPanel; public class FunctionGraph extends JPanel{ public final int PAD = 20; private DataGen data; FunctionGraph() { data=null; } FunctionGraph( DataGen data ) { this.data=data; } void setData( DataGen d ) { data = d; } public void paint( Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; plotData(g); } private void plotData(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); drawXLabel(g); drawYLabel(g); Scale sX = new Scale(); Scale sY = new Scale(); sY.gMax = PAD; sY.gMin = getHeight() - PAD; sY.dMax = data.maxY; sY.dMin = data.minY; sY.setZero(); sX.gMax = getWidth() - PAD; sX.gMin = PAD; sX.dMax = data.maxX; sX.dMin = data.minX; sX.setZero(); g2.draw(new Line2D.Double(sX.gMin,sY.gMax,sX.gMax,sY.gMax)); g2.draw(new Line2D.Double(sX.gMin,sY.gMin,sX.gMax,sY.gMin)); g2.draw(new Line2D.Double(sX.gMin,sY.gMin,sX.gMin,sY.gMax)); g2.draw(new Line2D.Double(sX.gMax,sY.gMin,sX.gMax,sY.gMax)); g2.draw(new Line2D.Double(sX.zero,sY.gMin,sX.zero,sY.gMax)); g2.draw(new Line2D.Double(sX.gMin,sY.zero,sX.gMax,sY.zero)); int N = data.size(); for( int i = 0; i < N-1 ; i++ ) { double x0 = data.X[i]; double x1 = data.X[i+1]; double y0 = data.Y[i]; double y1 = data.Y[i+1]; double x0t = sX.scale(x0); double y0t = sY.scale(y0); g2.draw(new Line2D.Double(sX.scale(x0), sY.scale(y0), sX.scale(x1), sY.scale(y1))); } } private void drawXLabel( Graphics g) { Graphics2D g2 = (Graphics2D)g; String xlabel = "X-Axis"; Font font = g2.getFont(); FontRenderContext frc = g2.getFontRenderContext(); int w = getWidth(); int h = getHeight(); double wgt = 0.9f; double sx = wgt * w; double sw,sy; for( int i =0 ; i < xlabel.length();i++){ String l = String.valueOf(xlabel.charAt(i)); sw = (double)font.getStringBounds(l, frc).getWidth(); sy = h/2 - 4; g2.drawString(l, (float)sx, (float)sy); sx += sw; } } private void drawYLabel( Graphics g) { Graphics2D g2 = (Graphics2D)g; int w = getWidth(); int h = getHeight(); double wgt = 0.08f; double sy = wgt * h - PAD; double sx = w/2 - 10; double sw; String ylabel= "Y-Axis"; Font font = g2.getFont(); FontRenderContext frc = g2.getFontRenderContext(); for( int i =0 ; i < ylabel.length();i++){ String l = String.valueOf(ylabel.charAt(i)); sw = (double)font.getStringBounds(l, frc).getWidth(); g2.drawString(l, (float)sx, (float)sy); sx += sw; } } //----------------------------------------------------------- // scale data onto graph //----------------------------------------------------------- private class Scale { double dMin; double dMax; double gMin; double gMax; double zero; double ratio() { return (gMax-gMin)/(dMax-dMin); } void setZero() { double r = dMax - dMin; double z = Math.max(0, dMin); double p = (z-dMin)/r; zero = gMin + (gMax-gMin)*p; } double scale( double p ) { return zero + p*ratio(); } } //------------------------------------------------------- // main //------------------------------------------------------- public static void main( String [] args ){ JFrame frame = new JFrame( "Graphics"); frame.setSize(650,650); frame.add( new FunctionGraph(new DataGen(Math.PI*-2,Math.PI*2,2000,new XSquared()))); frame.setLocation(1700,200); frame.setVisible(true); } } class XSquared implements FuncInterface { public double calc( double x ) { return (Math.sin(x) - Math.cos(4*x))/(Math.PI/4+Math.cos(8*x)); } }
gpl-3.0
nive/nive_cms
nive_cms/media.py
2115
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. All rights reserved. # Released under GPL3. See license.txt # __doc__ = """ Media ----- Element to insert audio or video files into the web page. Uses HTML 5 media and audio tags and the browser's default player. """ from nive_cms.i18n import _ from nive.definitions import StagPageElement, ObjectConf, FieldConf from nive_cms.baseobjects import PageElementFileBase class media(PageElementFileBase): def IsVideo(self): return self.data.get("player")==u"video" def IsAudio(self): return self.data.get("player")==u"audio" # media type definition ------------------------------------------------------------------ #@nive_module configuration = ObjectConf( id = "media", name = _(u"Media"), dbparam = "mediafile", context = "nive_cms.media.media", template = "media.pt", selectTag = StagPageElement, icon = "nive_cms.cmsview:static/images/types/media.png", description = _(u"Element to insert audio or video files into the web page. Uses HTML 5 media" u"and audio tags and the browser's default player.") ) player = [{"id": u"video", "name": _(u"Video player")}, {"id": u"audio", "name": _(u"Audio player")}] configuration.data = [ FieldConf(id="media", datatype="file", size=0, default=u"", name=_(u"Mediafile"), description=u""), FieldConf(id="mediaalt", datatype="file", size=0, default=u"", name=_(u"Alternative format"), description=_(u"To support all browsers you need to provide two different file formats.")), FieldConf(id="player", datatype="list", size=10, listItems=player, default=u"", name=_(u"Player"), description=u""), FieldConf(id="textblock", datatype="htext", size=10000, default=u"", fulltext=1, name=_(u"Text"), description=u"") ] fields = ["title", "media", "mediaalt", "player", "textblock", "pool_groups"] configuration.forms = {"create": {"fields":fields}, "edit": {"fields":fields}} jsonfields = fields + ["pool_type","pool_filename"] configuration.toJson = tuple(jsonfields) configuration.views = []
gpl-3.0
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qt3d/src/render/picking/qpickevent.cpp
8734
/**************************************************************************** ** ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qpickevent.h" #include "qpickevent_p.h" #include <private/qobject_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { /*! \class Qt3DRender::QPickEvent \inmodule Qt3DRender \brief The QPickEvent class holds information when an object is picked This is received as a parameter in most of the QObjectPicker component signals when picking succeeds. \sa QPickingSettings, QPickTriangleEvent, QObjectPicker \since 5.7 */ /*! * \qmltype PickEvent * \instantiates Qt3DRender::QPickEvent * \inqmlmodule Qt3D.Render * \sa ObjectPicker PickingSettings * \brief PickEvent holds information when an object is picked. * This is received as a parameter in most of the QObjectPicker component signals when picking * succeeds. */ /*! \fn Qt3DRender::QPickEvent::QPickEvent() Constructs a new QPickEvent. */ QPickEvent::QPickEvent() : QObject(*new QPickEventPrivate()) { } QPickEventPrivate *QPickEventPrivate::get(QPickEvent *object) { return object->d_func(); } /*! \fn Qt3DRender::QPickEvent::QPickEvent(const QPointF &position, const QVector3D &intersection, const QVector3D &localIntersection, float distance) Constructs a new QPickEvent with the given parameters: \a position, \a intersection, \a localIntersection and \a distance */ // NOTE: remove in Qt6 QPickEvent::QPickEvent(const QPointF &position, const QVector3D &worldIntersection, const QVector3D &localIntersection, float distance) : QObject(*new QPickEventPrivate()) { Q_D(QPickEvent); d->m_position = position; d->m_distance = distance; d->m_worldIntersection = worldIntersection; d->m_localIntersection = localIntersection; } /*! Constructs a new QPickEvent with the given parameters: \a position, \a worldIntersection, \a localIntersection, \a distance, \a button, \a buttons and \a modifiers */ QPickEvent::QPickEvent(const QPointF &position, const QVector3D &worldIntersection, const QVector3D &localIntersection, float distance, QPickEvent::Buttons button, int buttons, int modifiers) : QObject(*new QPickEventPrivate()) { Q_D(QPickEvent); d->m_position = position; d->m_distance = distance; d->m_worldIntersection = worldIntersection; d->m_localIntersection = localIntersection; d->m_button = button; d->m_buttons = buttons; d->m_modifiers = modifiers; } /*! \internal */ QPickEvent::QPickEvent(QObjectPrivate &dd, QObject *parent) : QObject(dd, parent) { } /*! \internal */ QPickEvent::~QPickEvent() { } /*! \qmlproperty bool Qt3D.Render::PickEvent::accepted Specifies if event has been accepted */ /*! \property Qt3DRender::QPickEvent::accepted Specifies if event has been accepted */ /*! * \brief QPickEvent::isAccepted * \return true if the event has been accepted */ bool QPickEvent::isAccepted() const { Q_D(const QPickEvent); return d->m_accepted; } /*! * \brief QPickEvent::setAccepted set if the event has been accepted to \a accepted */ void QPickEvent::setAccepted(bool accepted) { Q_D(QPickEvent); if (accepted != d->m_accepted) { d->m_accepted = accepted; emit acceptedChanged(accepted); } } /*! \qmlproperty bool Qt3D.Render::PickEvent::position Specifies the mouse position with respect to the render area (window or quick item) */ /*! \property Qt3DRender::QPickEvent::position Specifies the mouse position with respect to the render area (window or quick item) */ /*! * \brief QPickEvent::position * \return mouse pointer coordinate of the pick query */ QPointF QPickEvent::position() const { Q_D(const QPickEvent); return d->m_position; } /*! \qmlproperty bool Qt3D.Render::PickEvent::distance Specifies the distance of the hit to the camera */ /*! \property Qt3DRender::QPickEvent::distance Specifies the distance of the hit to the camera */ /*! * \brief QPickEvent::distance * \return distance from camera to pick point */ float QPickEvent::distance() const { Q_D(const QPickEvent); return d->m_distance; } /*! \qmlproperty bool Qt3D.Render::PickEvent::worldIntersection Specifies the coordinates of the hit in world coordinate system */ /*! \property Qt3DRender::QPickEvent::worldIntersection Specifies the coordinates of the hit in world coordinate system */ /*! * \brief QPickEvent::worldIntersection * \return coordinates of the hit in world coordinate system */ QVector3D QPickEvent::worldIntersection() const { Q_D(const QPickEvent); return d->m_worldIntersection; } /*! \qmlproperty bool Qt3D.Render::PickEvent::localIntersection Specifies the coordinates of the hit in the local coordinate system of the picked entity */ /*! \property Qt3DRender::QPickEvent::localIntersection Specifies the coordinates of the hit in the local coordinate system of the picked entity */ /*! * \brief QPickEvent::localIntersection * \return coordinates of the hit in the local coordinate system of the picked entity */ QVector3D QPickEvent::localIntersection() const { Q_D(const QPickEvent); return d->m_localIntersection; } /*! * \enum Qt3DRender::QPickEvent::Buttons * * \value LeftButton * \value RightButton * \value MiddleButton * \value BackButton * \value NoButton */ /*! \qmlproperty bool Qt3D.Render::PickEvent::button Specifies mouse button that caused the event */ /*! \property Qt3DRender::QPickEvent::button Specifies mouse button that caused the event */ /*! * \brief QPickEvent::button * \return mouse button that caused the event */ QPickEvent::Buttons QPickEvent::button() const { Q_D(const QPickEvent); return d->m_button; } /*! \qmlproperty bool Qt3D.Render::PickEvent::buttons Specifies state of the mouse buttons for the event */ /*! \property Qt3DRender::QPickEvent::buttons Specifies state of the mouse buttons for the event */ /*! * \brief QPickEvent::buttons * \return bitfield to be used to check for mouse buttons that may be accompanying the pick event. */ int QPickEvent::buttons() const { Q_D(const QPickEvent); return d->m_buttons; } /*! * \enum Qt3DRender::QPickEvent::Modifiers * * \value NoModifier * \value ShiftModifier * \value ControlModifier * \value AltModifier * \value MetaModifier * \value KeypadModifier */ /*! \qmlproperty bool Qt3D.Render::PickEvent::modifiers Specifies state of the mouse buttons for the event */ /*! \property Qt3DRender::QPickEvent::modifiers Specifies state of the mouse buttons for the event */ /*! * \brief QPickEvent::modifiers * \return bitfield to be used to check for keyboard modifiers that may be accompanying the pick event. */ int QPickEvent::modifiers() const { Q_D(const QPickEvent); return d->m_modifiers; } } // Qt3DRender QT_END_NAMESPACE
gpl-3.0
Yskinator/Tsoha-Bootstrap
app/models/Users.php
2574
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Description of Users * * @author ville-matti */ class Users extends BaseModel{ public $id, $username, $password, $list_root; public function __construct($attributes){ parent::__construct($attributes); } public static function all(){ $query = DB::connection()->prepare('SELECT * FROM USERS'); $query->execute(); $rows = $query->fetchAll(); $users = array(); foreach($rows as $row){ $users[] = new Users(array( 'id' => $row['id'], 'username' => $row['username'], 'password' => $row['password'], 'list_root' => $row['list_root'] )); } return $users; } public static function find($id){ $query = DB::connection()->prepare('SELECT * FROM USERS WHERE id = :id LIMIT 1'); $query->execute(array('id' => $id)); $row = $query->fetch(); if($row){ $user = new Users(array( 'id' => $row['id'], 'username' => $row['username'], 'password' => $row['password'], 'list_root' => $row['list_root'] )); return $user; } return null; } public function authenticate($username, $password){ $query = DB::connection()->prepare('SELECT * FROM USERS WHERE username = :username AND password = :password LIMIT 1'); $query->execute(array('username' => $username, 'password' => $password)); $row = $query->fetch(); if($row){ $user = new Users(array( 'id' => $row['id'], 'username' => $row['username'], 'password' => $row['password'], 'list_root' => $row['list_root'] )); return $user; }else{ return null; } } public function save(){ $query = DB::connection()->prepare('INSERT INTO USERS (username, password, list_root) VALUES (:username, password, list_root) RETURNING id'); $query->execute(array( 'username' => $this->username, 'password' => $this->password, 'list_root' => $this->list_root )); $row = $query->fetch(); $this->id = $row['id']; } }
gpl-3.0
filipemb/siesp
WebContent/WEB-INF/screen/arquivosportaria/listarArquivosportaria.js
6747
/******************************************************************************* * This file is part of Educatio. * * Educatio is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Educatio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Educatio. If not, see <http://www.gnu.org/licenses/>. * * Authors: * Filipe Marinho de Brito - filipe.marinho.brito@gmail.com * Rodrigo de Souza Ataides - rodrigoataides@gmail.com *******************************************************************************/ $(document).ready(function() { //propriedades do datatable var id = "listarArquivosportaria"; var url = "ArquivosPortaria"; var sInfoComplemento = "Arquivos Portaria"; //sql var table = "public.arquivos_portaria"; var where = " where 1=? and 2=? "; var argumento = "1|2"; var tipoArgumento = "Integer|Integer"; var order = " order by id desc "; //cria Arquivosportaria buttonset $("#listarArquivosportaria_btnNovo").button({icons: {primary: 'ui-icon-plusthick'}, text: true}); $("#listarArquivosportaria_btnFiltrosAvancados").button({icons: {primary: 'ui-icon-circle-zoomout'}, text: true}); $("#listarArquivosportaria_btnRecarregar").button({icons: {primary: 'ui-icon-arrowreturnthick-1-w'}, text: true}); $("#listarArquivosportaria_btnPDF").button({icons: {primary: 'ui-icon-pdf'}, text: true}); $("#listarArquivosportaria_btnPDF").click(function(){ openNewPagePost(url+"/bServerSide/pdf", montarParametrosServidor(id, colunas, table, where, argumento, tipoArgumento, order, "${encoded}")); }); $("#listarArquivosportaria_btnXLS").button({icons: {primary: 'ui-icon-xls'}, text: true}); $("#listarArquivosportaria_btnXLS").click(function(){ openNewPagePost(url+"/bServerSide/xls", montarParametrosServidor(id, colunas, table, where, argumento, tipoArgumento, order, "${encoded}")); }); var aoColumns = [ {"sTitle": "-", "mDataProp": "htmlControl","bSortable": false, "sWidth": "20px", "bVisible": true, "sDefaultContent":"","sType": "html", "fnRender": function ( oObj ) { if( $("#Arquivosportaria_listar_popUp").attr('innerObject') === 'true' ){ return "<button type=\"button\" id=\"checkBtn_"+oObj.aData.id+"\" class=\"checkBtn"+id+" ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\" onclick=\"selecionarPopUpListarArquivosportaria(event)\" role=\"button\" aria-disabled=\"false\" title=\"Selecionar\" style=\"width: 20px; height: 20px;\"><span class=\"ui-button-icon-primary ui-icon ui-icon-check\"></span><span class=\"ui-button-text\">Selecionar</span></button>"; }else{ return "<a id=\"printBtn_"+oObj.aData.id+"\" class=\"printBtn"+id+" ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\" href=\""+url+"/relatorio/"+oObj.aData.id+"?formato=pdf\" target=\"_blank\" title=\"Relatório\" role=\"button\" aria-disabled=\"false\" style=\"width: 20px; height: 20px;\"><span class=\"ui-button-icon-primary ui-icon ui-icon-print\"></span><span class=\"ui-button-text\">Rel</span></a>" + "<button type=\"button\" id=\"editarBtn_"+oObj.aData.id+"\" class=\"editarBtn"+id+" ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\" onclick=\"editar(event,'"+url+"','"+id+"')\" title=\"Editar\" role=\"button\" aria-disabled=\"false\" style=\"width: 20px; height: 20px;\"><span class=\"ui-button-icon-primary ui-icon ui-icon-pencil\"></span><span class=\"ui-button-text\">Edi</span></button>"+ "<button type=\"button\" id=\"shareBtn_"+oObj.aData.id+"\" class=\"shareBtn"+id+" ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\" onclick=\"compartilhar(event,'"+url+"','"+id+"')\" title=\"Compartilhar\" role=\"button\" aria-disabled=\"false\" style=\"width: 20px; height: 20px;\"><span class=\"ui-button-icon-primary ui-icon ui-icon-extlink\"></span><span class=\"ui-button-text\">Acl</span></button>"+ "<button type=\"button\" id=\"deletarBtn_"+oObj.aData.id+"\" class=\"deletarBtn"+id+" ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\" onclick=\"deletarDoBanco(event,'"+url+"','"+id+"')\" title=\"Deletar\" role=\"button\" aria-disabled=\"false\" style=\"width: 20px; height: 20px;\"><span class=\"ui-button-icon-primary ui-icon ui-icon-close\"></span><span class=\"ui-button-text\">Del</span></button>"; } } }, {"sTitle": "Id", "mDataProp": "id", "bVisible": false, "sType": "numeric" }, {"sTitle": "Tipo Arquivo Portaria", "mDataProp": "tipoArquivoPortaria", "bVisible": true, "sDefaultContent":"", "sWidth": "45px"}, { "sTitle": "Arquivo","mDataProp": "arquivo", "sType": "html", "bVisible": true , "sClass": "right", "sDefaultContent":"", "sWidth": "100px", "bSortable": false, "isObject":true, "insideDataProp": "id", "joinTable":"public.arquivo", "mRender": function ( dataObject, type, full) { var str ='<ul><li><a href="#" onclick="loadPageToPopUp(\'Editar\', \'Arquivo/'+full.arquivo_id+'?formulario\',580,null,true,function(){ $(\'#listarArquivo\').dataTable().fnCallBServerSearch(); })" >'; if(full.arquivo_id!=null){ str +=full.arquivo_id; }else{ str +=""; } str +='</a></li></ul>'; return str; } }, ]; var colunas = JSON.stringify(aoColumns, function(key, val) {if (typeof val === 'function') { return val + '';} return val;}); listServerSide(id, colunas, sInfoComplemento, url, table, where, argumento, tipoArgumento, order, "${encoded}"); }); function selecionarPopUpListarArquivosportaria(event){ var objetoSelecionado = selecionarObjeto(event, "listarArquivosportaria"); buscar('listarArquivosportaria', 'ArquivosPortaria/'+objetoSelecionado.id, afterBuscaPopUpListarArquivosportaria); } function afterBuscaPopUpListarArquivosportaria(data){ $("#listarArquivosportaria_filtrosAvancados").append('<input type="hidden" id="listarArquivosportaria_selecionado" />'); $("#listarArquivosportaria_selecionado").val($.toJSON(data)); try{$("#Arquivosportaria_listar_popUp").dialog('close'); $("#Arquivosportaria_listar_popUp").dialog('destroy'); $("#Arquivosportaria_listar_popUp").remove();} catch(e){} }
gpl-3.0
ayman-alkom/IonicNumPad
test/spec/services/num_pad/numpadservice.js
415
'use strict'; describe('Service: numPad/numPadService', function () { // load the service's module beforeEach(module('IonicNumPad')); // instantiate service /* var numPad/numPadService; beforeEach(inject(function (_numPad/numPadService_) { numPad/numPadService = _numPad/numPadService_; })); */ it('should do something', function () { expect(!!numPad/numPadService).toBe(true); }); });
gpl-3.0
treewojima/tile
src/graphics/window.cpp
1909
/* game * Copyright (C) 2014-2016 Scott Bishop <treewojima@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "graphics/window.hpp" #include <cassert> #include <SDL2/SDL.h> #include "game.hpp" #include "logger.hpp" Graphics::Window::Window() { auto options = getGame().getOptions(); _width = options.windowWidth; _height = options.windowHeight; _window = SDL_CreateWindow("sdl", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, _width, _height, SDL_WINDOW_SHOWN); if (!_window) { throw Exceptions::WindowException(SDL_GetError()); } LOG_INFO << "created window " << this; } Graphics::Window::~Window() { SDL_DestroyWindow(_window); LOG_DEBUG << "destroyed window"; } void Graphics::Window::setTitle(const std::string &&title) { SDL_SetWindowTitle(_window, title.c_str()); } Vector2i Graphics::Window::getDimensions() const { Vector2i ret; SDL_GetWindowSize(_window, &ret.x, &ret.y); return ret; } std::string Graphics::Window::toString() const { std::ostringstream ss; ss << "Window[dimensions = " << getDimensions() << "]"; return ss.str(); }
gpl-3.0
sebjameswml/dt
src/ipp/Encoding.cpp
12522
#ifdef __GNUG__ # pragma implementation #endif #include "Encoding.h" #include <stdexcept> #include <iostream> #include <sstream> using namespace std; using namespace dt; string dt::ipp::Encoding::debugOutput (void) const { stringstream ss; ss << "Version number: " << static_cast<unsigned int>(this->versionNumber[0]) << "." << static_cast<unsigned int>(this->versionNumber[1]) << endl; ss << "Operation ID/Status code: " << this->opIdOrStatusCode << endl; ss << "Request ID: " << this->requestId << endl; vector<ipp::Attr>::const_iterator i = this->attributes.cbegin(); while (i != this->attributes.cend()) { ss << i->debugOutput(); ++i; } ss << "END IPP message details." << endl; return ss.str(); } std::string dt::ipp::Encoding::encode (void) { this->rawMessage = "01234567"; this->rawMessage[0] = this->versionNumber[0]; this->rawMessage[1] = this->versionNumber[1]; this->rawMessage[2] = static_cast < char > ((this->opIdOrStatusCode & 0xff00) >> 8 ); this->rawMessage[3] = static_cast<char>(this->opIdOrStatusCode & 0x00ff); this->rawMessage[4] = static_cast<char>((this->requestId & 0xff000000) >> 24); this->rawMessage[5] = static_cast<char>((this->requestId & 0x00ff0000) >> 16); this->rawMessage[6] = static_cast<char>((this->requestId & 0x0000ff00) >> 8); this->rawMessage[7] = static_cast<char>(this->requestId & 0x000000ff); // cerr << "this->rawMessage size: " << this->rawMessage.size() << endl; // rawMessage[8] is attribute group tag. What should that be? auto i = this->attributes.cbegin(); if (i == this->attributes.cend()) { // There are no attributes to include. } this->currentGroupTag = i->getGroup(); while (i != this->attributes.cend()) { if (i->getGroup() != this->currentGroupTag) { this->currentGroupTag = i->getGroup(); this->rawMessage += static_cast<char>(this->currentGroupTag); } else { this->currentGroupTag = i->getGroup(); } this->rawMessage += i->encode(); ++i; } this->rawMessage += static_cast<char>(ipp::end_attrs); return this->rawMessage; } void dt::ipp::Encoding::parse (void) { if (this->rawMessage.empty()) { throw runtime_error ("rawMessage is empty"); } string::size_type rawMessageSize = this->rawMessage.size(); if (rawMessageSize < ipp::MIN_MESSAGE_LENGTH) { throw runtime_error ("rawMessage is too short"); } cerr << "rawMessage:'" << rawMessage << "'" << endl; this->versionNumber.clear(); this->versionNumber.push_back (static_cast<char>(this->rawMessage[0])); this->versionNumber.push_back (static_cast<char>(this->rawMessage[1])); this->opIdOrStatusCode = 0xffff & (static_cast<short>(this->rawMessage[2])<<8 | static_cast<short>(this->rawMessage[3])); this->requestId = 0xffffffff & (static_cast<int>(this->rawMessage[4])<<24 | static_cast<int>(this->rawMessage[5])<<16 | static_cast<int>(this->rawMessage[6])<<8 | static_cast<int>(this->rawMessage[7])); string::size_type attrGroupPtr = 8; // We're now on the begin attribute group tag //ipp::tag beginAttributeGroupTag = (ipp::tag)this->rawMessage[attrGroupPtr]; //cerr << "first attr group: " << (int)beginAttributeGroupTag << ": " << Attr::tagName(beginAttributeGroupTag)<< endl; // Now get first attribute, and create an IppAttr, passing in rawMessage.substr(relevantBit); attrGroupPtr++; // We're now on the value tag byte ipp::Attr currentAttribute; bool finished = false; bool firstloop = true; while (!finished) { //ipp::tag valueTag = (ipp::tag)this->rawMessage[attrGroupPtr]; //cerr << "value tag: " << (int)valueTag << ": " << Attr::tagName(valueTag) << endl; attrGroupPtr++; // We're now on the first byte of the name length //cerr << "attrGroupPtr:" << attrGroupPtr << endl; //cerr << "rawMessage[nameLength1Position] (MSB): " << hex << (int)rawMessage[attrGroupPtr] << endl; short nameLength1 = static_cast<short>((this->rawMessage[attrGroupPtr++] & 0xff)<<8); //cerr << "name length1: " << nameLength1 << endl; short nameLength2 = static_cast<short>(this->rawMessage[attrGroupPtr] & 0xff); //cerr << "rawMessage[nameLength2Position] (LSB): " << hex << (int)rawMessage[attrGroupPtr] << endl; //cerr << "name length2: " << nameLength2 << endl; short nameLength = nameLength1 | nameLength2; //cerr << "name length: " << nameLength << endl; attrGroupPtr++; // We're now on the first byte of the name if (attrGroupPtr + nameLength > rawMessageSize) { // We're going to fall off the end of the raw message... cerr << "attrGroupPtr:" << attrGroupPtr << " nameLength:" << nameLength << " rawMessageSize:" << rawMessageSize << endl; throw runtime_error ("Malformed IPP payload"); } string name = this->rawMessage.substr (attrGroupPtr, nameLength); if (nameLength > 0) { cerr << "\nname: " << name << endl; } attrGroupPtr += nameLength; // We're now on the first byte of the value length short valueLength1 = static_cast<short>(this->rawMessage[attrGroupPtr++]<<8); short valueLength2 = static_cast<short>(this->rawMessage[attrGroupPtr]); short valueLength = valueLength1 | valueLength2; //cerr << "value length: " << valueLength << endl; attrGroupPtr++; // We're now on the first byte of the value if (attrGroupPtr + valueLength > rawMessageSize) { // We're going to fall off the end of the raw message... cerr << "attrGroupPtr:" << attrGroupPtr << " nameLength:" << nameLength << " rawMessageSize:" << rawMessageSize << endl; throw runtime_error ("Malformed IPP payload (2)"); } string value = this->rawMessage.substr (attrGroupPtr, valueLength); cerr << "value: " << value << endl; // If nameLength is 0, then we have an additional value. if (nameLength > 0) { if (!firstloop) { // then the attribute name has changed //cerr << "push_back the last currentAttribute before setting the currentAttribute" << endl; this->attributes.push_back (currentAttribute); } //cerr << "*** We have an attribute name (" << name << ") ***" << endl; currentAttribute.reset (name); // Debugging: #ifdef DEBUG__ if (valueTag == currentAttribute.getValueType()) { cerr << "value type tags match" << endl; } else { cerr << "Warning: value type tags DON'T match:" << endl; cerr << "valueTag is " << Attr::tagName (valueTag) << " currentAttribute.getValueType() is " << Attr::tagName (currentAttribute.getValueType()) << endl; } #endif } currentAttribute.setValue (value); if (firstloop) { firstloop = false; } attrGroupPtr += valueLength; // Should now be on a tag; either end-tag or a new value. // could re-use valueTag here, really. ipp::tag delimiterTag = (ipp::tag)this->rawMessage[attrGroupPtr]; //cerr << "delimiter tag: " << ipp::Attr::tagName(delimiterTag) << endl; if (delimiterTag == ipp::end_attrs || attrGroupPtr >= rawMessageSize) { cerr << "Finished is true" << endl; finished = true; } else if (delimiterTag == ipp::job_attr) { // Starting job attributes group now. cerr << "Job attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::op_attr) { cerr << "Operation attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::printer_attr) { cerr << "Printer attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::unsupported_attr) { cerr << "Unsupported attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::subscription_attr) { cerr << "Subscription attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::event_notif_attr) { cerr << "Event notification attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::resource_attr) { cerr << "Resource attributes group starts here." << endl; attrGroupPtr++; } else if (delimiterTag == ipp::document_attr) { cerr << "Document attributes group starts here." << endl; attrGroupPtr++; } } // Push back the last one. cerr << "push_back the final currentAttribute" << endl; this->attributes.push_back (currentAttribute); // Was there any data? If so, record the start position of the data. //cerr << "message size: " << rawMessageSize << endl; //cerr << "attrGroupPtr: " << attrGroupPtr << endl; //cerr << "attrGroupPtr points to: " << (int)rawMessage[attrGroupPtr] << endl; if (rawMessage[attrGroupPtr++] == ipp::end_attrs && rawMessageSize > attrGroupPtr) { this->rawMessageDataPos = attrGroupPtr; //cerr << "IPP data is at " << attrGroupPtr << endl; } } // First 2 bytes of rawMessage vector<char> dt::ipp::Encoding::getVersionNumber (void) const { return this->versionNumber; } // Bytes 2 to 3 of rawMessage. short dt::ipp::Encoding::getOpIdOrStatusCode (void) const { return this->opIdOrStatusCode; } // Bytes 4, 5, 6 and 7. int dt::ipp::Encoding::getRequestId (void) const { return this->requestId; } // The IPP attributes vector<ipp::Attr> dt::ipp::Encoding::getAttributes (void) const { return this->attributes; } #ifdef NEED_GET_BY_KEY string dt::ipp::Encoding::getAttribute (const string& key) const { } #endif // Optional data (follows the attributes) std::string dt::ipp::Encoding::getData (void) const { return rawMessage.substr (rawMessageDataPos); } bool dt::ipp::Encoding::hasData (void) const { return this->rawMessageDataPos != string::npos; } void dt::ipp::Encoding::setVersionNumber (const char major, const char minor) { this->versionNumber.clear(); this->versionNumber.push_back (major); this->versionNumber.push_back (minor); } void dt::ipp::Encoding::setOperationId (const short id) { this->opIdOrStatusCode = id; } void dt::ipp::Encoding::setStatusCode (const ipp::status_code code) { this->opIdOrStatusCode = static_cast<short>(code); } void dt::ipp::Encoding::setRequestId (const int id) { this->requestId = id; } void dt::ipp::Encoding::addAttribute (const ipp::Attr& a) { this->attributes.push_back (a); }
gpl-3.0
glauberrleite/lexicanalytics
src/org/lexicanalytics/control/controllers/RootLayoutController.java
339
package org.lexicanalytics.control.controllers; import javafx.fxml.FXML; import org.lexicanalytics.application.Main; import org.lexicanalytics.model.BaseController; /** * * @author glauberrleite * */ public class RootLayoutController extends BaseController { @FXML private void help() { Main.showHelp(); } }
gpl-3.0
prjemian/CountdownJ
src/org/jemian/countdownj/CountdownJ.java
24328
package org.jemian.countdownj; /* CountdownJ, (c) 2010 Pete R. Jemian <prjemian@gmail.com> See LICENSE (GPLv3) for details. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.HierarchyBoundsListener; import java.awt.event.HierarchyEvent; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import javax.swing.WindowConstants; /** * Provide a visible countdown clock as feedback for presentations. */ public class CountdownJ extends JFrame { /** * creates ConfigureJ application main display */ public CountdownJ() { defineInitialTalkConfigurations(); overrideInitialTalkConfigurations(); setDefaultFiles(); restoreSettings(); // restore last known program settings initializeColorTable(); createGui(); setTitle(); talkTimer = new TalkTimer(this, settings.get("basic")); setExtendedState(MAXIMIZED_BOTH); // full screen } // ---------------------------------------------------------------------- /** * construct the GUI widgets */ private void createGui() { defineGuiWidgets(); constructGuiWidgets(); configureGuiWidgets(); pack(); } private void defineGuiWidgets() { // define the GUI widgets (alphabetical order by name) aboutButton = new JButton("About ..."); blackPanel = new JPanel(); configureButton = new JButton("Configure ..."); mmssButton1 = new JButton("+10:00"); mmssButton2 = new JButton("+1:00"); mmssButton3 = new JButton("+0:10"); mmssButton4 = new JButton("+0:01"); mmssButtonStart = new JButton("Start"); mmssButtonStop = new JButton("Stop"); mmssTabPane = new JPanel(); mmssText = new JLabel("MM:SS"); mmssTextPanel = new JPanel(); msgText = new JLabel("Message here"); msgTextPanel = new JPanel(); otherTabPane = new JPanel(); presetButton1 = new JButton("preset1"); presetButton2 = new JButton("preset2"); presetButton3 = new JButton("preset3"); presetButton4 = new JButton("preset4"); presetButtonStart = new JButton("Start"); presetButtonStop = new JButton("Stop"); presetTabPane = new JPanel(); tabbedPane = new JTabbedPane(); } /** * arrange the widgets */ private void constructGuiWidgets() { setLayout(new GridBagLayout()); add(blackPanel, makeConstraints(0, 0, 1.0, 1.0, 1, 1)); blackPanel.setLayout(new GridBagLayout()); blackPanel.add(mmssTextPanel, makeConstraints(0, 0, 1.0, 3.0, 1, 1)); // 3.0 is a judgment call blackPanel.add(msgTextPanel, makeConstraints(0, 1, 1.0, 1.0, 1, 1)); blackPanel.add(tabbedPane, makeConstraints(0, 2, 1.0, 0.0, 1, 1)); mmssTextPanel.setLayout(new GridBagLayout()); mmssTextPanel.add(mmssText, makeConstraints(0, 0, 1.0, 1.0, 1, 1)); msgTextPanel.setLayout(new GridBagLayout()); msgTextPanel.add(msgText, makeConstraints(0, 0, 1.0, 1.0, 1, 1)); tabbedPane.add("basic", mmssTabPane); tabbedPane.add("presets", presetTabPane); tabbedPane.add("other", otherTabPane); mmssTabPane.setLayout(new GridBagLayout()); mmssTabPane.add(mmssButton1, makeConstraints(0, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(mmssButton2, makeConstraints(1, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(mmssButton3, makeConstraints(2, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(mmssButton4, makeConstraints(3, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(new JPanel(), makeConstraints(4, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(mmssButtonStart, makeConstraints(5, 0, 1.0, 0.0, 1, 1)); mmssTabPane.add(mmssButtonStop, makeConstraints(6, 0, 1.0, 0.0, 1, 1)); presetTabPane.setLayout(new GridBagLayout()); presetTabPane.add(presetButton1, makeConstraints(0, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(presetButton2, makeConstraints(1, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(presetButton3, makeConstraints(2, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(presetButton4, makeConstraints(3, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(new JPanel(), makeConstraints(4, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(presetButtonStart, makeConstraints(5, 0, 1.0, 0.0, 1, 1)); presetTabPane.add(presetButtonStop, makeConstraints(6, 0, 1.0, 0.0, 1, 1)); otherTabPane.setLayout(new GridBagLayout()); otherTabPane.add(new JPanel(), makeConstraints(0, 0, 1.0, 0.0, 1, 1)); otherTabPane.add(configureButton, makeConstraints(1, 0, 1.0, 0.0, 1, 1)); otherTabPane.add(new JPanel(), makeConstraints(2, 0, 1.0, 0.0, 1, 1)); otherTabPane.add(aboutButton, makeConstraints(3, 0, 1.0, 0.0, 1, 1)); otherTabPane.add(new JPanel(), makeConstraints(4, 0, 1.0, 0.0, 1, 1)); } /** * make GridBagConstraints for a GridBagLayout item * @param x * @param y * @param weightx * @param weighty * @param rows * @param cols * @return */ private GridBagConstraints makeConstraints(int x, int y, double weightx, double weighty, int cols, int rows) { GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridx = x; c.gridy = y; c.weightx = weightx; c.weighty = weighty; c.gridwidth = cols; c.gridheight = rows; c.insets = new Insets(2, 2, 2, 2); return c; } /** * local customization of standard widgets */ private void configureGuiWidgets() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); blackPanel.setBackground(Color.black); // font sizes track with window size blackPanel.addHierarchyBoundsListener( new HierarchyBoundsListener() { public void ancestorResized(HierarchyEvent e) { doAdjustLabelSizes(); } public void ancestorMoved(HierarchyEvent e) {} }); mmssTextPanel.setBackground(Color.black); mmssTextPanel.setForeground(Color.white); mmssText.setBackground(Color.black); mmssText.setFont(new Font("Tahoma", 1, 48)); mmssText.setForeground(Color.white); mmssText.setHorizontalAlignment(SwingConstants.CENTER); mmssText.setText("mm:ss"); msgTextPanel.setBackground(Color.black); msgTextPanel.setForeground(Color.white); msgText.setBackground(Color.black); msgText.setFont(new Font("Tahoma", 0, 24)); msgText.setForeground(Color.white); msgText.setHorizontalAlignment(SwingConstants.CENTER); msgText.setText("message"); initializeButton( mmssButton1 ); initializeButton( mmssButton2 ); initializeButton( mmssButton3 ); initializeButton( mmssButton4 ); initializeButton( mmssButtonStart ); initializeButton( mmssButtonStop ); initializeButton( presetButton1 ); initializeButton( presetButton2 ); initializeButton( presetButton3 ); initializeButton( presetButton4 ); initializeButton( presetButtonStart ); initializeButton( presetButtonStop ); setTextStopButtons("Clear"); initializeButton( configureButton ); initializeButton( aboutButton ); mmssButton1.setToolTipText("add ten minutes to clock"); mmssButton2.setToolTipText("add one minute to clock"); mmssButton3.setToolTipText("add ten seconds to clock"); mmssButton4.setToolTipText("add one second to clock"); presetButton1.setToolTipText("preset button 1"); presetButton2.setToolTipText("preset button 2"); presetButton3.setToolTipText("preset button 3"); presetButton4.setToolTipText("preset button 4"); presetButton1.setName("preset1"); presetButton2.setName("preset2"); presetButton3.setName("preset3"); presetButton4.setName("preset4"); presetButton1.setText(settings.get("preset1").getName()); presetButton2.setText(settings.get("preset2").getName()); presetButton3.setText(settings.get("preset3").getName()); presetButton4.setText(settings.get("preset4").getName()); configureButton.setToolTipText("change discussion times, messages, presets, save/read settings, ..."); aboutButton.setToolTipText("About this program, the author, the copyright, and license."); } // ---------------------------------------------------------------------- private void doAboutButton() { AboutDialog dialog = new AboutDialog(null); dialog.setVisible(true); } /** * font sizes tracks with window size */ private void doAdjustLabelSizes() { adjustLabelSize(mmssText); adjustLabelSize(msgText); } /** * adjust the size of one JLabel widget * @param label */ private void adjustLabelSize(JLabel label) { Font font = label.getFont(); String fontName = font.getFontName(); int fontStyle = font.getStyle(); Rectangle rect = label.getBounds(); int height = rect.height * 4 / 10; // judgment here if (height < 12) height = 12; // but not too small Font newFont = new Font(fontName, fontStyle, height); label.setFont(newFont); } // ---------------------------------------------------------------------- /** * @return the Ant build number from the ant build.num file */ private int getBuildNumber() { int buildNumber = -1; InputStream in = getClass().getResourceAsStream("/build.num"); if (in != null) { InputStreamReader isr = new InputStreamReader(in); BufferedReader br = new BufferedReader(isr); try { br.readLine(); br.readLine(); String line = br.readLine(); buildNumber = new Integer(line.split("=")[1]); } catch (IOException e) { // ignore this error } try { br.close(); } catch (IOException e) { // ignore this error } try { isr.close(); } catch (IOException e) { // ignore this error } try { in.close(); } catch (IOException e) { // ignore this error } } return buildNumber; } /** * initialization routine */ private void defineInitialTalkConfigurations () { settings = new HashMap<String, TalkConfiguration>(); settings.put("basic", new TalkConfiguration()); for (int i = 0; i < ConfigureDialog.NUMBER_OF_TABS; i++) settings.put("preset" + (i+1), new TalkConfiguration()); } /** * use some sensible default settings */ private void overrideInitialTalkConfigurations() { TalkConfiguration talk = settings.get("basic"); talk.setAudible(true); talk.setPresentation(15 * 60); talk.setDiscussion(5*60); talk.setOvertime(15); talk.setMsg_pretalk("coming up next"); talk.setMsg_presentation("listen up"); talk.setMsg_discussion("questions?"); talk.setMsg_overtime("stop"); talk.setMsg_paused("... waiting ..."); talk.setName("5 minutes"); for (int i = 0; i < ConfigureDialog.NUMBER_OF_TABS; i++) { String key = "preset" + (i+1); talk = settings.get(key); talk.setPresentation((i+1)*5*60); talk.setDiscussion((i+1)*60); talk.setOvertime((i+1)*15); talk.setName(talk.getPresentationStr() + " talk"); talk.setMsg_presentation(talk.getPresentationStr() + " talk"); talk.setMsg_pretalk(talk.getPresentationStr() + " talk is next"); talk.setMsg_discussion(talk.getDiscussionStr() + " period"); talk.setMsg_overtime(talk.getPresentationStr() + " is over"); } } /** * Create the different color objects * just once and re-use them as needed */ private void initializeColorTable() { colorTable = new HashMap<String, Color>(); colorTable.put("black", Color.black); colorTable.put("white", Color.white); colorTable.put("red", Color.red); colorTable.put("yellow", Color.yellow); colorTable.put("green", Color.green); colorTable.put("lightblue", new Color(0xad, 0xd8, 0xe6)); colorTable.put("default", new Color(0, 0, 0xff)); } /** * choose a color by name * @param colorName */ private void setColor(String colorName) { Color color = null; if (colorTable.containsKey(colorName)) { color = colorTable.get(colorName); } else { color = colorTable.get("default"); } mmssText.setForeground(color); msgText.setForeground(color); } private void setTextStartButtons(String text) { if (!strEq(text, mmssButtonStart.getText())) mmssButtonStart.setText(text); if (!strEq(text, presetButtonStart.getText())) presetButtonStart.setText(text); } private void setTextStopButtons(String text) { if (!strEq(text, mmssButtonStop.getText())) mmssButtonStop.setText(text); if (!strEq(text, presetButtonStop.getText())) presetButtonStop.setText(text); } public void doButton(JButton button) { String label = button.getName(); Container parent = button.getParent(); if (parent == mmssTabPane) { if (strEq(label, mmssButton1.getName())) {talkTimer.incrementTime(10*60);} if (strEq(label, mmssButton2.getName())) {talkTimer.incrementTime(60);} if (strEq(label, mmssButton3.getName())) {talkTimer.incrementTime(10);} if (strEq(label, mmssButton4.getName())) {talkTimer.incrementTime(1);} if (strEq(label, mmssButtonStart.getName())) {doStartButton();} if (strEq(label, mmssButtonStop.getName())) {doStopButton();} } if (parent == presetTabPane) { if (strEq(label, presetButton1.getName())) {doPresetButton(label);} if (strEq(label, presetButton2.getName())) {doPresetButton(label);} if (strEq(label, presetButton3.getName())) {doPresetButton(label);} if (strEq(label, presetButton4.getName())) {doPresetButton(label);} if (strEq(label, presetButtonStart.getName())) {doStartButton();} if (strEq(label, presetButtonStop.getName())) {doStopButton();} } if (parent == otherTabPane) { if (strEq(label, "Configure ...")) {doConfigureButton();} if (strEq(label, "About ...")) {doAboutButton();} } } /** * set the button text from the JButton name * and bind it for response * @param button JButton object */ private void initializeButton(JButton button) { String text = button.getText(); button.setName(text); final JButton fButton = button; button.addActionListener( // bind a button click to this action new ActionListener() { public void actionPerformed(ActionEvent e) { doButton(fButton); } }); } /** * compare if two Strings are equal * @param s1 * @param s2 * @return true if equal */ public static boolean strEq(String s1, String s2) { if (s1 == null) return false; if (s2 == null) return false; return (s1.compareTo(s2) == 0); } private void doStartButton() { if (!talkTimer.isCounting() && talkTimer.getClockTime()>0) { setTextStartButtons("Pause"); setTextStopButtons("Stop"); ManageRcFile rc = ManageRcFile.INSTANCE; rc.setUserSettingsFile(userSettingsFile); rc.setSettings(settings); // FIXME: rc.writeRcFile(); talkTimer.start(); } else { talkTimer.pause(); talkTimer.incrementTime(0); // force a timer event? if (talkTimer.getClockTime()>0) { setTextStartButtons("Resume"); setTextStopButtons("Clear"); } else { doStopButton(); // pause overtime, same as full stop } } } private void doStopButton() { // talkTimer.isCounting() talkTimer.stop(); talkTimer.clearCounter(); setTextStartButtons("Start"); setTextStopButtons("Clear"); } private void doConfigureButton() { ConfigureDialog dialog = new ConfigureDialog(new javax.swing.JFrame()); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { //System.exit(0); } }); // ========================================= // pass known configurations to dialog dialog.setBasicSettings(settings.get("basic")); for (int i = 0; i < ConfigureDialog.NUMBER_OF_TABS; i++) { String key = "preset" + (i+1); dialog.setPresetSettings(i+1, settings.get(key)); } dialog.setDefaultSettingsFile(defaultSettingsFile); dialog.setUserSettingsFile(userSettingsFile); // ========================================= dialog.setVisible(true); // ========================================= // get configurations from dialog switch (dialog.getButtonPressed()) { case ConfigureDialog.OK_BUTTON: settings.put("basic", dialog.getBasicSettings()); for (int i = 0; i < ConfigureDialog.NUMBER_OF_TABS; i++) { String key = "preset" + (i+1); settings.put(key, dialog.getPresetSettings(i+1)); } // update the button labels presetButton1.setText(settings.get("preset1").getName()); presetButton2.setText(settings.get("preset2").getName()); presetButton3.setText(settings.get("preset3").getName()); presetButton4.setText(settings.get("preset4").getName()); userSettingsFile = dialog.getUserSettingsFile(); ManageRcFile rc = ManageRcFile.INSTANCE; rc.setUserSettingsFile(userSettingsFile); rc.setSettings(settings); // FIXME: rc.writeRcFile(); break; case ConfigureDialog.CANCEL_BUTTON: // System.out.println("<Cancel>"); break; default: // System.out.println("other thing: " + dialog.getButtonPressed()); break; } // ========================================= dialog.dispose(); // finally } private void doPresetButton(String label) { if (talkTimer.isPaused() || talkTimer.isCounting()) { // do not install a new preset while talk is paused or running smartSetText(msgText, "must [clear] first"); } else { // copy presets to basic settings settings.put("basic", settings.get(label).deepCopy()); // and make a new timer object talkTimer.stop(); // stop the old one first talkTimer = new TalkTimer(this, settings.get("basic")); } } /** * This routine is called by TalkTimer.doTimerEvent() * in response to timer updates. * @param mmss * @param msgTextStr * @param numBeeps * @param color */ public void doDisplayCallback( double time, String mmss, String msgTextStr, int numBeeps, String color) { smartSetText(mmssText, mmss); if (smartSetText(msgText, msgTextStr)) setColor(color); soundBeeps(numBeeps); if (time < 0) setTextStopButtons("stop"); } /** * sound an alert at key transitions in the talk * @param numBeeps */ private void soundBeeps(int numBeeps) { for (int i = 0; i < numBeeps; i++) { try { Thread.sleep(500); // intervals between beeps } catch (InterruptedException e) { // ignore this possibility, per // http://download.oracle.com/javase/tutorial/essential/concurrency/sleep.html } beep(); } } /** * local name for the audible annunciator */ private void beep() { Toolkit.getDefaultToolkit().beep(); } /** * only set the widget text if the new text is different * @param widget JLabel object * @param text new text * @return true if text was changed */ private boolean smartSetText(JLabel widget, String text) { boolean result = false; if (!strEq(widget.getText(), text)) { result = true; widget.setText(text); } return result; } /** * initialization routine */ private void setDefaultFiles() { String dir = System.getProperty("user.home"); String delim = System.getProperty("file.separator"); defaultSettingsFile = "{not defined yet}"; defaultSettingsFile = dir + delim + RC_FILE; userSettingsFile = "{not defined yet}"; boolean exists = new File(defaultSettingsFile).exists(); if (!exists) { ManageRcFile rc = ManageRcFile.INSTANCE; rc.setUserSettingsFile(userSettingsFile); rc.setSettings(settings); rc.setRC_FILE(defaultSettingsFile); // FIXME: rc.writeRcFile(); } } /** * initialization routine */ private void restoreSettings() { ManageRcFile rc = ManageRcFile.INSTANCE; rc.setRC_FILE(defaultSettingsFile); userSettingsFile = rc.getUserSettingsFile(); HashMap<String, TalkConfiguration> tempSettings; tempSettings = rc.getSettings(); if (tempSettings != null) settings = tempSettings; } /** * initialization routine */ private void setTitle() { ConfigFile cfg = ConfigFile.getInstance(); int buildNumber = getBuildNumber(); // WONTFIX can we get most recent revision number from project directory? // String svnRev = "$Revision$".split(" ")[1]; String format = String.format("%s, (%s) <%s>", cfg.getName(), "build:%d", cfg.getEmail()); String title = String.format(format, buildNumber); this.setTitle(title); } // ---------------------------------------------------------------------- /** * @param args the command line arguments */ public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new CountdownJ().setVisible(true); } }); } // ---------------------------------------------------------------------- // declare the GUI widgets (alphabetical order by widget) private JButton aboutButton; private JButton configureButton; private JButton mmssButton1; private JButton mmssButton2; private JButton mmssButton3; private JButton mmssButton4; private JButton mmssButtonStart; private JButton mmssButtonStop; private JButton presetButton1; private JButton presetButton2; private JButton presetButton3; private JButton presetButton4; private JButton presetButtonStart; private JButton presetButtonStop; private JLabel mmssText; private JLabel msgText; private JPanel blackPanel; private JPanel mmssTabPane; private JPanel mmssTextPanel; private JPanel msgTextPanel; private JPanel otherTabPane; private JPanel presetTabPane; private JTabbedPane tabbedPane; // class variables private TalkTimer talkTimer; private HashMap<String, Color> colorTable; private HashMap<String, TalkConfiguration> settings; private static String defaultSettingsFile; private static String userSettingsFile; private static final String RC_FILE = ".countdownjrc"; private static final long serialVersionUID = 1744010558421662336L; }
gpl-3.0
cchou/describe
lib/format/formatbase.rb
4455
require 'xml' require 'structures' require 'DescribeLogger' require 'fileutils' require 'rjb' require 'config' require 'set' class FormatError < StandardError; end class FormatBase NAMESPACES = { 'jhove' => 'http://hul.harvard.edu/ois/xml/ns/jhove', 'mix' => 'http://www.loc.gov/mix/v20', 'aes' => 'http://www.aes.org/audioObject' } attr_reader :fileObject attr_reader :bitstreams attr_reader :anomaly attr_reader :status def initialize(jhoveModule) @module = jhoveModule @anomaly = Set.new @bitstreams = Array.new jhoveEngine = Rjb::import('shades.JhoveEngine') @jhoveEngine = jhoveEngine.new config_file('jhove.conf') end public def setFormat(registry, registryKey) @registry = registry @registryKey = registryKey end def extractWOparse(input) # A temporary file to hold the jhove extraction result tmp = File.new("extract.xml", "w+") output = tmp.path() DescribeLogger.instance.info "module #{@module}, input #{input}, output #{output}" @jhoveEngine.validateFile @module, input, output nil end def extract(input, uri) @fileOjbect = nil @uri = uri @location = input # create a temperary file to hold the jhove extraction result unless (@module.nil?) tmp = File.new("extract.xml", "w+") output = tmp.path() tmp.close DescribeLogger.instance.info "module #{@module}, input #{input}, output #{output}" @jhoveEngine.validateFile @module, input, output begin io = open output XML.default_keep_blanks = false doc = XML::Document.io io # parse the jhove output, extracting only the information we need parse(doc) # parse the validation result, record anomaly messages = @jhove.find('jhove:messages/jhove:message', NAMESPACES) messages.each do |msg| @anomaly.add msg.content end io.close File.delete output @status = @jhove.find_first('jhove:status', NAMESPACES).content rescue => ex DescribeLogger.instance.error ex end end @status end protected def parse(doc) @jhove = doc.find_first("//jhove:repInfo", NAMESPACES) # puts @jhove unless (@jhove.nil?) @fileObject = FileObject.new @fileObject.location = @location @fileObject.uri = @uri @fileObject.size = @jhove.find_first('//jhove:size/text()', NAMESPACES) @fileObject.compositionLevel = '0' recordFormat else # if JHOVE crash while validating the file, there would be no JHOVE output raise FormatError.new("No JHOVE output") end end def recordFormat #retreive the format name unless (@jhove.find_first('//jhove:format', NAMESPACES).nil?) @fileObject.formatName = @jhove.find_first('//jhove:format', NAMESPACES).content # retrieve the format version unless (@jhove.find_first('//jhove:version', NAMESPACES).nil?) @fileObject.formatVersion = @jhove.find_first('//jhove:version', NAMESPACES).content lookup = @fileObject.formatName.to_s + ' ' + @fileObject.formatVersion.to_s else lookup = @fileObject.formatName.to_s end registry = Registry.instance.find_by_lookup(lookup) # make sure there is a format registry record, # if the format identifier has been decided (by format identification), skip this unless (registry.nil?) @registry = registry.name @registryKey = registry.identifier DescribeLogger.instance.info "#{@registry} : #{@registryKey}" end # record format profiles in multiple format designation profiles = @jhove.find('//jhove:profiles/jhove:profile', NAMESPACES) unless (profiles.nil?) @fileObject.profiles = Array.new # retrieve through all profiles profiles.each do |p| @fileObject.profiles << p.content end end end @fileObject.registryName = @registry @fileObject.registryKey = @registryKey end require 'libxml' require 'libxslt' def apply_xsl xsl_file_name stylesheet_file = xsl_file xsl_file_name stylesheet_doc = open(stylesheet_file) { |io| LibXML::XML::Document::io io } stylesheet = LibXSLT::XSLT::Stylesheet.new stylesheet_doc # apply the xslt jdoc = LibXML::XML::Document.string @jhove.to_s #jdoc.root = jdoc.import @jhove stylesheet.apply jdoc end end
gpl-3.0
ckaestne/LEADT
workspace/argouml_critics/argouml-app/src/org/argouml/uml/diagram/activity/ui/SelectionCallState.java
2586
//#if defined(ACTIVITYDIAGRAM) //@#$LPS-ACTIVITYDIAGRAM:GranularityType:Class // $Id: SelectionCallState.java 41 2010-04-03 20:04:12Z marcusvnac $ // Copyright (c) 2006 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice // and this paragraph appear in all copies. This software program and // documentation are copyrighted by The Regents of the University of // California. The software program and documentation are supplied "AS // IS", without any accompanying services from The Regents. The Regents // does not warrant that the operation of the program will be // uninterrupted or error-free. The end-user understands that the program // was developed for research purposes and is advised not to rely // exclusively on the program for any reason. IN NO EVENT SHALL THE // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. package org.argouml.uml.diagram.activity.ui; import org.argouml.model.Model; import org.tigris.gef.presentation.Fig; /** * The Selection Buttons for a CallState. * Almost the same as for an ActionState. * * @author Michiel */ public class SelectionCallState extends SelectionActionState { /** * @param f the fig that is selected */ public SelectionCallState(Fig f) { super(f); } /* * @see org.argouml.uml.diagram.activity.ui.SelectionActionState#getNewNodeType(int) */ protected Object getNewNodeType(int buttonCode) { return Model.getMetaTypes().getCallState(); } /* * @see org.tigris.gef.base.SelectionButtons#getNewNode(int) */ protected Object getNewNode(int buttonCode) { return Model.getActivityGraphsFactory().createCallState(); } }//#endif
gpl-3.0
libre/webexploitscan
wes/data/rules/fullscan/09092019-php-antimalware-tool-730-JSVirus.php
695
<?php /** * WES WebExploitScan Web GPLv4 http://github.com/libre/webexploitscan * * The PHP page that serves all page requests on WebExploitScan installation. * * The routines here dispatch control to the appropriate handler, which then * prints the appropriate page. * * All WebExploitScan code is released under the GNU General Public License. * See COPYRIGHT.txt and LICENSE.txt. */ $NAME='Php-antimalware-tool JSVirus- ID 730'; $TAGCLEAR='x72om'; $TAGBASE64='eDcyb20='; $TAGHEX='7837326f6d'; $TAGHEXPHP=''; $TAGURI='x72om'; $TAGCLEAR2=''; $TAGBASE642=''; $TAGHEX2=''; $TAGHEXPHP2=''; $TAGURI2=''; $DATEADD='09/09/2019'; $LINK='Webexploitscan.org'; $ACTIVED='1'; $VSTATR='JSVirus';
gpl-3.0
dimkasta/F3-UAM
src/Iconic/Log.php
618
<?php /** * Created by PhpStorm. * User: dimkasta * Date: 28/08/16 * Time: 03:25 */ namespace Iconic; trait Log { private $messages; private $enabled; public function enableLog($enabled) { $this->messages = []; $this->enabled = $enabled; } public function log($message) { if($this->enabled) { array_push($this->messages, $message); } } public function showLog() { foreach ($this->messages as $message) { echo $message . "<br>"; } } public function getLog() { return $this->messages; } }
gpl-3.0
oleksandrpriadko/cookbrowser_material
CodeGen/backendless-codegen/CookBrowser-Codegen/CookBrowser-File/src/main/java/com/backendless/cookbrowser/file/MainActivity.java
2968
package com.backendless.cookbrowser.file; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.backendless.Backendless; public class MainActivity extends Activity { private TextView welcomeTextField; private TextView urlField; private Button takePhotoButton; @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); if( Defaults.APPLICATION_ID.equals( "" ) || Defaults.SECRET_KEY.equals( "" ) || Defaults.VERSION.equals( "" ) ) { showAlert( this, "Missing application ID and secret key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage - App Settings screen. Copy/paste the values into the Backendless.initApp call" ); return; } Backendless.setUrl( Defaults.SERVER_URL ); Backendless.initApp( this, Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION ); welcomeTextField = (TextView) findViewById( R.id.welcomeTextField ); urlField = (TextView) findViewById( R.id.urlField ); takePhotoButton = (Button) findViewById( R.id.takePhotoButton ); takePhotoButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); startActivityForResult( cameraIntent, Defaults.CAMERA_REQUEST ); } } ); findViewById( R.id.browseUploadedButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { Intent intent = new Intent( MainActivity.this, BrowseActivity.class ); startActivity( intent ); } } ); } @Override public void onActivityResult( int requestCode, int resultCode, Intent data ) { if( resultCode != RESULT_OK ) return; switch( requestCode ) { case Defaults.CAMERA_REQUEST: data.setClass( getBaseContext(), UploadingActivity.class ); startActivityForResult( data, Defaults.URL_REQUEST ); break; case Defaults.URL_REQUEST: welcomeTextField.setText( getResources().getText( R.string.welcome_text ) ); urlField.setText( (String) data.getExtras().get( Defaults.DATA_TAG ) ); takePhotoButton.setText( getResources().getText( R.string.takeAnotherPhoto ) ); } } public static void showAlert( final Activity context, String message ) { new AlertDialog.Builder( context ).setTitle( "An error occurred" ).setMessage( message ).setPositiveButton( "OK", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialogInterface, int i ) { context.finish(); } } ).show(); } }
gpl-3.0
AtakanSa/lyk17
src/tr/org/linux/kamp/Library/HardCopyBook.java
710
package tr.org.linux.kamp.Library; public class HardCopyBook extends Book { public HardCopyBook(String name, String author, int price, int bookID, int weight, int shippingCost) { super(name, author, price, bookID); this.weight = weight; this.shippingCost = shippingCost; // TODO Auto-generated constructor stub } private int weight; private int shippingCost; public int getWeight() { return weight; } public void setWeight(int weight) { this.weight = weight; } public int getShippingCost() { return shippingCost; } public void setShippingCost(int shippingCost) { this.shippingCost = shippingCost; } public int getTotalCost() { return shippingCost+super.getPrice(); } }
gpl-3.0
TrinityCore/WowPacketParser
WowPacketParserModule.V9_0_1_36216/UpdateFields/V9_1_0_39185/GameObjectData.cs
1321
using WowPacketParser.Misc; using WowPacketParser.Store.Objects.UpdateFields; // This file is automatically generated, DO NOT EDIT namespace WowPacketParserModule.V9_0_1_36216.UpdateFields.V9_1_0_39185 { public class GameObjectData : IMutableGameObjectData { public int? DisplayID { get; set; } public uint SpellVisualID { get; set; } public uint StateSpellVisualID { get; set; } public uint SpawnTrackingStateAnimID { get; set; } public uint SpawnTrackingStateAnimKitID { get; set; } public uint StateWorldEffectsQuestObjectiveID { get; set; } public uint[] StateWorldEffectIDs { get; set; } public WowGuid CreatedBy { get; set; } public WowGuid GuildGUID { get; set; } public uint? Flags { get; set; } public Quaternion? ParentRotation { get; set; } public int? FactionTemplate { get; set; } public sbyte? State { get; set; } public sbyte? TypeID { get; set; } public byte? PercentHealth { get; set; } public uint? ArtKit { get; set; } public uint CustomParam { get; set; } public int? Level { get; set; } public uint AnimGroupInstance { get; set; } public DynamicUpdateField<int> EnableDoodadSets { get; } = new DynamicUpdateField<int>(); } }
gpl-3.0
carlochess/soap-htcondor
lib/schedduler/classads.js
2500
module.exports = function(Schedduler) { Schedduler.prototype.discoverJobRequirements = function(jobAd, cb) { this.client.discoverJobRequirements({ jobAd: jobAd }, function(err, result) { if (err) { cb(err); return; } if(result.response.status.code !== "SUCCESS"){ cb(result.response.status.code) return; } cb(null, result.response); }); } //------------------------- // { transaction :: Transaction , constraint :: string } -> ClassAdStructArrayAndStatus // ClassAdStructArrayAndStatus = {status :: Status , classAdArray :: ClassAdStructArray} // ClassAdStructArray = {item :: ClassAdStruct} // ClassAdStruct = [{item :: ClassAdStructAttr}] // ClassAdStructAttr = {name ::string , type::ClassAdAttrType , value::string } // ClassAdAttrType = INTEGER-ATTR | FLOAT-ATTR | STRING-ATTR | EXPRESSION-ATTR | BOOLEAN-ATTR | UNDEFINED-ATTR | ERROR-ATTR Schedduler.prototype.getJobAd = function(tt,cl,jb, cb) { this.client.getJobAd({ tt, clusterId: cl, jobId: jb }, function(err, result) { if (err) { cb(err); return; } if(result.response.status.code !== "SUCCESS"){ cb(result.response.status.code) return; } cb(null, result.response.classAd); }); } // { transaction :: Transaction , constraint :: string } -> ClassAdStructArrayAndStatus // ClassAdStructArrayAndStatus = {status :: Status , classAdArray :: ClassAdStructArray} // ClassAdStructArray = {item :: ClassAdStruct} // ClassAdStruct = [{item :: ClassAdStructAttr}] // ClassAdStructAttr = {name ::string , type::ClassAdAttrType , value::string } // ClassAdAttrType = INTEGER-ATTR | FLOAT-ATTR | STRING-ATTR | EXPRESSION-ATTR | BOOLEAN-ATTR | UNDEFINED-ATTR | ERROR-ATTR Schedduler.prototype.getJobAds = function(tt, cs, cb) { this.client.getJobAds({ transaction: tt, constraint: cs }, function(err, result) { if (err) { cb(err); return; } if(result.response.status.code !== "SUCCESS"){ cb(result.response.status.code) return; } cb(null, result.response.classAdArray); }); } }
gpl-3.0
baoping/Red-Bull-Media-Player
RedBullPlayer/Test/StatisticsTest/PlayerStartedUrlGenetatorTest.cpp
3595
/* * Red Bull Media Player * Copyright (C) 2011, Red Bull * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "PlayerStartedUrlGenetatorTest.h" // QT plugins #include <QCoreApplication> #include <QSignalSpy> // Project events #include "Constants.h" #include "Error.h" #include "MediaDB.h" #include "StatisticsModule.h" #include "EventTypes.h" #include "InternetConnectionStatusChangedEvent.h" #include "Statistics/CreateStatisticEntryEvent.h" #include "StatisticClientCacheRepostoryFake.h" #include "../../ToolLib/UuidCreator.h" #include "../../Modules/MediaLibrary/StatisticEntry.h" #include "../../Modules/Statistics/UrlGeneratorFactory.h" #include "../../Modules/Statistics/PlayerStartedUrlGenerator.h" #include "../../Interfaces/Statistics/IUrlGenerator.h" #include "../../ToolLib/ConfigManager.h" using namespace RedBullPlayer::Modules::Statistics; using namespace RedBullPlayer::Events; using namespace RedBullPlayer::Modules::MediaLibrary; using namespace RedBullPlayer::Container; using namespace RedBullPlayer::Tools; //void PlayerStartedUrlGenetatorTest::should_create_correct_url() { // StatisticEntry* e = new StatisticEntry( UuidCreator::create(), Constants::STATISTIC_EVENT_TYPE_PLAYER_STARTED, QString::null, QDateTime::currentDateTime() ); // PlayerStartedUrlGenerator g; // // QString date = QString("%1").arg( e->date().toUTC().toTime_t() ); // // QUuid playerUuid = UuidCreator::create(); // // QString serverUrl = ConfigManager::instance()->getStatisticServerUrl(); // if (serverUrl.endsWith("/")) { // serverUrl.chop(1); // } // // QString urlTemplate = Constants::STATISTIC_URL_TEMPLATE; // // urlTemplate = urlTemplate.replace(Constants::STATISTIC_SERVER_URL_KEY,serverUrl); // urlTemplate = urlTemplate.replace(Constants::STATISTIC_DATE_URL_KEY,date); // urlTemplate = urlTemplate.replace(Constants::STATISTIC_TYPE_URL_KEY,Constants::STATISTIC_EVENT_TYPE_PLAYER_STARTED_URL_VALUE); // urlTemplate = urlTemplate.replace(Constants::STATISTIC_DATA_URL_KEY,QString(playerUuid.toString().toUtf8().toHex())); // // // g.setPlayerUuid( playerUuid ); // QUrl u = g.createRequestUrl( *e ); // // // // QVERIFY2( ! u.isEmpty() , "Url must not be empty"); // QVERIFY2(u.toString().compare(urlTemplate) == 0, QString("Generated Url (%1) is not like the templated Url (%2).").arg(u.toString()).arg(urlTemplate).toLatin1()); // //QVERIFY2( u.queryItemValue( Constants::STATISTIC_PLAYERID_URL_KEY ) == plaerUuid.toString(), "Url must contain correct player id item" ); // //QVERIFY2( u.queryItemValue( Constants::STATISTIC_TYPE_URL_KEY ) == Constants::STATISTIC_EVENT_TYPE_PLAYER_STARTED_URL_VALUE, "Url must contain player started as eventType" ); // //QVERIFY2( u.queryItemValue( Constants::STATISTIC_DATE_URL_KEY ) == date, "Url must contain event date" ); // // // g.createRequestUrl( ) // // // //}
gpl-3.0